You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Arrows point from a dependency toward its consumer. Solid arrows (`-->`) denote **strong (functional) dependencies**: the consumer actively invokes behavior — registering route handlers, dispatching requests, executing async queries, or managing the database session. Dotted arrows (`-.->`) denote **soft (structural) dependencies**: the consumer only references types without invoking runtime behavior. This distinction follows UML's `«use»` dependency notation and classical coupling theory (Myers, 1978): strong arrows approximate *control or stamp coupling*, while soft arrows approximate *data coupling*, where only shared data structures cross the boundary.
160
+
Arrows follow the injection direction: `A --> B` means A is injected into B. Solid arrows (`-->`) represent active dependencies — components wired via FastAPI's `Depends()` mechanism and invoked at runtime. Dotted arrows (`-.->`) represent structural dependencies — the consumer references types without invoking runtime behavior.
161
161
162
162
### Composition Root Pattern
163
163
164
-
The `main`module acts as the composition root — it creates the FastAPI application instance, configures the lifespan handler, and registers all route modules via `app.include_router()`. Rather than explicit object construction, dependency injection is provided by FastAPI's built-in `Depends()` mechanism: `routes` declare their dependencies (e.g. `AsyncSession`) as function parameters and FastAPI resolves them at request time. This pattern enables dependency injection, improves testability, and ensures no other module bears responsibility for wiring or lifecycle management.
164
+
`main`is the composition root: it creates the FastAPI application instance, configures the lifespan handler, and registers all route modules via `app.include_router()`. Dependencies are resolved at request time via FastAPI's `Depends()` mechanism.
165
165
166
166
### Layered Architecture
167
167
168
-
The codebase is organized into four conceptual layers: Initialization (`main`), HTTP (`routes`), Business (`services`), and Data (`schemas`, `databases`).
168
+
Four layers: Initialization (`main`), HTTP (`routes`), Business (`services`), and Data (`schemas`, `databases`).
169
169
170
-
Third-party dependencies are co-resident within the layer that consumes them: `FastAPI` and `aiocache`inside HTTP, and `SQLAlchemy`inside Data. `routes` holds a soft dependency on `SQLAlchemy`—`AsyncSession`is referenced only as a type annotation in `Depends()`, without any direct SQLAlchemy method calls at the route level.
170
+
Third-party packages are placed inside the subgraph of the layer that uses them — `FastAPI` and `aiocache`in HTTP, `SQLAlchemy`in Data. The soft dependency from `routes` to `SQLAlchemy`reflects`AsyncSession`appearing only as a type annotation in `Depends()`, with no direct SQLAlchemy calls at the route level.
171
171
172
-
The `models`package is a **cross-cutting type concern** — it defines Pydantic request and response models consumed across multiple layers, without containing logic or behavior of its own. Dependencies always flow from consumers toward their lower-level types: each layer depends on (consumes) the layers below it, and no layer invokes behavior in a layer above it.
172
+
`models` is a cross-cutting type concern — Pydantic request/response models consumed across all layers, with no logic of its own.
173
173
174
174
### Color Coding
175
175
176
-
Core packages (blue) implement the application logic, third-party dependencies (red) are community packages, and tests (green) ensure code quality.
176
+
Blue = core application packages, red = third-party libraries, green = tests.
177
+
178
+
## Architecture Decisions
179
+
180
+
Key architectural decisions are documented as ADRs in [`docs/adr/`](docs/adr/README.md).
177
181
178
182
## API Reference
179
183
@@ -271,7 +275,7 @@ Tests are located in the `tests/` directory and use `httpx` for async integratio
271
275
272
276
**Coverage target:** 80% minimum.
273
277
274
-
## Docker
278
+
## Containers
275
279
276
280
This project includes full Docker support with Docker Compose for easy deployment.
277
281
@@ -405,11 +409,6 @@ PYTHONUNBUFFERED=1
405
409
|`docker compose down`| Stop Docker container |
406
410
|`docker compose down -v`| Stop and remove Docker volume |
407
411
408
-
## Architecture Decisions
409
-
410
-
Key architectural decisions are documented as ADRs in
411
-
[`docs/adr/`](docs/adr/README.md).
412
-
413
412
## Contributing
414
413
415
414
Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on the code of conduct and the process for submitting pull requests.
@@ -423,4 +422,4 @@ Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for de
423
422
424
423
## Legal
425
424
426
-
This project is provided for educational and demonstration purposes and may be used in production environments at your discretion. All referenced trademarks, service marks, product names, company names, and logos are the property of their respective owners and are used solely for identification or illustrative purposes.
425
+
This project is provided for educational and demonstration purposes and may be used in production at your own discretion. All trademarks, service marks, product names, company names, and logos referenced herein are the property of their respective owners and are used solely for identification or illustrative purposes.
0 commit comments