Async DDD framework for microservices on Starlette
Project description
Urich
Async DDD framework for microservices on Starlette.
Documentation: kashn9sh.github.io/urich · Contributing: CONTRIBUTING.md · Community & promotion: docs/community.md
The application is composed from module objects via app.register(module) — similar to FastAPI with routers, but one consistent style for domain, events, RPC and discovery.
Idea
- One object = one building block: DomainModule, EventBusModule, OutboxModule, DiscoveryModule, RpcModule. All configured via fluent API and attached with
app.register(module). - DDD: Bounded context as DomainModule with
.aggregate(),.repository(),.command(),.query(),.on_event(). Commands and queries get HTTP routes automatically. - No lock-in: Protocols (EventBus, ServiceDiscovery, RpcTransport) in core; implementations (Redis, Consul, HTTP+JSON) supplied by the user or optional out-of-the-box adapters.
Install
pip install urich
# CLI for generating skeletons:
pip install "urich[cli]"
Quick start
from urich import Application
from urich.ddd import DomainModule
# One object = full bounded context
from orders.module import orders_module
app = Application()
app.register(orders_module)
# Run: python -m uvicorn main:app --reload (or: pip install uvicorn && uvicorn main:app --reload)
Routes by convention: POST /orders/commands/create_order, GET /orders/queries/get_order.
OpenAPI / Swagger
After registering all modules, call app.openapi(title="My API", version="0.1.0"). Then:
- GET /openapi.json — OpenAPI 3.0 spec
- GET /docs — Swagger UI
app = Application()
# ... app.register(module) ...
app.openapi(title="My API", version="0.1.0")
CLI
urich create-app myapp
cd myapp
urich add-context orders --dir .
urich add-aggregate orders Order --dir .
# In main.py: from orders.module import orders_module; app.register(orders_module)
Module structure (DomainModule)
- domain — aggregate (AggregateRoot), domain events (DomainEvent).
- application — commands/queries (Command/Query), handlers (one per command/query).
- infrastructure — repository interface and implementation (e.g. in-memory for prototypes).
- module.py — one object
DomainModule("orders").aggregate(...).repository(...).command(...).query(...).on_event(...); register in the app withapp.register(orders_module).
Other modules
- EventBusModule —
.adapter(impl)or.in_memory(); in container as EventBus. - OutboxModule —
.storage(...)and.publisher(...); contracts in core. - DiscoveryModule —
.static({"svc": "http://..."})or.adapter(impl); ServiceDiscovery protocol. - RpcModule —
.server(path="/rpc")and.client(discovery=..., transport=...); optional JsonHttpRpcTransport (requires httpx).
Full composition example: examples/ecommerce/main.py.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file urich-0.1.2.tar.gz.
File metadata
- Download URL: urich-0.1.2.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d9d4c0c62572ee69177da96fa0a1e688b755beccee55accb5f5aeeb8a3b76b0
|
|
| MD5 |
48964143b2ee1b4ad0ce2e9b358edb7e
|
|
| BLAKE2b-256 |
e125c2291c1792553f6171fca29b5cd7ecaf67adba3cad284d8f50f02c6972cb
|
Provenance
The following attestation bundles were made for urich-0.1.2.tar.gz:
Publisher:
publish.yml on KashN9sh/urich
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
urich-0.1.2.tar.gz -
Subject digest:
4d9d4c0c62572ee69177da96fa0a1e688b755beccee55accb5f5aeeb8a3b76b0 - Sigstore transparency entry: 975668159
- Sigstore integration time:
-
Permalink:
KashN9sh/urich@3ae81968ff91b1038230b4d16a444979584251e7 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/KashN9sh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3ae81968ff91b1038230b4d16a444979584251e7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file urich-0.1.2-py3-none-any.whl.
File metadata
- Download URL: urich-0.1.2-py3-none-any.whl
- Upload date:
- Size: 25.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd932c868ac13bf13301fd417246dfdf1d0283d7fc991ea0f0610b7b54acc3d2
|
|
| MD5 |
9563091bc5e56e24955501990d1115d6
|
|
| BLAKE2b-256 |
13bbd350d5249b6e3a96d24a85ce0dc099df206fc497ba1d6c397f8881766460
|
Provenance
The following attestation bundles were made for urich-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on KashN9sh/urich
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
urich-0.1.2-py3-none-any.whl -
Subject digest:
fd932c868ac13bf13301fd417246dfdf1d0283d7fc991ea0f0610b7b54acc3d2 - Sigstore transparency entry: 975668161
- Sigstore integration time:
-
Permalink:
KashN9sh/urich@3ae81968ff91b1038230b4d16a444979584251e7 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/KashN9sh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3ae81968ff91b1038230b4d16a444979584251e7 -
Trigger Event:
release
-
Statement type: