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 Controllers — The official meaning — class-based API organization
- Jolly Enough Curses — For when debugging at 3am feels magical
- Jupiter Eats Comets — Because 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:
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
Class-Based Routes
Group related endpoints together in controller classes. Methods automatically map to HTTP verbs.
Decorator System
Use @log for automatic logging, @speed for performance monitoring, and @version for API versioning.
Dev Console
Built-in real-time debugging console accessible at /__dev__ to monitor requests, logs, and performance.
FastAPI Powered
Full compatibility with FastAPI features including async/await, dependency injection, and OpenAPI.