Implementation of expo app with turborepo backend #12957
Replies: 2 comments 2 replies
|
The thing that trips people up moving from a single Next app to a monorepo: Expo can't share Next's API routes as a runtime. Next API routes run on a Node/edge server; Expo is React Native and just makes HTTP calls to a server. So there's no "same api route" the way you had it before, but you don't need a second backend either. The pattern that works in Turborepo:
So: one backend (Next's routes), two frontends calling it, shared code in a package. The separate deployment isn't a problem to solve, it's just how it is. Web goes to Vercel, the mobile app goes through EAS Build to the app stores. Different targets, different pipelines, same monorepo. If you ever outgrow Next routes (need websockets, background jobs, non-Vercel hosting), that's when you split out a standalone If you want a reference, the |
|
The short version: keep one backend, but stop thinking of it as "inside" the web app from the phone's point of view. Expo apps are clients, they can only talk HTTP to a server, so the decision is just where that server lives. Both of these work fine in Turborepo: Option A, keep the Next.js route handlers as your API. Structure looks like Option B, a standalone For the type-safe version of option A, look at create-t3-turbo (github.com/t3-oss/create-t3-turbo). It is exactly this setup: Turborepo with a Next.js app, an Expo app, and tRPC in a shared package so the phone gets end-to-end types against the API served by Next. Even if you do not want tRPC, the repo layout answers most of the structural questions you are asking. Two practical gotchas: your dev machine's localhost is not reachable from a device or emulator, so use the LAN IP or a tunnel for |
Uh oh!
There was an error while loading. Please reload this page.
Summary
Previously with next js i could create the backend and and apps with same api route
Now since working with turbo repo i want to create the app and web application in same place
But the implementation of the expo app and its dependency in same application and its deployement have become problem
Additional information
Example
No response
All reactions