惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
B
Blog RSS Feed
GbyAI
GbyAI
Google DeepMind News
Google DeepMind News
B
Blog
博客园 - 司徒正美
Vercel News
Vercel News
A
About on SuperTechFans
Martin Fowler
Martin Fowler
WordPress大学
WordPress大学
Recent Announcements
Recent Announcements
S
SegmentFault 最新的问题
博客园_首页
Apple Machine Learning Research
Apple Machine Learning Research
Stack Overflow Blog
Stack Overflow Blog
L
LINUX DO - 热门话题
Y
Y Combinator Blog
F
Full Disclosure
月光博客
月光博客
C
Cyber Attacks, Cyber Crime and Cyber Security
MongoDB | Blog
MongoDB | Blog
The Cloudflare Blog
The Hacker News
The Hacker News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
A
Arctic Wolf
Scott Helme
Scott Helme
V
Visual Studio Blog
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tor Project blog
P
Privacy International News Feed
Spread Privacy
Spread Privacy
G
GRAHAM CLULEY
Microsoft Security Blog
Microsoft Security Blog
N
News and Events Feed by Topic
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
PCI Perspectives
PCI Perspectives
小众软件
小众软件
博客园 - 【当耐特】
Cloudbric
Cloudbric
S
Secure Thoughts
L
LINUX DO - 最新话题
Google Online Security Blog
Google Online Security Blog
T
Troy Hunt's Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
W
WeLiveSecurity
V
Vulnerabilities – Threatpost
人人都是产品经理
人人都是产品经理
酷 壳 – CoolShell
酷 壳 – CoolShell
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
量子位

Nx Blog

