Skip to content

docs: add architecture and best-practices reference guides#20

Merged
aseguragonzalez merged 4 commits into
mainfrom
docs/add-architecture-and-best-practice
May 25, 2026
Merged

docs: add architecture and best-practices reference guides#20
aseguragonzalez merged 4 commits into
mainfrom
docs/add-architecture-and-best-practice

Conversation

@aseguragonzalez
Copy link
Copy Markdown
Owner

Summary

  • Add docs/architecture.md: describes the standard service building blocks (API, Database, Subscriber, DLQ Subscriber, Publisher, Scheduler, Worker) with Mermaid diagrams and infrastructure mechanisms (outbox pattern, unit of work, idempotency, retry/DLQ, observability).
  • Add docs/best-practices.md: concise DDD & Hexagonal Architecture reference covering domain components (Entity, Value Object, Aggregate, Domain Event, Domain Service, Repository, Ports), application components (Command/Query/Handler, UoW, Result, Maybe), and the domain event vs integration event vs background task decision guide.

Test plan

  • All markdownlint rules pass (make pre-commit)
  • Conventional Commit hook passes
  • No changes to source code — documentation only

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 24, 2026 20:35
@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds two new reference guides under docs/ to describe the seedwork’s intended service architecture and DDD/hexagonal best practices, including diagrams and decision guides for events vs tasks.

Changes:

  • Added a DDD & Hexagonal Architecture best-practices guide with component definitions and recommended flows.
  • Added a service architecture building-blocks guide covering outbox/UoW/idempotency/retry/DLQ/observability, with Mermaid diagrams.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
docs/best-practices.md New reference guide for DDD/hexagonal rules, domain/application components, and event/task decisioning.
docs/architecture.md New reference guide describing standard service building blocks and infrastructure mechanisms (outbox, UoW, idempotency, retry/DLQ, observability).
Comments suppressed due to low confidence (1)

docs/best-practices.md:345

  • This section documents a Maybe type with just(...) / nothing() helpers, but no such type/helpers exist in the repository; queries return None when absent. Please align this section with the actual API (or add the missing Maybe implementation), otherwise readers will look for APIs that aren't there.
### 3.6 Maybe

`Maybe` is the **value-based absence contract for queries**.

#### Key points

- Two states: `just(value)` (found) and `nothing()` (absent).
- Replaces `null`/`None` returns with an explicit type that forces the caller to handle absence.
- Use `nothing()` for both not-found and unauthorized — identical response, no information leak.

#### Do

- Check `isNothing()` at the entry point before accessing the value.

#### Don't

- Use `Maybe` for command results — that is `Result`'s responsibility.
- Use `just(null)` — if the value is absent, return `nothing()`.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/best-practices.md
Comment thread docs/best-practices.md Outdated
Comment thread docs/best-practices.md Outdated
Comment thread docs/best-practices.md Outdated
Comment thread docs/best-practices.md Outdated
Comment thread docs/architecture.md Outdated
Comment thread docs/architecture.md
Comment thread docs/architecture.md
- Replace Maybe<TResult>/just/nothing with TResult | None to match
  QueryBus.ask and QueryHandler.handle signatures
- Remove non-existent validate() hook and ValidationErrors; Commands and
  Queries are plain frozen dataclasses, domain validation lives in
  __post_init__ of ValueObject and Entity
- Fix Result.fail → Result.failed throughout
- Remove validation step from bus sequence diagrams and update
  CommandBus stack label accordingly
- Fix camelCase identifiers (findById, correlationId, causationId,
  occurredAt) to snake_case matching the Python API
- Fix rollback wording: "handlers did not execute" → "their effects are
  not persisted"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@aseguragonzalez aseguragonzalez self-assigned this May 25, 2026
aseguragonzalez and others added 2 commits May 25, 2026 21:34
Command and Query domain-value validation happens in __post_init__ when
the object is constructed by the API, before dispatch()/ask() is called.
Moved the validation note from the bus to the API participant in both
the write and read operation diagrams.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@aseguragonzalez aseguragonzalez merged commit f1c1649 into main May 25, 2026
8 checks passed
@aseguragonzalez aseguragonzalez deleted the docs/add-architecture-and-best-practice branch May 25, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants