← Back to all products

SaaS Boilerplate

$29

SaaS Boilerplate with user management, RBAC, settings, and multi-tenancy in pure Python.

📁 10 files
PythonMarkdown

📄 Product Preview

Try the interactive reader and demo tools below, or get the full product with all content unlocked.

📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample

📁 File Structure 10 files

saas-boilerplate/ ├── LICENSE ├── README.md ├── examples/ │ └── basic_example.py ├── free-sample.zip ├── guide/ │ ├── 01_features.md │ ├── 02_quick-start.md │ ├── 03_configuration.md │ └── 04_license.md ├── index.html └── src/ └── main.py

📖 Documentation Preview README excerpt

SaaS Boilerplate

A complete Python SaaS application boilerplate with user management, role-based access control, settings, and multi-tenancy scaffolding. Your starting point for any SaaS product.

Features

  • User management — Registration, authentication, password hashing (PBKDF2-HMAC-SHA256)
  • Role-based access control — Admin, member, and viewer roles with permission checks
  • Multi-tenant scaffolding — Tenant context, per-tenant data isolation
  • Application settings — JSON-persisted settings with defaults and validation
  • Session management — Token-based sessions with expiration and rotation
  • Audit logging — Structured log of all user and system operations
  • HTTP server — Built-in routing with middleware pipeline
  • Configuration — Environment variables or JSON config file

Requirements

  • Python 3.10+
  • No external dependencies (stdlib only)

Quick Start


# Start the server with demo data
python src/main.py --init-demo

# Start on a custom port
python src/main.py --port 9000

# Start clean (no demo data)
python src/main.py

Then open http://localhost:8000 and try the API:


# Register a user
curl -X POST http://localhost:8000/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email": "admin@docs.example.com", "password": "changeme123", "name": "Admin"}'

# Login
curl -X POST http://localhost:8000/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "admin@docs.example.com", "password": "changeme123"}'

# List users (requires auth token from login response)
curl http://localhost:8000/api/users \
  -H "Authorization: Bearer <token>"

API Endpoints

MethodPathDescription
POST/api/auth/registerRegister a new user
POST/api/auth/loginLogin and receive session token
POST/api/auth/logoutInvalidate session
GET/api/usersList users (admin only)
GET/api/users/:idGet user details

... continues with setup instructions, usage examples, and more.

📄 Code Sample .py preview

examples/basic_example.py#!/usr/bin/env python3 """ SaaS Boilerplate — Basic Usage Example ======================================== Demonstrates how to use the SaaS Boilerplate programmatically: - Creating users and tenants directly via the DataStore - Password hashing and verification - Session management - Audit log inspection Run: python3 basic_example.py """ from __future__ import annotations import sys from pathlib import Path # Add src directory to path so we can import the boilerplate sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "src")) from main import DataStore, User, Tenant, Session, hash_password, verify_password def main() -> None: # --- 1. Initialize the data store --- store = DataStore(data_dir=Path("/tmp/saas-boilerplate-demo")) print("=== SaaS Boilerplate — Basic Example ===\n") # --- 2. Create a user with hashed password --- pw_hash, salt = hash_password("secure-password-123") admin = User( email="admin@acme-corp.example.com", name="Alice Admin", password_hash=pw_hash, salt=salt, role="admin", ) store.users[admin.id] = admin
Buy Now — $29 Back to Products