Is Next.js enough to not use any backend framework ?
Unanswered
Crested Myna posted this in #help-forum
Crested MynaOP
Hey Everyone, I'm planning to create a project. What backend can I use? If my frontend is next.js. Do I need to use a backend framework like node.js, express.js, django, fast-api, flask. should I use the features of next.js for server-side rendering ?
11 Replies
most probably yes assuming it's a small project that a few devs get involved in, deploying on Vercel hobby or pro plan.
in case of hosting on GCP, AWS kubernetes, you could have python, go, rust micro services as upstream servers to implement machine learning, batch processing, pub-sub and so on.
in case of hosting on GCP, AWS kubernetes, you could have python, go, rust micro services as upstream servers to implement machine learning, batch processing, pub-sub and so on.
btw, node.js is runtime, where you can run Next.js, Express and so on.
Pug
@tafutada777 could you elaborate on this answer - like, imagine you had a backend service written in Rust what is an appropriate way to use it as an upstream?
would you just implement your own api route that calls your internal Rust api?
would you just implement your own api route that calls your internal Rust api?
in my case, i wrote vector search engines in Rust, so Next.js, server side components, invoke the Rust API to get similar contents. all of them are hosted in GCP k8s.
i also wrote recommend engines in python TensorFlow as well.
Munchkin
The cons of using NextJS as your backend? That they are serverless functions. That's it.
technically, when it comes to Vercel platform, aside from Serverless AWS lambda, there is another option named Edge Runtime, which is based on V8 isolate on Cloudflare worker.
Vercel AI SDK on Edge Runtime is quite interesting.
Munchkin
Yeah but I don't think it's meant for running an API.
you might want to check Vercel AI sdk, which leverages API on Edge Runtime and streaming to connect to OpenAI API, HuggingFace and LangChain. it’s scary good.