Fast Reliable Applications in Python
Project description
FraCode - Fun Reliable Applications in Python
FraCode is an opinionated FastAPI framework for teams that want controller-style organization, a clear project structure, and a batteries-included development workflow.
Features
- A framework-level app model built around controllers and explicit route modules
- FraCode router sugar that stays compatible with native FastAPI handlers
- CLI commands for scaffolding projects, controllers, models, and database setup
- Explicit route module loading from
app/routes/__init__.py - Async SQLAlchemy support for SQLite and PostgreSQL
- Built-in DB dependency helpers, CORS support, and JSON error responses
- Built on FastAPI and ASGI under the hood
Quick Start
# Install FraCode
pip install fracode
# Create a new project
fra new my-app
cd my-app
# Run the development server
fra serve
Your app is now running at http://127.0.0.1:8000.
FraCode adds structure on top of FastAPI. FastAPI still provides the typing, validation, dependency injection, background task, and OpenAPI model underneath it.
Route loading is explicit by default:
# app/routes/__init__.py
ROUTE_MODULES = (
"app.routes.web",
"app.routes.api",
)
Visit the documentation for detailed guides and examples.
Rule of thumb: FraCode can add structure, but it should not replace FastAPI's typing and validation model.
Both of these remain first-class:
from fastapi import Depends
from pydantic import BaseModel
from fracode.http import Router
class CreateUser(BaseModel):
name: str
email: str
async def get_current_user():
return {"id": 1}
router = Router()
@router.post("/users")
async def create_user(payload: CreateUser, current_user=Depends(get_current_user)):
return {"user": payload.model_dump(), "actor": current_user}
from fastapi import Depends
from pydantic import BaseModel
from fracode.http import Controller, Router
class CreateUser(BaseModel):
name: str
email: str
async def get_current_user():
return {"id": 1}
class UserController(Controller):
async def store(
self,
payload: CreateUser,
current_user=Depends(get_current_user),
):
return self.ok({"user": payload.model_dump(), "actor": current_user})
router = Router()
router.post("/users", UserController.store)
Documentation
For detailed documentation including:
- Complete CLI reference
- Routing and controllers guide
- Database and ORM usage
- Configuration options
- Testing guide
- API documentation
Visit fracode.com
Development And Testing
FraCode uses modern Python tooling to ensure code quality:
Code Quality Tools
- Ruff - Fast Python linter and formatter
- MyPy - Static type checker
- pytest - Testing framework with async support
Run Tests
# Run all tests with coverage
pytest
# Run specific test file
pytest tests/test_routing.py -v
# Generate HTML coverage report
pytest --cov=fracode --cov-report=html
Linting & Type Checking
# Run all checks
ruff check fracode/ tests/
ruff format fracode/ tests/
mypy fracode/
# Auto-fix issues
ruff check --fix fracode/ tests/
ruff format fracode/ tests/
CI Pipeline
All PRs and commits are automatically checked for:
- Code formatting and linting
- Type checking
- Test coverage
- Package building
View the CI status and coverage reports.
Contributing
We welcome contributions! Please ensure your code passes all quality checks:
# Clone and setup
git clone https://github.com/chidiesobe/fracode.git
cd fracode
poetry install --with dev
# Run tests
pytest
# Run all quality checks
ruff check fracode/ tests/
ruff format --check fracode/ tests/
mypy fracode/
See CONTRIBUTING.md for details.
License
FraCode is open-source software licensed under the MIT license.
Acknowledgments
- Built on top of FastAPI
- Inspired by Laravel
- ORM powered by SQLAlchemy
Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: info@chidiesobe.com
Built by Chidi E.
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
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 fracode-0.1.0.tar.gz.
File metadata
- Download URL: fracode-0.1.0.tar.gz
- Upload date:
- Size: 20.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.13.7 Darwin/25.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77a35c011e4cdf716c12443fde48872cae77bf4f6178d15bd5c7c908c09fe113
|
|
| MD5 |
d7e937fd659898ad0fe8521db70b2cd2
|
|
| BLAKE2b-256 |
de3ffc2abb8d0016f8486fbf72aecd9b1909cf996461a895451f4b10f4ab268a
|
File details
Details for the file fracode-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fracode-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.13.7 Darwin/25.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46e84c432e328bb80273667a73214e542f05759740c22c476978394d129e0598
|
|
| MD5 |
0459ac76385645320f9edf2b0f81a6b0
|
|
| BLAKE2b-256 |
3a752dff5a3de6046defb16b7c4f57d05fcd230843d0ee8c6b3e5ccc0410d999
|