File tree Expand file tree Collapse file tree
examples/microservices-platform Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ version : 2
2+
3+ system :
4+ id : microservices-platform
5+ name : Microservices Platform
6+
7+ contexts :
8+ billing :
9+ name : Billing Context
10+ description : Handles invoicing, payments, and billing operations
11+ identity :
12+ name : Identity Context
13+ description : User authentication and authorization
14+
15+ containers :
16+ billing-service :
17+ kind : service
18+ name : Billing Service
19+ context : billing
20+ code :
21+ roots :
22+ - services/billing
23+ layers :
24+ api :
25+ name : API Layer
26+ patterns :
27+ - services/billing/api/**
28+ domain :
29+ name : Domain Layer
30+ patterns :
31+ - services/billing/domain/**
32+ contains :
33+ invoice-module :
34+ kind : module
35+ name : Invoice Module
36+ code :
37+ roots :
38+ - services/billing/domain/invoice
39+ layers :
40+ model :
41+ name : Domain Model
42+ patterns :
43+ - services/billing/domain/invoice/model/**
44+ repo :
45+ name : Repository
46+ patterns :
47+ - services/billing/domain/invoice/repo/**
48+
49+ identity-service :
50+ kind : service
51+ name : Identity Service
52+ context : identity
53+ code :
54+ roots :
55+ - services/identity
56+ layers :
57+ domain :
58+ name : Domain Layer
59+ patterns :
60+ - services/identity/core/**
61+ infra :
62+ name : Infrastructure Layer
63+ patterns :
64+ - services/identity/db/**
65+
66+ shared-utils :
67+ kind : library
68+ name : Shared Utilities
69+ code :
70+ roots :
71+ - libs/shared
72+
73+ interactions :
74+ - from : billing-service
75+ to : identity-service
76+ protocol : http
77+ description : Billing verifies user identity
78+ - from : billing-service
79+ to : shared-utils
80+ protocol : import
81+ description : Billing uses shared utilities
82+ - from : identity-service
83+ to : shared-utils
84+ protocol : import
85+ description : Identity uses shared utilities
Original file line number Diff line number Diff line change 1+ class Money :
2+ def __init__ (self , amount : float ):
3+ self .amount = amount
Original file line number Diff line number Diff line change 1+ rules :
2+ - id : no-cross-service-domain-deps
3+ name : Domain must not depend on other services
4+ severity : error
5+ target : dependency
6+ action : forbid
7+ when :
8+ all :
9+ - from.service != to.service
10+ - from.layer == domain
11+ message : Domain code must not depend on another service
12+
13+ - id : library-no-service-deps
14+ name : Libraries must be independent of services
15+ severity : error
16+ target : dependency
17+ action : forbid
18+ when :
19+ all :
20+ - from.kind == library
21+ - to.kind == service
22+ message : Library code must not import service code
23+
24+ - id : no-infra-to-api
25+ name : Infrastructure must not depend on API layer
26+ severity : error
27+ target : dependency
28+ action : forbid
29+ when :
30+ all :
31+ - from.layer == infra
32+ - to.layer == api
33+ message : Infrastructure layer must not depend on the API layer
Original file line number Diff line number Diff line change 1+ from services .billing .domain .invoice .model .invoice import Invoice
2+ from services .identity .core .auth import verify_token
3+
4+
5+ def create_invoice (request ):
6+ verify_token (request .token )
7+ return Invoice .create (request .data )
Original file line number Diff line number Diff line change 1+ from libs .shared .money import Money
2+
3+
4+ class Invoice :
5+ def __init__ (self , amount : "Money" ):
6+ self .amount = amount
7+
8+ @classmethod
9+ def create (cls , data : dict ) -> "Invoice" :
10+ return cls (amount = Money (data ["amount" ]))
Original file line number Diff line number Diff line change 1+ from services .billing .domain .invoice .model .invoice import Invoice
2+
3+
4+ class InvoiceRepository :
5+ def save (self , invoice : Invoice ) -> None :
6+ pass
7+
8+ def find_by_id (self , invoice_id : str ) -> Invoice | None :
9+ pass
Original file line number Diff line number Diff line change 1+ def verify_token (token : str ) -> bool :
2+ return token is not None
Original file line number Diff line number Diff line change 1+ class UserStore :
2+ def find_by_email (self , email : str ) -> dict | None :
3+ pass
You can’t perform that action at this time.
0 commit comments