Getting Started

Setup your first JEC API project in minutes with our modern, class-based FastAPI wrapper.

Installation

Install the package using your preferred package manager.

pip install jec-api

Quick Start

Create a minimal application by initializing the Core class and registering a simple route.

main.py
from jec_api import Core, Route

# 1. Define your route
class Hello(Route):
    async def get(self):
        return {"message": "Hello from JEC!"}

# 2. Initialize the app
app = Core(
    title="My First JEC App",
    description="A simple API using JEC Framework"
)

# 3. Register routes
app.register(Hello)

# 4. Run the server
if __name__ == "__main__":
    app.run()

Note: By default, the route path is derived from the class name.Hello becomes /hello. You can override this by setting the path attribute on the class.

Project Structure

We recommend the following structure for larger applications:

my_project/
├── main.py              # Application entry point
├── routes/              # Route definitions
│   ├── __init__.py
│   ├── users.py
│   └── items.py
└── requirements.txt