Sharing Tailwind CSS Styles Across Apps in a Monorepo | Nx Blog How SiriusXM Stays Competitive by Iterating and Getting to Market Fast | Nx Blog Agentic Experience Is the New Developer Experience | Nx Blog Nx Joins the Linux Foundation and the Agentic AI Foundation | Nx Blog A Monorepo Is NOT a Monolith | Nx Blog Why we deleted (most of) our MCP tools | Nx Blog Teach Your AI Agent How to Work in a Monorepo | Nx Blog How Broadcom stays efficient and nimble with monorepos | Nx Blog Why Monorepos are King in the Age of AI | Nx Blog Nx 2026 Roadmap: Expanding Agent Autonomy, Improving Performance, Better Polyglot and More | Nx Blog End to End Autonomous AI Agent Workflows with Nx | Nx Blog Autonomous Agents at Scale | Nx Blog Scaling 700+ Projects: How Nx Became a 'No-Brainer' for Caseware | Nx Blog Configure Tailwind v4 with Angular in an Nx Monorepo | Nx Blog The Missing Multiplier for AI Agent Productivity | Nx Blog A Year of Nx Webinars | Nx Blog Wrapping Up 2025 | Nx Blog Nx 22.3 Release: Angular 21 Support, tsgo Compiler, and Prettier v3 | Nx Blog Nx Cloud Release: Agent Resource Usage | Nx Blog Nx Platform Outperforms DIY Cache by 5x | Nx Blog An Nx Carol: Past, Present, and Future of Your Monorepo | Nx Blog Nx 22.1 Release: Terminal UI on Windows, Storybook 10, Vitest 4, and more! | Nx Blog The Compounding Effect: How Nx Features Multiply Performance Gains | Nx Blog 10 Monorepo Myths Debunked: Separating Fact from Fiction | Nx Blog Nx Cloud Release: Enterprise Task Analytics | Nx Blog Watch and Rebuild Storybook Dependencies with Nx | Nx Blog Book - React for Enterprise: Timeless Architecture for Enterprise Apps | Nx Blog Beyond Remote Cache: Unlock 70% More CI Performance | Nx Blog Nx 22 Release: Expanding the build platform | Nx Blog What's the Point of Generating All This Code If You Can't Merge It? | Nx Blog What's New in Nx Self-Healing CI | Nx Blog Nx Highlights: Smarter AI integration, all-new graph UI, and big new versions of your favorite tools | Nx Blog Making the Case for Smarter Monorepos, and How to Not Get Fooled by Myths | Nx Blog Integrating Biome in 20 Minutes | Nx Blog S1ngularity - What Happened, How We Responded, What We Learned | Nx Blog Stop Babysitting Your PRs: Self-Healing CI Cuts Time to Green by 50% | Nx Blog UKG Unifies Their Codebase and Eliminates CI Overhead to Focus on Customer Value | Nx Blog How Git Worktrees Changed My AI Agent Workflow | Nx Blog Nx Cloud Workspace Graph: See Your Organization's Code Structure Like Never Before | Nx Blog Seamless Java Deployment in Nx Using Docker | Nx Blog Getting Mobile Into Your Monorepo: Android + Nx | Nx Blog Polyglot Projects Made Easy: Integrating Spring Boot into an Nx Workspace | Nx Blog The Journey of the Nx Plugin for Gradle: From Prototype to Production | Nx Blog Combining Predictability and Intelligence With Nx Generators and AI | Nx Blog A New UI For The Humble Terminal | Nx Blog Continuous tasks are a huge DX improvement | Nx Blog New and Improved Module Federation Experience with Nx | Nx Blog A New UI for Nx Migration | Nx Blog Custom Task Runners and Self-Hosted Caching Changes | Nx Blog Enterprise Angular Monorepo Patterns | Nx Blog Using Rspack with Angular | Nx Blog Angular Architecture Guide To Building Maintainable Applications at Scale | Nx Blog Modern Angular Testing with Nx | Nx Blog Nx Update: 20.5 | Nx Blog Are Monorepos the Answer to Better AI-Assisted Development? | Nx Blog Making Cursor Smarter with an MCP Server For Nx Monorepos | Nx Blog React Development for 2025 | Nx Blog Using Apollo GraphQL in an Nx Workspace | Nx Blog Angular State Management for 2025 | Nx Blog Tailoring Nx for Your Organization | Nx Blog Nx Cloud Pipelines Come To Nx Console | Nx Blog Define the relationship with monorepos | Nx Blog See your affected project graph in Nx Cloud | Nx Blog Handling CORS In Your Workspace | Nx Blog Improve your architecture and CI pipeline times with Nx projects | Nx Blog Announcing Nx 20 | Nx Blog Introducing Nx Powerpack | Nx Blog Nx 19.5 is here! Stackblitz, Bun, Incremental Builds for Vite, Gradle Test Atomizer | Nx Blog Introducing Explain with AI | Nx Blog Nx Enterprise Podcast Episode 2: Tine Kondo | Nx Blog Monorepos and CI can be a Mess - Here's How Nx and Nx Cloud Fixed It | Nx Blog Nx Enterprise Podcast Episode 1: Hicham El Hammouchi | Nx Blog Nx 19.0 Release!! | Nx Blog Manage Your Gradle Project using Nx | Nx Blog Making the Argument for Monorepos | Nx Blog Reliable CI. A new execution model fixing both flakiness and slowness | Nx Blog Monorepos - Why Speed Matters | Nx Blog Nx Agents Walkthrough: Effortlessly Fast CI Built for Monorepos | Nx Blog Launch Nx Week Recap | Nx Blog Versioning and Releasing Packages in a Monorepo | Nx Blog Fast, Effortless CI | Nx Blog Introducing @nx/nuxt Enhanced Nuxt.js Support in Nx | Nx Blog What if Nx Plugins Were More Like VSCode Extensions | Nx Blog Monorepos: the Benefits, Challenges, and Importance of Tooling Support | Nx Blog Nx — Highlights of 2023 | Nx Blog Nx 17.2 Update | Nx Blog Unit Testing Expo Apps With Jest | Nx Blog Nx Docs AI Assistant | Nx Blog State Management Nx React Native/Expo Apps with TanStack Query and Redux | Nx Blog Nx 17 has Landed | Nx Blog Nx Conf 2023 — Recap | Nx Blog Nx Raises $16M Series A | Nx Blog Introducing Playwright Support for Nx | Nx Blog Nx 16.8 Release!!! | Nx Blog Step-by-Step Guide to Creating an Expo Monorepo with Nx | Nx Blog Qwikify your Development with Nx | Nx Blog Create Your Own create-react-app CLI | Nx Blog Storybook Interaction Tests in Nx | Nx Blog Evergreen Tooling — More than Just CodeMods | Nx Blog A Practical Guide on Effective AI Use - AI as Your Peer Programmer | Nx Blog
Introducing Expo Support for Nx | Nx Blog
Emily Xiong · 2022-03-24 · via Nx Blog

