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.2.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.2-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fracode-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 fa52eef03c660530eb61c7d281b20af01ae3849093f3856f37311909f817d5ae
MD5 4ea19e098e8a355b333c38f9abdd018e
BLAKE2b-256 7c0f8134b16e390e62061d2a38333c2d3fd1b9194cf3c60f04b1262a6f6bdf5a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fracode-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7fd6fe1d40a7936241df6c087948562228d03c5f5a6e6d12fc6649cfb6dd9fb4
MD5 13dd0d8886a170c46d54950ddb9f0ed1
BLAKE2b-256 fc3a3ebb6fb0cd69bbe7d8697e721466348392f4071912d7e7db9c0aaf549504

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