Is expo trpc supposed to work without nextjs?
I have a fresh copy of create-t3-turbo. When launching expo only I can get it to load but it is not displaying posts. When i run general dev command which launches nextjs + expo, posts load on expo. Is this supposed to happen or is expo trpc supposed to work without nextjs running?
If this is correct behavior how does it work in production if your website goes offline?
Solution:Jump to solution
trpc "extends" nextjs api routes and works just like a simple REST server in this aspect. if you don't run the nextjs app, no server will be running, so the expo client wont have anything to connect to. ideally in production your website wont go offline, otherwise the api will not work.
7 Replies
Solution
trpc "extends" nextjs api routes and works just like a simple REST server in this aspect. if you don't run the nextjs app, no server will be running, so the expo client wont have anything to connect to. ideally in production your website wont go offline, otherwise the api will not work.
is this standard practice for mobile apps? with vercel i understand the possibility of it being down is minimal but it could still happen
if you host any kind of server (rest, trpc or actually anything), there is a chance of it going down
considering that, this is absolutely a good practice
you don't need to use nextjs if you want to stick to trpc, you can use a vanilla http server (provided by @trpc/server)
Standalone Adapter | tRPC
tRPC's Standalone Adapter is the simplest way to stand up your application. It's ideal for local development, and for server-based production environments. In essence it's just a wrapper around the standard Node.js HTTP Server with the normal options related to tRPC.
you can learn more about this here if you don't need nextjs for web and only want to use TRPC as your backend
I also didnt read all the t3-turbo docs i guess, and found this:
https://github.com/t3-oss/create-t3-turbo#:~:text=Make%20sure%20to%20modify%20the%20getBaseUrl%20function%20to%20point%20to%20your%20backend%27s%20production%20URL%3A
which tells you to change your BaseURL inside expo for production to point at deployed vercel enviorment
it does not have to be vercel hosted, you can also self host it or use other providers