Skip to main content

Async-first Python framework built on FastAPI with integrated templating, ORM, admin, and CLI

Project description

๐Ÿš€ FastStack

Async-first Python framework built on FastAPI with integrated templating, ORM, admin, and CLI.

FastStack combines the developer experience of Django with the performance and modern features of FastAPI. It provides everything you need to build production-ready web applications quickly.

โœจ Features

  • ๐Ÿš€ FastAPI Powered - Modern, fast, async web framework with automatic OpenAPI docs
  • ๐Ÿ“Š SQLModel ORM - Type-safe database models built on SQLAlchemy and Pydantic
  • ๐Ÿ” Built-in Auth - Secure authentication with password hashing and session management
  • ๐ŸŽ›๏ธ Admin Panel - Auto-generated admin interface for your models (like Django admin)
  • ๐Ÿ“ Modular Apps - Organize code into reusable app modules
  • ๐Ÿ”Œ Auto-discovery - Automatic loading of routes, models, and admin configurations
  • ๐Ÿ“ Jinja2 Templates - Server-side rendering with template inheritance
  • โšก HTMX Ready - Build dynamic UIs without complex JavaScript
  • ๐ŸŽจ Tailwind CSS - Beautiful, responsive designs out of the box
  • ๐Ÿงฉ FastUI Integration - Optional bundled frontend (Alpine.js, ECharts, Flowbite)
  • ๐Ÿ› ๏ธ Powerful CLI - Create projects, apps, run migrations with ease

๐Ÿ“ฆ Installation

Using uv (recommended)

# Install uv if you haven't
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install FastStack
uv tool install faststack-framework

# Create a new project
faststack startproject myproject
cd myproject
uv sync
uv run faststack runserver

Using pip

pip install faststack-framework
faststack startproject myproject
cd myproject
pip install -e .
faststack runserver

Using pipx

pipx install faststack-framework
faststack startproject myproject

๐Ÿƒ Quick Start

# 1. Create a new project
faststack startproject myproject

# 2. Navigate to the project
cd myproject

# 3. Install dependencies
uv sync

# 4. Start the development server
uv run faststack runserver

# 5. Open http://localhost:8000

๐Ÿ“ Project Structure

myproject/
โ”œโ”€โ”€ apps/                   # Application modules
โ”‚   โ””โ”€โ”€ example/           # Example app
โ”‚       โ”œโ”€โ”€ models.py      # Database models
โ”‚       โ”œโ”€โ”€ routes.py      # Web routes
โ”‚       โ”œโ”€โ”€ schemas.py     # Pydantic schemas
โ”‚       โ”œโ”€โ”€ services.py    # Business logic
โ”‚       โ””โ”€โ”€ admin.py       # Admin configuration
โ”œโ”€โ”€ templates/             # Jinja2 templates
โ”‚   โ”œโ”€โ”€ base.html
โ”‚   โ”œโ”€โ”€ pages/
โ”‚   โ””โ”€โ”€ components/
โ”œโ”€โ”€ static/                # Static files
โ”‚   โ”œโ”€โ”€ css/
โ”‚   โ”œโ”€โ”€ js/
โ”‚   โ””โ”€โ”€ img/
โ”œโ”€โ”€ migrations/            # Alembic migrations
โ”œโ”€โ”€ main.py               # Application entry point
โ”œโ”€โ”€ manage.py             # Management script
โ”œโ”€โ”€ pyproject.toml        # Project configuration
โ””โ”€โ”€ .env                  # Environment variables

๐Ÿ› ๏ธ CLI Commands

# Create a new project
faststack startproject myproject

# Create a new app
faststack startapp blog

# Run development server
faststack runserver

# Create database migrations
faststack makemigrations -m "Add blog model"

# Apply migrations
faststack migrate

# Create admin user
faststack createsuperuser

# Open interactive shell
faststack shell

# Show version
faststack version

๐Ÿ“ Creating an App

# Create a new app
faststack startapp blog

This creates a new app with:

# apps/blog/models.py
from sqlmodel import Field
from faststack.orm.base import TimestampedModel

class Post(TimestampedModel, table=True):
    title: str = Field(index=True)
    content: str
    published: bool = Field(default=False)
# apps/blog/routes.py
from fastapi import APIRouter, Request
from faststack.app import get_templates

router = APIRouter(prefix="/blog", tags=["blog"])

@router.get("/")
async def blog_list(request: Request):
    templates = get_templates()
    return templates.TemplateResponse("blog/list.html", {"request": request})
# apps/blog/admin.py
from faststack.admin import register_model
from apps.blog.models import Post

register_model(
    Post,
    list_display=["id", "title", "published", "created_at"],
    search_fields=["title", "content"],
    list_filter=["published"],
    icon="newspaper",
)

๐Ÿ” Authentication

FastStack comes with built-in authentication:

from fastapi import Depends
from faststack.core.dependencies import CurrentUser, AdminUser
from faststack.auth.models import User

# Require authentication
@router.get("/profile")
async def profile(user: CurrentUser):
    return {"email": user.email}

# Require admin access
@router.get("/admin/settings")
async def admin_settings(user: AdminUser):
    return {"message": "Admin only"}

๐ŸŽจ Templates

FastStack uses Jinja2 templates with Tailwind CSS:

<!-- templates/blog/list.html -->
{% extends "base.html" %}

