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
needmorewood
needmorewood3y ago
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
cje
cje3y ago
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.
Yoers
YoersOP3y ago
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)
cje
cje3y ago
try railway or planetscale both have free tiers ive heard about cockroachdb also but not tried it myself
Yoers
YoersOP3y ago
They are all noSQL right, I'd like a SQL db if possible
cje
cje3y ago
all of those are sql
Yoers
YoersOP3y ago
Oh sorry, misread planetscale 🤦‍♂️, thanks will look into it further, appreciate the help! Can you run side projects on free tier vercel?
cje
cje3y ago
im not a lawyer in terms of usage amounts, definitely
Yoers
YoersOP3y ago
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
Yoers
YoersOP3y ago
I run a few frontends on it currently, but unsure about the server side I run my backends on digital ocean atm
cje
cje3y ago
cloudflare workers is similar to vercel
Yoers
YoersOP3y ago
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
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Yoers
YoersOP3y ago
Ah right, so this is supported then, fantastic :), I wasn't sure if the t3-app uses edge compatible "web API"
needmorewood
needmorewood3y ago
U can't use Prisma on the edge though
needmorewood
needmorewood3y ago
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.
Blitz
Blitz3y ago
are there alternatives to prisma that are optimised for serverless? i never knew prisma had such limitations
needmorewood
needmorewood3y ago
Read the article I posted above Solid usecase there, Prisma is used for everything but the querying
Want results from more Discord servers?
Add your server