Production-ready FastAPI skeleton: multi-tenant, JWT auth, async task queue, and plugin-based task execution. Others can build full FastAPI applications on top of this skeleton.
- Clone or copy this repository.
- Copy
.env.exampleto.env, and at minimum updateSECRET_KEY,DB_*,REDIS_*(if using task queue), andAPP_NAME. - Install dependencies:
poetry install(orpip install -e .). - Start MySQL and Redis (e.g. with Docker:
docker-compose up -d mysql redis). - Run migrations:
alembic upgrade head. - Start the app:
uvicorn main:app --reloadorpython main.py. - Open
http://localhost:8000/docsto view API documentation.
All configuration is overridden via environment variables or .env; defaults are in framework/config.py.
- Required:
SECRET_KEY,DB_*,APP_NAME(for production). - Optional:
API_V1_AUTH_PREFIX,API_V1_TASKS_PREFIX,TASK_QUEUE_STREAM_NAME,TASK_QUEUE_CONSUMER_GROUP, etc.
See docs/01_CONFIGURATION.md for details.
- New business app: Create a subpackage under
apps/(e.g.apps/my_app) withmodels.py,api/router.py, etc.; mount the router inmain.pyviainclude_router; import the new app's models inapps/models.pyso Alembic migrations include the new tables. - New task plugin: Implement
TaskPluginunderapps/tasks/plugins/(seebase.py), and register it intask_registryinplugins/__init__.py. Example pluginseq_toolcan be removed or replaced.
- Docker: Use the root
docker-compose.yml; pass config via environment or.env; container/network names can be renamed per project. - Systemd: Copy
fastapi-app.serviceandfastapi-worker.service, replace placeholders such asWorkingDirectory,User, andSyslogIdentifierwith your project path and name, then install into systemd.
See the "Private project configuration guide" in docs/01_CONFIGURATION.md.