Every cross-platform JavaScript team hits the same crossroads: you have a Next.js web app and an Expo mobile app, both written in TypeScript and React. On paper, putting them in a monorepo and sharing 90% of the codebase sounds like an obvious win.
In practice, chasing maximum code sharing between web and native is one of the fastest ways to slow down both platforms. After building and maintaining cross-platform products with Next.js and Expo, I have found that the sweet spot is not "share everything" it is sharing logic aggressively and sharing UI conservatively.
What You Should Always Share
1. Validation Schemas and Domain Types
Sharing Zod schemas, TypeScript interfaces, and API response contracts in a packages/shared workspace has virtually zero downside. When a backend payload changes, both your Next.js Route Handlers and your Expo screens fail at compile time instead of in production.
2. Business Rules and Pure Utilities
Price calculations, date formatting, permission checks, and state machines have nothing to do with the DOM or native views. Putting them in pure TypeScript modules eliminates subtle drift where web rounds a total one way and iOS rounds it another.
3. API Clients and Query Keys
If you use TanStack Query on both platforms, sharing your typed API client and query key factories keeps caching behavior consistent. The only thing you inject per platform is the token retrieval function (cookies on Next.js vs. expo-secure-store on mobile).
Where Code Sharing Starts Hurting
1. Navigation and Routing
Even with Expo Router adopting file-based routing inspired by Next.js, navigation paradigms remain fundamentally different. Web relies on URLs, browser history, hover states, and deep-linkable layouts. Mobile relies on native stacks, bottom tabs, swipe-back gestures, and modal sheets. Trying to wrap both behind a unified navigation abstraction usually produces a clunky web app that feels like a mobile port or a mobile app that ignores native gestures.
2. Complex UI Components
Universal UI libraries (like Tamagui or NativeWind) are genuinely impressive for design tokens, spacing, and simple primitives like buttons or badges. The friction appears on complex screens: data tables, multi-step forms, drag-and-drop interfaces, and keyboard-heavy dashboards.
On Next.js, you want Server Components, semantic HTML, and zero unnecessary client JavaScript. On Expo, you need FlashList, native keyboards, haptics, and gesture handlers. Forcing a single component to satisfy both constraints leads to files littered with Platform.OS === 'web' branches that are harder to maintain than two clean, platform-specific components.
3. Authentication Flows
Next.js 15 leans heavily on HTTP-only cookies and middleware for server-side session checks. Expo apps rely on bearer tokens stored in secure native storage and deep links for OAuth callbacks. Share the user profile types, but keep the auth plumbing separate.
A Practical Monorepo Layout
If you want the speed of a monorepo without the UI abstraction tax, this boundary holds up well:
apps/ web/ # Next.js 15 (App Router, Server Components, Tailwind) mobile/ # Expo (Expo Router, native gestures, SecureStore) packages/ schemas/ # Zod schemas, DB types, API contracts core/ # Pure business logic, formatters, pricing rules api-client/ # Typed fetch wrappers & TanStack Query keys Notice what is missing: packages/ui. Unless you have a dedicated design systems engineer maintaining cross-platform primitives, letting web use standard HTML/Tailwind and mobile use native React Native components is almost always faster to ship and easier to debug.
The Rule of Thumb
Share code when two platforms must agree on the truth (data shapes, validation, calculations, API contracts). Keep code separate when two platforms need to feel right to the user (layout, navigation, gestures, rendering lifecycle). The goal of a monorepo is shipping a better product faster, not winning a code-reuse percentage contest.


