Introduction

Welcome to JEC API

Just Encapsulated Controllers — the class-based system for building modern, clean, and maintainable Application Program Interfaces in Python.

What is JEC?

JEC is a lightweight framework built on top of FastAPI that brings class-based routing to your Python APIs. Instead of scattering route definitions across decorator functions, JEC lets you organize your endpoints into clean, logical controller classes.

Clean Architecture

Organize endpoints into intuitive class structures

Powerful Decorators

Add logging, speed checks, and versioning easily

Zero Config

Convention over configuration for rapid development

About the Name

JEC can stand for many things, depending on your mood:

  • Just Encapsulated ControllersThe official meaning — class-based API organization
  • Jolly Enough CursesFor when debugging at 3am feels magical
  • Jupiter Eats CometsBecause your APIs should be astronomical

Quick Example

Here's what a JEC route looks like. Notice how each HTTP method is simply a method on the class:

routes/users.py
from jec import Route
from jec.decorators import log, speed, version

class UsersRoute(Route):
    """Handles all /users endpoints."""
    
    @log
    @speed
    async def get(self):
        """GET /users - List all users"""
        return {"users": await self.db.get_users()}
    
    @log
    @version(">=1.0.0")
    async def post(self, user: UserCreate):
        """POST /users - Create a new user"""
        return await self.db.create_user(user)
    
    async def get_by_id(self, user_id: int):
        """GET /users/{user_id} - Get user by ID"""
        return await self.db.get_user(user_id)

Key Features

1

Class-Based Routes

Group related endpoints together in controller classes. Methods automatically map to HTTP verbs.

2

Decorator System

Use @log for automatic logging, @speed for performance monitoring, and @version for API versioning.

3

Dev Console

Built-in real-time debugging console accessible at /__dev__ to monitor requests, logs, and performance.

4

FastAPI Powered

Full compatibility with FastAPI features including async/await, dependency injection, and OpenAPI.

Next Steps