MCPcopy Index your code
hub / github.com/digitros/nextjs-fastapi

github.com/digitros/nextjs-fastapi @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
5 symbols 10 edges 7 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Next.js FastAPI Starter

Simple Next.j 14 boilerplate that uses FastAPI as the API backend.

Introduction

This is a hybrid Next.js 14 + Python template. One great use case of this is to write Next.js apps that use Python AI libraries on the backend, while still having the benefits of Next.js Route Handlers and Server Side Rendering.

How It Works

The Python/FastAPI server is mapped into to Next.js app under /api/.

This is implemented using next.config.js rewrites to map any request to /api/py/:path* to the FastAPI API, which is hosted in the /api folder.

Also, the app/api routes are available on the same domain, so you can use NextJs Route Handlers and make requests to /api/....

On localhost, the rewrite will be made to the 127.0.0.1:8000 port, which is where the FastAPI server is running.

In production, the FastAPI server is hosted as Python serverless functions on Vercel.

Demo

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

Deploy Your Own

You can clone & deploy it to Vercel with one click:

Deploy with Vercel

Developing Locally

You can clone & create this repo with the following command

npx create-next-app nextjs-fastapi --example "https://github.com/digitros/nextjs-fastapi"

Getting Started

First, create and activate a virtual environment:

python3 -m venv venv
source venv/bin/activate

Then, install the dependencies:

npm install
# or
yarn
# or
pnpm install

Then, run the development server(python dependencies will be installed automatically here):

npm run dev
# or
yarn dev
# or
pnpm dev

Open http://localhost:3000 with your browser to see the result.

The FastApi server will be running on http://127.0.0.1:8000 – feel free to change the port in package.json (you'll also need to update it in next.config.js).

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Core symbols most depended-on inside this repo

Home
called by 0
app/page.tsx
RootLayout
called by 0
app/layout.tsx
GET
called by 0
app/api/helloNextJs/route.ts
hello_fast_api
called by 0
api/index.py

Shape

Function 4
Route 1

Languages

TypeScript60%
Python40%

Modules by API surface

api/index.py2 symbols
app/page.tsx1 symbols
app/layout.tsx1 symbols
app/api/helloNextJs/route.ts1 symbols

For agents

$ claude mcp add nextjs-fastapi \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact