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/:
- Create a superuser:
faststack createsuperuser - Login at
/auth/login - 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 integrationx-lazy- Lazy loading with IntersectionObserverx-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
- FastStack Documentation
- FastUI Documentation
- FastAPI Documentation
- SQLModel Documentation
- Tailwind CSS
- HTMX
- Alpine.js
- ECharts
๐ค 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0a0436d72f885f908d0cc4ace63f0e7126090ae2de24cef68e118a3e870af61
|
|
| MD5 |
97628af9fd80a2065f1a6e64de03d89d
|
|
| BLAKE2b-256 |
f6835809d346077cc13c61469efd6488758cd60436627bb98232d79e5029e71c
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11ede4f6de904f87ef851521c315de4e3640749e0fe7279748c5a344ab0f0462
|
|
| MD5 |
592619ad991b70fe51816d371a0a4212
|
|
| BLAKE2b-256 |
099ddea0e7a98d09d0cd863bcba485b08adc1c36be8310fa21151c0b6d97b024
|