Is the server a 'custom server'
I'd like to understand how vercel prices the deployment
- Is the server custom (https://nextjs.org/docs/advanced-features/custom-server), I.E would it be running at all times once you deploy to vercel, or does it start only @ the RPC invocation?
- If it does only start for each invocation, I'm guessing something like a local sqlite DB wouldn't work with this setup, as it wouldn't persist between teardowns?
18 Replies
The defaults on vercel is to run your backend on serverless functions u will not be able to keep persisted state
Idk what the rest of your question is
As it says on the custom server page you linked, custom server is not compatible with vercel
Vercel runs on lambdas which means for each request you build it up, handle the request, and then tear it back down
(this isn't 100% true in all cases, but is the best mental model to understand how it works in general)
You're correct in assuming that something like a local sqlite db wouldn't work. State is not persisted.
Ok thanks, is there any suggested easy to set up DB's that cun run on free tier vercel?
What i'm after is being able to run my side projects for free, until they have customers ideally.
It seems free tier vercel will go a long way (and works with tRPC)
try railway or planetscale
both have free tiers
ive heard about cockroachdb also but not tried it myself
They are all noSQL right, I'd like a SQL db if possible
all of those are sql
Oh sorry, misread planetscale 🤦♂️, thanks will look into it further, appreciate the help!
Can you run side projects on free tier vercel?
im not a lawyer
in terms of usage amounts, definitely
Ok cool will bear in mind, thanks again!
Have you used with cloudflare at all? I know it supports next https://developers.cloudflare.com/pages/framework-guides/deploy-a-nextjs-site/
Deploy a Next.js site · Cloudflare Pages docs
Documentation for Cloudflare Pages, the best way to deploy your static and JAMstack sites
I run a few frontends on it currently, but unsure about the server side
I run my backends on digital ocean atm
cloudflare workers is similar to vercel
From my understanding, you need to be able to run on edge runtime https://nextjs.org/docs/api-reference/edge-runtime
But I don't think the server in t3-app uses edge API
I could be mistaken though
Looking into it further, I think if I want to use a node based serverless environment, I must configure with cloudflare which looks a bit more involved https://developers.cloudflare.com/pages/tutorials/build-an-api-with-workers/ ?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Ah right, so this is supported then, fantastic :), I wasn't sure if the t3-app uses edge compatible "web API"
U can't use Prisma on the edge though
https://www.nexxel.dev/blog/typesafe-database if u want to run your stuff on vercels edge runtime
Shoubhit Dash
Typesafe Database Queries on the Edge
Edge computing is all the rage. Learn how to get typesafe access to data on the edge using Kysely, Prisma and PlanetScale.
are there alternatives to prisma that are optimised for serverless? i never knew prisma had such limitations
Read the article I posted above
Solid usecase there, Prisma is used for everything but the querying