Skip to main content

web-app Template

A fullstack template combining Next.js frontend with FastAPI backend for building interactive applications, dashboards, and SaaS products.

Quick Start

Visit http://localhost:3000 for the frontend and http://localhost:8080/docs for the API docs.

Specifications

This template requires at least standard tier because it runs both Node.js and Python simultaneously. The starter tier (256MB) is insufficient.

Project Structure

Frontend

API Client

React Components

Backend

The backend follows the same structure as backend-service:

Database

Enable SQLite persistence:

Shared Types

Keep frontend and backend types in sync:

Authentication

Enable Better Auth integration:

Generate Secret

Protected Routes

Auth Hooks

Local Development

This starts:
  • Frontend at http://localhost:3000
  • Backend at http://localhost:8080
The frontend proxies /api/* requests to the backend.

Deployment

The Dockerfile builds both applications:

Use Cases

Dashboard

Analytics dashboards with real-time data

SaaS App

Multi-tenant applications with auth

Admin Panel

Internal tools and admin interfaces

Portal

Customer portals with account management

Best Practices

When you change a backend model, update the frontend types too.
Fetch data in Server Components when possible for better performance.
Frontend handles UI, backend handles data and business logic.
Write tests for both frontend components and backend APIs.

Environment Variables

Set locally: