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.3.tar.gz (20.7 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.3-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fracode-0.1.3.tar.gz
  • Upload date:
  • Size: 20.7 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.3.tar.gz
Algorithm Hash digest
SHA256 3083abb901a9342d8c54674397e5a2dbfaa7db445b490c5deb0509930641933d
MD5 8c0814bae9557d6ca97d432caf5651eb
BLAKE2b-256 f34cb0956469d1788d4ac77a6665fc7be623da3857c068fc265beecb6da6d614

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fracode-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 27.7 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 50dbe1d0fda7c4e902782be46e7192770d0e2026d6858c0637134b0b236d75d5
MD5 7e1dbc7a37b43cbff4eee4fce7fad2c9
BLAKE2b-256 4b6610a204cfcd919064db4f55b043c9e8dbe62e3e26b95940cbcd082086908a

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