From 7f66fb35da1cb40cc825207cd220b01ae5ff6ed2 Mon Sep 17 00:00:00 2001 From: Nano Taboada Date: Tue, 10 Mar 2026 08:58:30 -0300 Subject: [PATCH] chore(docs): update Claude config and architecture diagram Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .claude/settings.json | 3 +++ CLAUDE.md | 4 +++- README.md | 36 ++++++++++++++++-------------------- 3 files changed, 22 insertions(+), 21 deletions(-) create mode 100644 .claude/settings.json mode change 120000 => 100644 CLAUDE.md diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..ad11d51 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,3 @@ +{ + "model": "claude-sonnet-4-6" +} diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 120000 index 02dd134..0000000 --- a/CLAUDE.md +++ /dev/null @@ -1 +0,0 @@ -.github/copilot-instructions.md \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..a7e292c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,3 @@ +# CLAUDE.md + +@.github/copilot-instructions.md diff --git a/README.md b/README.md index 2c7364d..6b5062b 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![CodeFactor](https://www.codefactor.io/repository/github/nanotaboada/python-samples-fastapi-restful/badge)](https://www.codefactor.io/repository/github/nanotaboada/python-samples-fastapi-restful) [![License: MIT](https://img.shields.io/badge/License-MIT-3DA639.svg)](https://opensource.org/licenses/MIT) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -![GitHub Copilot](https://img.shields.io/badge/GitHub_Copilot-enabled-8662C5?logo=githubcopilot&logoColor=white&labelColor=181818) +![GitHub Copilot](https://img.shields.io/badge/GitHub_Copilot-contributing-8662C5?logo=githubcopilot&logoColor=white&labelColor=181818) ![Claude](https://img.shields.io/badge/Claude-Sonnet_4.6-D97757?logo=claude&logoColor=white&labelColor=181818) ![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/nanotaboada/python-samples-fastapi-restful?utm_source=oss&utm_medium=github&utm_campaign=nanotaboada%2Fpython-samples-fastapi-restful&link=https%3A%2F%2Fcoderabbit.ai&label=CodeRabbit+Reviews&labelColor=181818) @@ -95,7 +95,7 @@ Proof of Concept for a RESTful API built with [Python 3](https://www.python.org/ } }}%% -graph RL +graph BT %% Core application packages main[main] routes[routes] @@ -108,27 +108,26 @@ graph RL fastapi[FastAPI] sqlalchemy[SQLAlchemy] pydantic[Pydantic] - aiocache[aiocache] %% Test coverage tests[tests] - %% Module dependencies (solid arrows = imports) + %% Module dependencies routes --> main - databases --> main + fastapi --> main services --> routes models --> routes + databases --> routes schemas --> services - databases --> services + models --> services + databases --> schemas + fastapi --> routes + sqlalchemy --> routes + sqlalchemy --> services + sqlalchemy --> schemas sqlalchemy --> databases pydantic --> models - fastapi --> routes - aiocache --> routes - main --> tests - - %% Runtime composition (dotted arrows = main creates/wires) - fastapi -.-> main - services -.-> main + main -.-> tests %% Node styling classDef core fill:#b3d9ff,stroke:#6db1ff,stroke-width:2px,color:#555,font-family:monospace; @@ -136,18 +135,15 @@ graph RL classDef test fill:#ccffcc,stroke:#53c45e,stroke-width:2px,color:#555,font-family:monospace; class main,routes,services,schemas,databases,models core - class fastapi,sqlalchemy,pydantic,aiocache deps + class fastapi,sqlalchemy,pydantic deps class tests test ``` -**Arrow Semantics:** - -- **Solid arrows** represent import-time module dependencies. For example, `services → routes` means the services package is imported and used by the routes package. -- **Dotted arrows** represent runtime composition. The `fastapi` app instance and wired services flow into `main` at startup. +**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`. -**Composition Root Pattern:** The `main` module acts as the composition root, creating the FastAPI app and registering all routers. This pattern enables dependency injection via `Depends()`, improves testability, and maintains clear separation of concerns. +**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. -**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. +**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. **Color Coding:** Core packages (blue) implement the application logic, external dependencies (red) are third-party frameworks and ORMs, and tests (green) ensure code quality.