DDD Structure Generator for Python Projects
Project description
DDDify 🏗️
Ein Generator für Domain-Driven Design (DDD) Projektstrukturen mit Clean Architecture für Python.
🎯 Was macht DDDify?
DDDify generiert automatisch eine vollständige DDD-Projektstruktur mit allen notwendigen Dateien und Templates:
domain/ # 🟢 DER KERN (Reines Python, KEINE Frameworks!)
├── entities.py # Die Fachlogik-Objekte
├── value_objects.py # Unveränderliche Werte
├── exceptions.py # Fachliche Fehler
└── ports.py # Interfaces
application/ # 🟡 DIE STEUERUNG (Use Cases)
├── services.py # Orchestriert Domain & Infra
├── queries.py # CQRS: Lese-Operationen
└── commands.py # CQRS: Schreib-Operationen
infrastructure/ # 🔴 DIE DETAILS (Datenbank, Ext. APIs)
├── persistence/
│ ├── orm.py # SQLAlchemy Modelle
│ └── repository.py # Repository-Implementierung
└── adapters/ # z.B. SmtpEmailAdapter
presentation/ # 🔵 DIE SCHNITTSTELLE (HTTP, CLI)
├── router.py # FastAPI Routes
└── schemas.py # Pydantic DTOs
🚀 Installation
# Klone das Repository
git clone <repo-url>
cd dddify
# Aktiviere die virtuelle Umgebung (falls vorhanden)
.venv\Scripts\activate # Windows
source .venv/bin/activate # Linux/Mac
# Installiere Dependencies (falls nötig)
pip install -r requirements.txt
💻 Verwendung
Grundlegende Verwendung
cd ddify
python test.py generate "Order Management" "Order"
Dies generiert eine vollständige DDD-Struktur für eine "Order Management" Domain mit einer "Order" Entity.
Mit benutzerdefiniertem Ausgabeverzeichnis
python test.py generate "User Management" "User" --output-dir ./my-project
Verfügbare Templates anzeigen
python test.py list-templates
📋 Beispiele
E-Commerce Order Management
python test.py generate "Order Management" "Order"
User Management System
python test.py generate "User Management" "User"
Product Catalog
python test.py generate "Product Catalog" "Product"
🏗️ Generierte Struktur
Nach der Generierung erhältst du:
- ✅ Vollständige DDD-Ordnerstruktur
- ✅ Alle notwendigen Python-Dateien mit Code-Vorlagen
- ✅ Clean Architecture Prinzipien
- ✅ CQRS Pattern (Commands & Queries)
- ✅ Repository Pattern
- ✅ FastAPI Integration
- ✅ SQLAlchemy ORM Setup
- ✅ Pydantic Schemas
- ✅ README.md mit Strukturübersicht
🎨 Templates
DDDify verwendet Jinja2-Templates für maximale Flexibilität:
entities.py.j2- Domain Entitiesvalue_objects.py.j2- Value Objectsexceptions.py.j2- Domain Exceptionsports.py.j2- Repository Interfacesapplication_services.py.j2- Application Servicescommands.py.j2- CQRS Commandsqueries.py.j2- CQRS Queriesorm.py.j2- SQLAlchemy Modelsrepository.py.j2- Repository Implementationrouter.py.j2- FastAPI Routerschemas.py.j2- Pydantic Schemas
📚 DDD Prinzipien
Abhängigkeitsregeln
- Domain kennt niemanden (Pure Python, keine Frameworks)
- Application kennt nur Domain
- Infrastructure implementiert Domain-Interfaces
- Presentation kennt Application + Domain
Vorteile
- ✅ Klare Trennung der Verantwortlichkeiten
- ✅ Testbar durch Interface-basiertes Design
- ✅ Framework-unabhängige Business-Logik
- ✅ Einfach wartbar und erweiterbar
- ✅ Skalierbar durch CQRS-Pattern
🛠️ Entwicklung
# Generator anpassen
vim ddify/main.py
# Neue Templates hinzufügen
vim ddify/templates/your_template.py.j2
# Testen
python ddify/test.py generate "Test Domain" "TestEntity"
📝 Lizenz
MIT
🤝 Contributing
Pull Requests sind willkommen!
Project details
Release history Release notifications | RSS feed
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 dddify-0.1.0.tar.gz.
File metadata
- Download URL: dddify-0.1.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83893e4ab6671aa62d1d99a37814a6758b6c17f6a069ef3c76c96838da480c5d
|
|
| MD5 |
f7fb6a799c6182b92e0e5b26ef0470e5
|
|
| BLAKE2b-256 |
fd789fc883e0cd96cc6333839d6869bc10d06828afb77c0befde8d8a1e5d90f3
|
File details
Details for the file dddify-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dddify-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f9ec7d2b94da0a1ef8cbbd09968f75c0e070c6a3dfc5f115e17d1f37da1ec41
|
|
| MD5 |
f7a3c2f47293919713a1ea217010146e
|
|
| BLAKE2b-256 |
1f6c6ffd49ee1c94ae9737f5cd25f4ae722be294ce05f14fbf951b910595914d
|