I built this API to practise receiving workflow events, storing them, and tracking their status through a small REST interface.
It uses FastAPI with SQLAlchemy and SQLite. The current event lifecycle has three statuses: queued, processed, and failed.
- Create an event with
POST /events. - List stored events with
GET /events. - Update an event status with
PATCH /events/{event_id}. - Store event records in a local SQLite database.
- Serve a browser interface at
/ui. - Expose interactive API documentation through FastAPI at
/docs.
- Python
- FastAPI
- Pydantic
- SQLAlchemy
- SQLite
On Windows PowerShell:
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt
uvicorn app.main:app --reload --port 8001Open the local API documentation at http://127.0.0.1:8001/docs or the interface at http://127.0.0.1:8001/ui.
Create an event:
POST /events
Content-Type: application/json{
"source": "n8n",
"event_type": "order.created"
}Update its status:
PATCH /events/1
Content-Type: application/json{
"status": "processed"
}The available status values are queued, processed, and failed.
The API routes and SQLite persistence are present in the source. This README does not claim that the application has passed tests or been deployed; those checks still need to be run and recorded.
- Add automated tests for event creation, listing, and status updates.
- Add validation for allowed status transitions.
- Add retry handling and a dead-letter strategy for failed events.
- Add authentication before exposing the API outside a local environment.
Afzal Hussain · @Afzu01