Stack & Architecture

FastSaaS is a production-ready SaaS template built with FastAPI (backend) and React (frontend). It provides a complete foundation for building multi-tenant SaaS applications with subscription billing,

Tools

Backend:

  • FastAPI - High-performance Python web framework

  • SQLAlchemy - ORM with Pydantic for validation

  • PostgreSQL - Production database

  • Alembic - Database migrations

  • JWT - Token-based authentication

Frontend:

  • React with TypeScript - Type-safe UI development

  • Vite - Fast build tool

  • Tailwind CSS - Utility-first styling

  • React Router - Client-side routing

Infrastructure:

  • Docker & Docker Compose - Containerized development

  • Stripe - Payment processing and subscription management

  • Resend - Transactional emails (optional)

  • Sentry - Error tracking and monitoring (optional)

Architecture Overview

Backend Architecture

The backend follows a feature-based modular architecture:

Frontend Architecture

The frontend uses feature-based organization:

Design Patterns

Multi-tenancy:

  • Each user can belong to multiple tenants

  • Data is scoped by tenant UUID

  • Role-based access control (Admin, Member)

Authentication:

  • JWT-based authentication with access and refresh tokens

  • Access tokens expire in 30 minutes

  • Refresh tokens expire in 30 days

  • Support for email/password and Google OAuth

External Data:

  • Invoices are fetched directly from Stripe API (not stored locally)

  • Subscriptions and payment methods are synced via webhooks

Dependency Injection:

  • FastAPI dependencies for authentication (get_current_user)

  • Tenant context extraction (get_current_tenant)

  • Admin checks (require_admin, require_super_admin)

Last updated