We are very excited to announce our support for Expo with our new package @nrwl/expo. In addition to the React Native support, with this release of @nrwl/expo, you will be able to easily develop mobile apps in the monorepo. If you use Expo in a monorepo then Nx is the tool for you.

This blog will show you how to create a one-page app to display a poem:

Page Screenshot (left: Android, right: iOS)

Github Repo: xiongemi/nx-expo-poetry

Before We Start

When I just started to try out Expo, the first questions came to my mind were "what is the difference between Expo and React Native" and "when to choose Expo and when to choose React Native"? In short, Expo is a set of tools built on top of React Native. You can read it more at https://stackoverflow.com/questions/39170622/what-is-the-difference-between-expo-and-react-native.

Now I have created an app with Expo, to me, the most significant differences are developer experience and the build process.

Left: managed Expo project folder, right: React Native project folder

For a managed Expo project, notice that it only has a src folder; whereas for a React Native project, besides the src folder, it also contains the android and ios folder. For a managed Expo project, developers do not need to worry about maintaining code for iOS and Android. However, you can still write customized native code for Expo, you can use Expo with bare workflow after running the command expo eject.

Moreover, Expo provides Expo Application Services(EAS) to build and distribute your app. React Native developers can bundle and build locally using Android Studio or Xcode. However, with EAS Build, it will build on a hosted service. Of course, there is potentially a fee involved: https://expo.dev/pricing.

Something to note: @nrwl/expo and @nrwl/react-native cannot exist in the same monorepo due to dependency version conflicts. Expo usually tails the latest React Native by a few versions, whereas @nrwl/react-native tries to align with the latest React Native version.

Setup

First, let's create an Nx workspace:

npx create-nx-workspace nx-expo-poetry --preset=empty

Then you need to install @nrwl/expo package:

cd nx-expo-poetry
# npm
npm install @nrwl/expo --save-dev

# yarn
yarn add @nrwl/expo --dev

Then you need to generate an expo app:

nx generate @nrwl/expo:app poetry-app

Now you should notice that under the apps folder, there are 2 folders generated: peotry-app and poetry-app-e2e:

apps folder

Now run the command to serve up the Expo Development Server:

You should see the starter app in the simulator:

Expo Development Server

Create First Page

Now we got the app running, let's create our first page. In this example, we are going to use the React Native Paper as the material design library. To install:

# npm
npm install react-native-paper --save

# yarn
yarn add react-native-paper

Then, let's create our first component. This component simply displays a poem on the page.

First, to add a component file under the app, run the below command:

nx g @nrwl/expo:component poem-of-the-day --directory=components

Now you should see the components under apps/components:

Then paste the below code to the App.tsx and poem-of-the-day.tsx:

import React from 'react';
import { SafeAreaView, ScrollView } from 'react-native';
import { Provider as PaperProvider } from 'react-native-paper';

import PoemOfTheDay from '../components/poem-of-the-day/poem-of-the-day';

const App = () => {
  return (
    <PaperProvider>
      <SafeAreaView>
        <ScrollView contentInsetAdjustmentBehavior="automatic">
          <PoemOfTheDay></PoemOfTheDay>
        </ScrollView>
      </SafeAreaView>
    </PaperProvider>
  );
};

export default App;
import React from 'react';
import { Card, Title, Paragraph, Subheading } from 'react-native-paper';

/* eslint-disable-next-line */
export interface PoemOfTheDayProps {}

