Skip to content
New Project

Next.js + FastAPI Starter

A monorepo with a Next.js frontend and a public FastAPI backend.

DeployView Demo

Next.js + FastAPI

This example shows a monorepo using Vercel Services with a Next.js frontend and a public FastAPI backend.

Demo

https://nextjs-fastapi-services.vercel.app/

How it works

The project is structured as a monorepo:

nextjs-fastapi/
├── backend/
├── frontend/
└── vercel.json

Services are configured in vercel.json:

{
"services": {
"frontend": { "root": "frontend/", "framework": "nextjs" },
"backend": { "root": "backend/", "entrypoint": "main:app" }
},
"rewrites": [
{
"source": "/svc/api/:path*",
"destination": { "service": "backend" }
},
{
"source": "/(.*)",
"destination": { "service": "frontend" }
}
]
}

Vercel will route requests to the backend service for URL with paths starting with /svc/api/ and to frontend for all other URLs.

Running Locally

vercel dev

Open http://localhost:3000 and try:

  • /api/hello (Next.js API route)
  • /svc/api/status (FastAPI route)

Learn More

  • Vercel Services - learn how services work on Vercel.
  • Next.js Documentation - learn about Next.js features and API.
  • FastAPI Documentation - learn about FastAPI features and API.
GitHub
Ownervercel
Repositoryexamples
LicenseView License
Use Cases
Starter
Monorepos
Stack
FastAPI
Next.js

Related Templates

eve Content Agent

Turn your style guide into a Slack agent. Drafts blogs, social posts, release notes, and newsletters in your house voice, lint-enforced.
eve Content Agent thumbnail

eve Software Factory

Software factory built on eve: AI agents work each stage of the development loop, and people make the judgment calls.
eve Software Factory thumbnail

eve GitHub Maintainer

GitHub maintainer eve agent for your inbox. Weekly issue digests you reply to, PR summaries, Linear handoffs, and @mention answers.
eve GitHub Maintainer thumbnail
DeployView Demo