Vercel is known for Next.js, but it runs plain Node.js APIs too, as serverless functions. For small APIs, bots and internal tools, it’s one of the quickest ways to get from code on your laptop to a live HTTPS URL. Here’s how to deploy Node.js on Vercel, plus the limits you should know before you build a business on the free plan.
1. Structure the project
Without a framework, every file in the api folder becomes an endpoint. A file at api/hello.js is served at /api/hello:
// api/hello.js
export default function handler(req, res) {
res.json({ ok: true, time: new Date().toISOString() });
}
Add a package.json with your dependencies. Vercel installs them during the build.
2. Connect GitHub
- Push your code to a GitHub repository.
- In Vercel, choose Add New → Project and import the repo.
- Leave the framework preset as “Other” for a plain Node API, then click Deploy.
From then on, every push to main goes to production and every other branch gets its own preview URL. That preview URL is great for showing a client a change before it goes live.
3. Environment variables
Put API keys, database URLs and secrets in Settings → Environment Variables and read them with process.env.NAME. Redeploy after you change them. Never commit a .env file; if you have, rotate those keys today. Our Express API security checklist covers this and nine other pre-launch checks.
4. Add a database
Serverless functions don’t keep files between requests, so store data in a hosted database. Postgres providers such as Neon or Supabase have free tiers and give you a connection string for DATABASE_URL. Use the pooled connection string: lots of short-lived functions open lots of connections, and a pooler stops you hitting the limit.
5. Scheduled jobs with Vercel Cron
Vercel Cron calls one of your endpoints on a schedule you define in vercel.json:
{
"crons": [{ "path": "/api/daily-report", "schedule": "0 5 * * *" }]
}
Schedules are in UTC, so 05:00 UTC is 08:00 in Nairobi and Mogadishu. Protect the endpoint with a secret so only Vercel can trigger it.
Problems you’ll probably hit
- Function timeouts. Long jobs need to be split into smaller steps or moved to a queue.
- Too many database connections. Use the pooled URL and create one client per function instance.
- “Deployment blocked”. On the Hobby plan, commits must come from the Git identity linked to the Vercel account owner. Check the commit author email.
When the free plan isn’t enough
Vercel’s Hobby plan is for personal, non-commercial use. A site that sells products, takes payments or shows ads (including Google AdSense) counts as commercial and needs the Pro plan or another host. Read Vercel’s fair use guidelines before you launch.
If your client already pays for shared hosting, there’s another option: deploying a Node.js app on cPanel.




