Core Application

The Core class is the heart of JEC, extending FastAPI with enhanced discovery and configuration capabilities.

Initialization

Core inherits directly from FastAPI, so it accepts all standard FastAPI arguments.

main.py
from jec_api import Core

app = Core(
    title="Production API",
    version="1.0.0",
    docs_url="/api/docs",
    redoc_url=None
)

Configuration

Configure your application settings, developer tools, and underlying server options.

Route Registration

JEC offers two ways to register routes: manual registration and auto-discovery.

Manual Registration

from routes.users import UserRoute

app.register(UserRoute, tags=["Users"])

Auto Discovery

Automatically find and register all Route subclasses in a package.

# Discover all routes in the "routes" package
app.discover("routes", recursive=True)

Running the App

Use the run() method to start the server with your configured settings.

if __name__ == "__main__":
    app.run()