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
classDef test fill:#ccffcc,stroke:#53c45e,stroke-width:2px,color:#555,font-family:monospace;
137
136
138
137
class main,routes,services,schemas,databases,models core
139
-
class fastapi,sqlalchemy,pydantic,aiocache deps
138
+
class fastapi,sqlalchemy,pydantic deps
140
139
class tests test
141
140
```
142
141
143
-
**Arrow Semantics:**
144
-
145
-
-**Solid arrows** represent import-time module dependencies. For example, `services → routes` means the services package is imported and used by the routes package.
146
-
-**Dotted arrows** represent runtime composition. The `fastapi` app instance and wired services flow into `main` at startup.
142
+
**Arrow Semantics:** Solid arrows represent import-time module dependencies — the arrow points from the dependency to the consumer. The dotted arrow to `tests` indicates the integration tests validate the full application stack as wired by `main`.
147
143
148
-
**Composition Root Pattern:** The `main` module acts as the composition root, creating the FastAPIapp and registering all routers. This pattern enables dependency injection via `Depends()`, improves testability, and maintains clear separation of concerns.
144
+
**Composition Root Pattern:** The `main` module acts as the composition root — it imports `FastAPI` and the route modules, creates the app instance, and registers all routers. This pattern enables dependency injection via `Depends()`, improves testability, and maintains clear separation of concerns.
149
145
150
-
**Layered Architecture:**HTTP requests flow through distinct layers: `routes` → `services` → `schemas` → `databases`. Each layer has a specific responsibility — routes handle HTTP mapping, validation, and in-memory caching, services contain business logic, schemas define the ORM model, and databases manage the async session.
146
+
**Layered Architecture:** Each layer has a specific responsibility — routes handle HTTP mapping, validation, and in-memory caching, services contain business logic, schemas define the ORM model, and databases manage the async session.
151
147
152
148
**Color Coding:** Core packages (blue) implement the application logic, external dependencies (red) are third-party frameworks and ORMs, and tests (green) ensure code quality.
0 commit comments