- React frontend powered by Vite & Mantine component library
- FastAPI backend with Docker support
- Supabase Postgres database & optional authentication
git clone https://github.com/<your-github-org>/vite-fastapi-template.git
cd vite-fastapi-template-
Install dependencies
cd server pip install -r requirements.txt -
Configure
.env:cp .env.example .env
PROJECT_NAME: container namePORT: port for the serverSUPABASE_URLandSUPABASE_KEY: Supabase project credentialsDATABASE_URLandDATABASE_KEY: Credentials for Postgres database
-
Initialize the database, creating a super user, initializing tables, and data:
make init_db
-
Build and run the Docker container:
make build make run # QoL make make # Runs build + run make rebuild # Runs stop + build + run if a container is already running
-
Stop or clean up:
make stop # stops the running container make clean # removes the image
- Install Alembic (if not already installed):
pip install alembic
- Create a new migration script:
alembic revision --autogenerate -m "Initial migration" - Apply migrations:
Read more about how to use Alembic here.
alembic upgrade head
-
Install dependencies
cd frontend npm install -
Copy and configure
.envcp .env.example .env
VITE_API_URL: backend URL (e.g.http://localhost:8181)VITE_SUPABASE_URLandVITE_SUPABASE_KEY: your Supabase credentials
-
Start the dev server:
npm run dev
Optional command lines that might make dev experience a bit smoother.
Usage:
make <target> # At the respective root
make -C /full/path/to/project <target> # From anywhere else| Target | Description |
|---|---|
run |
Launch Vite dev server (npm run dev) |
| Target | Description |
|---|---|
build |
Build the Docker image (docker build -t $(IMAGE_NAME) .) |
run |
Run the container (docker run --rm --name $(CONTAINER_NAME) -p $(PORT):$(PORT) $(IMAGE_NAME)) |
stop |
Stop the running container (docker stop $(CONTAINER_NAME)) |
clean |
Stop container and remove image (make stop && docker rmi $(IMAGE_NAME)) |
make |
Alias for build + run |
rebuild |
Stop, build, and run again |
init_db |
Initialize database and seed initial data (python -m app.db.init_db) |
Backend builds upon AtticusZeller's FastAPI template.