When Next.js and Expo Should Share Code, and When They Should Not
Teams building a Next.js web app and an Expo mobile app in a monorepo often assume sharing most of the codebase is ideal, but this can slow both platforms. The author argues the better approach is to share business logic aggressively, such as Zod schemas, TypeScript types, pricing and date utilities, and typed API clients, while sharing UI conservatively. Shared logic helps catch contract changes at compile time and prevents inconsistent calculations across platforms. UI sharing tends to create messy platform-specific branches, since web and native differ in navigation, interaction patterns, and performance needs. The article recommends a monorepo structure with separate web and mobile apps plus shared packages for schemas, core logic, and API clients, leaving out a shared UI package.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in