{% block title %}Blog Posts{% endblock %}

{% block content %}
<div class="container mx-auto py-8">
    <h1 class="text-3xl font-bold mb-6">Blog Posts</h1>

    <div class="space-y-4">
        {% for post in posts %}
        <div class="bg-white rounded-lg shadow p-6">
            <h2 class="text-xl font-semibold">{{ post.title }}</h2>
            <p class="text-gray-600 mt-2">{{ post.content|truncate(200) }}</p>
            <a href="/blog/{{ post.id }}" class="text-indigo-600 hover:underline mt-4 inline-block">
                Read more โ†’
            </a>
        </div>
        {% endfor %}
    </div>
</div>
{% endblock %}

โšก HTMX Integration

Build dynamic UIs with HTMX:

<!-- Delete with confirmation -->
<button hx-delete="/api/posts/{{ post.id }}"
        hx-confirm="Are you sure?"
        hx-target="closest .post-card"
        hx-swap="outerHTML">
    Delete
</button>

<!-- Load content dynamically -->
<div hx-get="/api/posts/recent"
     hx-trigger="load"
     hx-swap="innerHTML">
    Loading...
</div>

๐Ÿ“Š Admin Panel

Access the auto-generated admin panel at /admin/:

  1. Create a superuser: faststack createsuperuser
  2. Login at /auth/login
  3. Manage your models at /admin/

๐Ÿ”ง Configuration

Environment variables in .env:

# Application
APP_NAME=My App
APP_ENV=development
DEBUG=true
SECRET_KEY=your-secret-key

# Database
DATABASE_URL=sqlite:///./app.db
# DATABASE_URL=postgresql://user:pass@localhost/db

# Server
HOST=127.0.0.1
PORT=8000

# Frontend (see below)
FRONTEND_MODE=fastui

๐ŸŽจ Frontend Configuration

FastStack supports two frontend modes:

FastUI Mode (Default)

Single CDN bundle with everything included:

FRONTEND_MODE=fastui

Includes:

  • Tailwind CSS - Utility-first CSS
  • HTMX 2.0 - AJAX without JavaScript
  • Alpine.js 3.x - Lightweight reactivity
  • ECharts 6.x - Beautiful charts
  • Flowbite 4.x - UI components

Custom Alpine.js Directives:

  • x-chart - Declarative ECharts integration
  • x-lazy - Lazy loading with IntersectionObserver
  • x-flow - Flowbite component helpers
<!-- Chart example -->
<div x-chart='{
    "title": { "text": "Sales Data" },
    "xAxis": { "type": "category", "data": ["Mon", "Tue", "Wed"] },
    "yAxis": { "type": "value" },
    "series": [{ "type": "bar", "data": [120, 200, 150] }]
}' style="height: 300px;"></div>

Default Mode (Individual Libraries)

Load libraries separately for more control:

FRONTEND_MODE=default

Configure individual CDNs:

HTMX_CDN_URL=https://cdn.jsdelivr.net/npm/htmx.org@2.0.8/dist/htmx.min.js
ALPINE_CDN_URL=https://cdn.jsdelivr.net/npm/alpinejs@3.15.8/dist/cdn.min.js
ECHARTS_CDN_URL=https://cdn.jsdelivr.net/npm/echarts@6.0.0/dist/echarts.min.js
TAILWIND_CDN_URL=https://cdn.tailwindcss.com

Feature toggles:

FRONTEND_ENABLE_ECHARTS=true
FRONTEND_ENABLE_FLOWBITE=true

Template Access

Access frontend settings in any template:

<div class="badge {% if frontend.mode == 'fastui' %}bg-indigo-100{% else %}bg-green-100{% endif %}">
    {{ frontend.mode|upper }} Mode
</div>

{% if frontend.mode == 'fastui' %}
    <div x-chart='{ ... }'></div>
{% else %}
    <div id="chart"></div>
    <script>echarts.init(document.getElementById('chart')).setOption({...});</script>
{% endif %}

๐Ÿงช Testing

# Run tests
pytest

# Run with coverage
pytest --cov=faststack

๐Ÿ“š Documentation

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“„ License

MIT License - see LICENSE for details.


Built with โค๏ธ by the FastStack Team

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

faststack_frame-0.1.0.tar.gz (276.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

faststack_frame-0.1.0-py3-none-any.whl (329.9 kB view details)

Uploaded Python 3

File details

Details for the file faststack_frame-0.1.0.tar.gz.

File metadata

  • Download URL: faststack_frame-0.1.0.tar.gz
  • Upload date:
  • Size: 276.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for faststack_frame-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d0a0436d72f885f908d0cc4ace63f0e7126090ae2de24cef68e118a3e870af61
MD5 97628af9fd80a2065f1a6e64de03d89d
BLAKE2b-256 f6835809d346077cc13c61469efd6488758cd60436627bb98232d79e5029e71c

See more details on using hashes here.

File details

Details for the file faststack_frame-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: faststack_frame-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 329.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for faststack_frame-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 11ede4f6de904f87ef851521c315de4e3640749e0fe7279748c5a344ab0f0462
MD5 592619ad991b70fe51816d371a0a4212
BLAKE2b-256 099ddea0e7a98d09d0cd863bcba485b08adc1c36be8310fa21151c0b6d97b024

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page