Skip to content

Directory Structure

The default Almasix application structure provides a sensible starting point for both small and large applications. Feel free to organize your application however you like — Almasix imposes almost no restrictions — but understanding the conventions will help you navigate quickly.

The core of your application lives here: HTTP controllers, middleware, models, policies, and service providers.

Almasix uses PascalCase for class names and snake_case for Python packages and modules:

Layer Convention Example
Class PascalCase class Post(Model), PostController
Package directories lowercase app/models/, app/http/controllers/
Module files snake_case post.py, post_controller.py
Imports dotted snake_case from app.models.post import Post

Generators follow the same rules. smith make:model Post writes app/models/post.py containing class Post. Nested namespaces snake-case as well: Admin/UserControllerapp/http/controllers/admin/user_controller.py. smith make:policy PostPolicy --model=Post writes app/policies/post_policy.py.

Contains app.py, where you configure the application and register middleware. See Middleware.

All of your application’s configuration files live here (app.py, database.py, http.py, and so on). Browse these files to become familiar with the options available to you.

Holds your database migrations and seeders. See Migrations and Seeding.

Route definitions for your application. By convention:

  • routes/web.py — routes that return HTML
  • routes/api.py — routes that return JSON
  • routes/console.py — scheduled tasks (loaded by smith schedule:run, not the HTTP kernel)

Console Command classes (smith make:command …). See Smith Console and Task Scheduling.

Translation catalogs for localization (lang/en/…, lang/en.json, and so on).

The entry point for Almasix’s command-line interface. Generate code, run migrations, schedule work, and open Loupe:

Terminal window
smith make:controller PostController
smith migrate
smith schedule:run
smith loupe
smith serve