Skip to content

ensaremirerol/nextjs-fastapi-starter

Repository files navigation

NextJs - FastAPI starter template

This is a starter template for a NextJs frontend with a FastAPI backend.

How to use

You can develop the frontend and backend separately.

To call the backend from the frontend, just prefix the endpoint with /api.

const res = await fetch('/api/hello')

Development

Development requirements

  • NodeJS

  • Python

How to run

  • Frontend

On the root folder:

First Time

npm install

Run

npm run dev
  • Backend

In the backend folder:

First Time

pip install -r requirements.txt

Run

uvicorn main:app --reload

On development, because of the CORS, you need to run browser with security disabled.

(VSCode configuration is already set to run Chrome with security disabled)

Deployment

Deploy requirements

  • Docker

How to deploy

docker-compose up

It will run on port 8080.

About

Starter template for NextJs with FastAPI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published