Directory Structure
What every directory in a scaffolded Alata project is for.
A scaffolded Alata project has a deliberate layout: your code lives in app/, the kernel in bootstrap/, configuration in config/, and everything else in a purpose-named top-level directory. This page walks through each one.
The full tree
my-app/
├── alata # console entry point — ./alata <command>
├── main.py # uvicorn entry point — main:app
├── pyproject.toml
├── .env.example
├── app/
│ ├── console/
│ │ └── kernel.py # custom CLI commands + the schedule
│ ├── events/ # event listeners
│ ├── exceptions/
│ │ └── handler.py # app-level exception handler
│ ├── http/
│ │ ├── controllers/ # request handlers
│ │ ├── dependencies.py # reusable route dependencies
│ │ └── middleware.py # custom HTTP middleware
│ ├── jobs/ # ShouldQueue job classes
│ ├── models/ # database models
│ ├── providers/ # your service providers
│ ├── services/ # domain / business logic
│ └── tasks/ # queue task definitions
├── bootstrap/
│ ├── console.py # project console startup
│ ├── application.py # builds the ONE application kernel
│ ├── app.py # exposes the FastAPI instance for ASGI servers
│ ├── broker.py # exposes the taskiq broker for workers
│ └── providers.py # ordered provider registration lists
├── config/
│ ├── settings.py # pydantic Settings — typed .env access
│ ├── database.py # connections + pool tuning
│ ├── logging.py # log channels (stack, console, file, json, sentry, ...)
│ ├── queue.py # taskiq broker + retry settings, queue names
│ ├── redis.py # named Redis connections
│ ├── cache.py # cache store + key prefix
│ ├── rate_limit.py # named rate limiters
│ ├── filesystem.py # storage disks (local, s3)
│ └── middleware.py # CORS, gzip, trusted hosts, request logging, maintenance
├── database/
│ ├── migrations/ # timestamped schema migrations
│ └── seeders/ # database seeders
├── routes/
│ └── api.py # route definitions (Router)
├── storage/
│ ├── app/ # default local storage disk
│ ├── framework/ # file cache and maintenance flag
│ └── logs/ # daily-rotated application logs
└── tests/
└── test_api.py # starter test hitting the welcome routeThe root files
alata
The project console. Use ./alata setup, ./alata test, ./alata lint, and ./alata format for development, and ./alata serve, ./alata migrate, ./alata queue:work, and other framework commands to run your application. Run ./alata list to see the full command set, including commands your providers add.
Run the console from your activated Python environment or use uv run ./alata <command>. See running commands.
main.py
A thin uvicorn entry point that imports the FastAPI app from bootstrap/app.py. python main.py starts a reloading dev server; deployment tools can target main:app or bootstrap.app:app interchangeably.
app/ — your application
Everything you write lives here.
app/console/kernel.py— yourAppKernelsubclass of the console kernel. Register custom CLI commands inregister_user_commands()and define the scheduled tasks inschedule(). The template already schedulesqueue:prune-orphanshourly.app/events/— event listeners for the event system.app/exceptions/handler.py— yourHandlersubclass of the framework's exception handler. Configuredont_report(exceptions that should not be logged) and register customrenderable/reportablecallbacks. See error handling.app/http/— controllers, route dependencies, and middleware. The template ships aWelcomeController, anIdentityMiddlewarethat resolves the acting user fromX-User-Id/X-Guest-Idheaders, andrequire_authenticated/get_user_iddependencies. These are identity examples; add credential verification for authenticated routes.app/models/— your database models.app/jobs/— queued job classes../alata make:jobgenerates aShouldQueueclass here; workers discover jobs recursively.app/providers/— your service providers../alata make:providerscaffolds one here and registers it for you. A*_provider.pyfile that exists here but is not declared inbootstrap/providers.pytriggers a startup warning — providers are never auto-loaded.app/services/— plain Python domain logic, typically bound into the container by a provider.app/tasks/— decorated queue functions. Workers discover modules recursively, with any filename.
bootstrap/ — the kernel
This directory defines the kernel used by HTTP, console, and worker processes. Each process creates its own application and service instances.
application.py— constructsApplication(base_path=..., providers=[...]). This is the one place the kernel is built; the console script, the ASGI entry point, and the worker broker all import it.app.py— exposesapp = kernel.fastapiso ASGI servers (uvicorn bootstrap.app:app) serve the same kernel.console.py— starts the project console, including first-time setup and development commands.broker.py— imports the application (booting it fully) and exposesbroker = app.make("queue.broker")for the taskiq worker CLI. Workers therefore start with initialized database engines and every other registered service — no worker-specific boot code.providers.py— the explicitly ordered provider lists:FRAMEWORK_PROVIDERS(Redis, events, queue, cache, rate limiting, health, storage, console),PROVIDERS(yours), andAPP_KERNEL_PROVIDERS(providers wired directly intoapplication.py).
config/ — configuration modules
Plain Python modules, one per concern, loaded into the config repository during boot Phase 0. config/settings.py is the typed source of truth for environment variables; the other modules build declarative dicts from it. Covered in depth on the configuration page.
database/
database/migrations/ holds timestamped migration files (2025_01_01_000000_create_users_table.py). Generate new ones with ./alata make:migration and run them with the ./alata migrate family. The template ships six migrations: users, job batches, failed jobs, cache and cache locks, queued jobs, and job results. database/seeders/ contains the starter DatabaseSeeder.
routes/
Route definitions, separated from controller logic. routes/api.py builds an Alata Router (the template uses an /api/v1 prefix) and the HTTP provider includes it during boot. See routing.
storage/
Everything the application persists locally:
storage/app/— your files: the default local filesystem disk writes here.storage/framework/— framework-owned artifacts: the file cache store (storage/framework/cache/data) and the maintenance-mode flag (storage/framework/down, managed by./alata down/./alata up).storage/logs/— thefilelog channel writes daily-rotated files here (for example,app-2026-10-06.log).
Runtime contents are gitignored; the directory skeleton ships via .gitkeep files.
tests/
Your test suite. The starter test_api.py boots the app through the ASGI entry point with a test client and asserts on the welcome route — a working template for your own tests.
Resolving project paths
The framework is installed into site-packages, so it can never locate your project's directories from its own __file__. Instead, alata.support.paths.base_path() resolves the project root from the running application's base_path (falling back to the current working directory):
from alata.support.paths import base_path
base_path() # /path/to/my-app
base_path("storage", "logs") # /path/to/my-app/storage/logs
base_path("database", "migrations") # /path/to/my-app/database/migrationsUse it whenever your code needs a path inside the project root — it stays correct across the HTTP server, the console, and workers.