export function PoemOfTheDay(props: PoemOfTheDayProps) {
  return (
    <Card>
      <Card.Cover source={{ uri: `https://picsum.photos/300/200` }} />
      <Card.Content>
        <Title>Ozymandias</Title>
        <Subheading>Percy Bysshe Shelley</Subheading>
        <Paragraph>
          I met a traveller from an antique land {'\n'}
          Who said: Two vast and trunkless legs of stone {'\n'}
          Stand in the desert...Near them, on the sand, {'\n'}
          Half sunk, a shattered visage lies, whose frown,{'\n'}
          And wrinkled lip, and sneer of cold command, {'\n'}
          Tell that its sculptor well those passions read {'\n'}
          Which yet survive, stamped on these lifeless things, {'\n'}
          The hand that mocked them, and the heart that fed: {'\n'}
          And on the pedestal these words appear: {'\n'}
          'My name is Ozymandias, king of kings: {'\n'}
          Look on my works, ye Mighty, and despair!' {'\n'}
          Nothing beside remains. Round the decay{'\n'}
          Of that colossal wreck, boundless and bare{'\n'}
          The lone and level sands stretch far away.
        </Paragraph>
      </Card.Content>
    </Card>
  );
}

export default PoemOfTheDay;

Now, if you run command nx start poetry-app and then run the app on the simulator, you should see:

Page Screenshot (left: Android, right: iOS)

To see it in the real device, run nx publish poetry-app.

Awesome! Now you have built your first page. However, notice this page only displays a static poem. The next step is to integrate with the API. In this example. We are going to use PoetryDB: https://github.com/thundercomb/poetrydb.

Create a Workspace Library

To create a library that gets a random poem from the API, run the command:

nx generate @nrwl/expo:library services

This should generate a services folder under libs:

Create a poetry.service.ts file to call the PoetryDB API and get a random poem:

poem-response.interfacve.ts

// at libs/services/src/models/poem-response.interface.ts
export interface PoemResponse {
  title: string;
  author: string;
  lines: string[];
  linecount: string;
}
// at libs/services/src/poetry/poetry.service.ts
import { PoemResponse } from '../models/poem-response.interface';

const POETRY_BASE_URL = 'https://poetrydb.org/';

export async function getPoemOfTheDay(): Promise<PoemResponse[]> {
  const response: Response = await fetch(POETRY_BASE_URL + 'random', {
    method: 'GET',
  });
  if (response.ok) {
    return await response.json();
  }
  throw response;
}

export const poetryService = { getPoemOfTheDay };

For the service we created above, we can import it in the app directly like:

import { PoemResponse, poetryService } from '@nx-expo-poetry/services';

Then the apps/poetry-app/src/components/poem-of-the-day/poem-of-the-day.tsx would become:

If you now run the app using nx start poetry-app, you should see the poem loaded from API:

Page Screenshot (left: Android, right: iOS)

Using Expo Build

Now you want to build and possibly publish your app. To build the standalone app, you can use the Expo build. First, you need to create an Expo account. You can do it at https://expo.dev/signup or using the command line:

Then you can run the build command:

# iOS
nx build-ios poetry-app

# Android
nx build-android poetry-app

You can monitor your builds after logging in at https://expo.dev/:

Builds page at https://expo.dev/

You can read more at https://docs.expo.dev/classic/building-standalone-apps/ to debug.

Using EAS Build

Before you start to use EAS build, you need to install EAS CLI:

Then, you can sign up and log in to your Expo:

Then go to the app folder using cd apps/poetry-app and simply run:

You can monitor your builds after logging in at https://expo.dev/:

Builds page at https://expo.dev/

To submit to the app store, run:

Conclusion

In this article, we have:

  • successfully built an expo app using Nx
  • add UI in the app
  • create a separate library to handle services
  • use EAS to build the app

With Nx, we can create as many libraries as we want to handle different concerns. It would be very handy to share and reuse libraries or have multiple apps in the same monorepo.

I hope you found this useful, and we look forward to hearing your feedback.

If you're new to Nx and want to learn more, visit our docs.

(Note, the repository with the code for this article is linked at the very top.)

This app is also available in the app store, just search "Poem of the Day":

Android:

Poem of the Day

iOS:

Screenshot in iOS app store