Deploying a Next.js app with a database (Vercel + Neon)
A simple, free recipe to put a full-stack application online with its database.
Getting a full-stack app into production used to be complicated. Today, with the right tools, it's a matter of minutes and free to start.
The stack
- Next.js for the application (front + API in the same project).
- Neon as serverless PostgreSQL (free tier, hosted in the EU).
- Vercel for hosting, with automatic deploys from GitHub.
Steps
- Push the code to GitHub.
- Create the database on Neon and copy its connection string.
- In Vercel, import the repo and add the environment variables (including
DATABASE_URL). - Deploy. From here on, every
pushpublishes itself.
A detail that saves headaches
For migrations use Neon's direct connection (DIRECT_URL) and keep the pooled one for runtime. And never commit your .env: let .gitignore protect it.
This very site is built this way. The hard part is no longer the deploy; it's having something worth deploying.
#nextjs#vercel#neon#postgresql#deploy