Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

AI Documentation

This folder contains architecture documentation for AI assistants working on this codebase.

Documents

File Description
architecture/ARCHITECTURE.md System architecture overview
architecture/DDD_PATTERNS.md DDD patterns with code examples
architecture/FOLDER_STRUCTURE.md Project folder structure guide
architecture/CODING_STANDARDS.md Naming conventions and standards

Quick Reference

Creating a New Feature

  1. Identify the Bounded Context - Does it belong to client_bc or reservation_bc?
  2. Create Value Objects - Use @dataclass(frozen=True) with validation in __post_init__
  3. Create Entity - Use @dataclass with create() and reconstitute() factory methods
  4. Create Domain Events - Use @dataclass(frozen=True) with from_entity() method
  5. Create Repository Interface - ABC in domain/interfaces/
  6. Create Command/Query - Dataclass + Handler in application/
  7. Create DTO - Dataclass with from_entity() in application/dtos/
  8. Create SQLAlchemy Model - In infrastructure/models/
  9. Create Repository Implementation - In infrastructure/repositories/
  10. Create HTTP Layer - Schema, Controller, Router in adapters/http/api/

Key Patterns

# Value Object
@dataclass(frozen=True)
class BookingId:
    value: str
    def __post_init__(self): ...
    @classmethod
    def generate(cls): ...

# Entity
@dataclass
class Booking(BaseEntity):
    @classmethod
    def create(cls, ...): ...  # Records events
    @classmethod
    def reconstitute(cls, ...): ...  # No events

# Repository Interface
class BookingRepositoryInterface(ABC):
    @abstractmethod
    def save(self, booking: Booking) -> None: ...

# Command + Handler
@dataclass(frozen=True)
class CreateBookingCommand:
    id: str
    ...

class CreateBookingHandler:
    def handle(self, command: CreateBookingCommand) -> BookingDto: ...