# Full-stack FastAPI Template on Render

Deploy the Full-stack FastAPI Template on Render with one click. Get a production-ready Python backend with React frontend instantly.

- Repository: https://github.com/render-examples/full-stack-fastapi-template
- Demo: https://fastapi-frontend-madq.onrender.com
- Stack: fastapi, postgresql, react, docker
- Tags: full-stack, database
- URL: https://render.com/templates/full-stack-fastapi-template-on-render

## Why deploy Full-stack FastAPI Template on Render?

A one-click deployment template that provisions a full-stack FastAPI application on Render, including a Dockerized backend, Vite/Bun frontend, and managed PostgreSQL database. It eliminates the manual setup of connecting services, environment variables, and infrastructure configuration for FastAPI projects.

This template wires together a Dockerized FastAPI backend, Vite/Bun frontend, and managed Postgres with a shared environment group that automatically injects database credentials and common config—no manual connection strings or Docker Compose orchestration required. Render's Blueprint handles service-to-service dependencies, so your backend waits for Postgres to be ready and both services pull from the same `fastapi-env` group for consistent configuration. You skip the usual yak-shaving of provisioning a database, configuring CORS between services, and setting up deployment pipelines—just fill in your secrets post-deploy and the cross-service URLs once hostnames are assigned.

## Architecture

```mermaid
flowchart LR
    classDef default fill:#1a1a2e,stroke:#a78bfa,color:#fff

    User([User])
    
    User --> fastapi-frontend[fastapi-frontend]
    User --> fastapi-backend[fastapi-backend]
    fastapi-frontend -->|API calls| fastapi-backend
    fastapi-backend -->|queries| fastapi-db[(fastapi-db)]
```

## What you can build

After deploying, you'll have a working web application with a FastAPI backend, React frontend, and Postgres database—including user authentication, an admin dashboard for managing users and items, and auto-generated API docs at /docs. You can immediately log in with your configured superuser credentials and start building on top of the existing user management and CRUD patterns.

## Key features

- *JWT Authentication*: Built-in JSON Web Token auth with secure password hashing and email-based password recovery flow.
- *SQLModel ORM Integration*: Pre-configured SQLModel with PostgreSQL for type-safe database interactions using Pydantic models.
- *Auto-generated API Client*: Frontend TypeScript client automatically generated from FastAPI's OpenAPI schema.
- *Docker Compose Stack*: Complete containerized setup with Traefik reverse proxy, Mailcatcher for email testing, and automatic HTTPS.
- *Playwright E2E Tests*: End-to-end testing configured with Playwright alongside Pytest backend tests and CI/CD via GitHub Actions.

## Use cases

- Startup founder launches MVP with auth and admin dashboard in one click
- Backend developer deploys FastAPI + Postgres API without configuring infrastructure
- Agency ships client projects using pre-built React frontend with dark mode
- Solo dev adds email password recovery to side project without building from scratch

## What's included

| Service | Type | Purpose |
|---------|------|---------|
| fastapi-backend | Web Service | Handles API requests and business logic |
| fastapi-frontend | Web Service | Handles API requests and business logic |
| unnamed | rewrite | Application service |
| fastapi-db | PostgreSQL | Primary database |

## Prerequisites

- *Admin Email*: The email address for the first superuser/admin account to log into the dashboard.
- *Admin Password*: A strong password for the first superuser/admin account (generate with `python -c "import secrets; print(secrets.token_urlsafe(32))"`).
- *SMTP Host*: The hostname of your email server for sending password recovery emails (optional).
- *SMTP Username*: The username to authenticate with your SMTP email server (optional).
- *SMTP Password*: The password to authenticate with your SMTP email server (optional).
- *From Email Address*: The email address that password recovery emails will be sent from (optional).
- *[Sentry DSN](https://sentry.io/)*: Your Sentry Data Source Name for error tracking and monitoring (optional).

## Next steps

1. Open the frontend URL and log in with your FIRST_SUPERUSER email and password — You should see the admin dashboard with a Users section and Items section
2. Navigate to the Items page and create a new item with a title and description — The item should appear in your items list immediately after saving
3. Open the backend URL with /docs appended (e.g., https://fastapi-backend-XXXX.onrender.com/docs) — You should see the interactive Swagger API documentation with all available endpoints

## Resources

- [Full Stack FastAPI Template official site](https://github.com/fastapi/full-stack-fastapi-template)
