Layers Overview¶
Status: Experimental — evolving with active use
GLIMPSE defines seven layers. Each layer has a single responsibility and a fixed set of allowed dependencies.
Dependency diagram¶
┌─────────────────────────────────────────────┐
│ edges (settings, wsgi/asgi — outside GLIMPSE)
└─────────────────────────────────────────────┘
↓ mounts middleware, loads settings
┌─────────────────┐
│ inits │ DI container, middleware
└─────────────────┘
↓ ↓
┌──────────┐ ┌──────────┐
│ gates │ │ links │
└──────────┘ └──────────┘
↓ ↓
┌──────────────────────────┐
│ mills │ business logic (framework-free)
└──────────────────────────┘
↓
┌──────────────────────────┐
│ specs │ configuration constants
└──────────────────────────┘
↓
┌──────────────────────────┐
│ pacts │ contracts — depends on nothing
└──────────────────────────┘
Arrows point in the direction of dependency (A → B means A imports B). inits is the only layer that wires links into gates; neither imports the other directly.
Layer summary¶
| Layer | Purpose | Depends on |
|---|---|---|
| pacts | Protocols, DTOs, errors, enums, TypedDicts | nothing |
| specs | Pure configuration constants | pacts |
| mills | Business logic and services | pacts |
| links | Repositories, Storage, UoW, external clients | pacts + ORM |
| gates | Views, forms, URLs, templatetags, CLI commands | pacts + mills |
| inits | DI container, middleware — wires links into gates | pacts + mills + links |
| edges | settings, wsgi/asgi, manage.py | outside GLIMPSE |
Every layer is a package (directory with __init__.py), never a single .py file.