Skip to main content

Fun Reliable Applications in Python

Project description

FraCode - Fun Reliable Applications in Python

CI codecov Python Version License Ruff Type checked: mypy

FraCode is an opinionated FastAPI framework for teams that want controller-style organization, a clear project structure, and a batteries-included development workflow.

Full documentation

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 - Fun 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/iamceeso/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

Support


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

fracode-0.1.1.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

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

fracode-0.1.1-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

Details for the file fracode-0.1.1.tar.gz.

File metadata

  • Download URL: fracode-0.1.1.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

Hashes for fracode-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4b5c906acf1b96d5c6f5d9160eb48153c3c0683900631aee4388eab1428820e2
MD5 e7e88970a98b375f10f2c480873a3ae5
BLAKE2b-256 f54554de237ac874916a409a47bb6b5c1d502ec9c65494b5662587ac65948ac8

See more details on using hashes here.

File details

Details for the file fracode-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: fracode-0.1.1-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

Hashes for fracode-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4b6e3889d9ab9e220cce33b7e806012b2092df994a0403cd135b3f9f1abe3237
MD5 d88c41021b1088062d313ade7ae3a0d4
BLAKE2b-256 df8693a0a1290ff85f6a75749feaeb5f770c095009b3839891181121ed96d5f6

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