├── .gitignore ├── Dockerfile ├── README.ko.md ├── README.md ├── app.py ├── common ├── __init__.py ├── errors │ ├── __init__.py │ └── exception.py └── protocols │ ├── __init__.py │ ├── event.py │ ├── model_mapper.py │ ├── persistence_adapter.py │ └── usecase.py ├── container.py ├── core ├── __init__.py ├── fastapi │ ├── __init__.py │ ├── error.py │ ├── event │ │ ├── __init__.py │ │ ├── dispatcher.py │ │ ├── exception.py │ │ ├── handler.py │ │ └── middleware.py │ ├── responses.py │ └── routes.py ├── pydantic.py └── snowflake.py ├── images ├── cqrs.png ├── ddd_db_schema.png ├── normal_db_schema.png └── python_event.png ├── modules ├── __init__.py ├── author │ ├── __init__.py │ ├── domain │ │ ├── __init__.py │ │ ├── aggregate │ │ │ ├── __init__.py │ │ │ ├── id.py │ │ │ └── model.py │ │ └── value_objects.py │ ├── infrastructure │ │ ├── __init__.py │ │ ├── persistence │ │ │ ├── __init__.py │ │ │ ├── adapter.py │ │ │ ├── mapper.py │ │ │ └── uow.py │ │ └── query │ │ │ ├── __init__.py │ │ │ ├── dto.py │ │ │ ├── mapper.py │ │ │ ├── repository │ │ │ ├── __init__.py │ │ │ ├── impl.py │ │ │ └── protocol.py │ │ │ └── uow.py │ └── usecase │ │ ├── __init__.py │ │ ├── addBookToAuthor │ │ ├── __init__.py │ │ ├── command.py │ │ ├── event_handler.py │ │ └── impl.py │ │ └── newAuthor │ │ ├── __init__.py │ │ ├── api.py │ │ ├── command.py │ │ └── impl.py └── book │ ├── __init__.py │ ├── domain │ ├── __init__.py │ ├── aggregate │ │ ├── __init__.py │ │ ├── id.py │ │ └── model.py │ ├── event.py │ └── value_objects.py │ ├── infrastructure │ ├── __init__.py │ ├── persistence │ │ ├── __init__.py │ │ ├── adapter.py │ │ ├── mapper.py │ │ └── uow.py │ └── query │ │ ├── __init__.py │ │ ├── dto.py │ │ ├── mapper.py │ │ ├── repository │ │ ├── __init__.py │ │ ├── impl.py │ │ └── protocol.py │ │ └── uow.py │ └── usecase │ ├── __init__.py │ ├── addAuthor │ ├── __init__.py │ ├── api.py │ ├── command.py │ └── impl.py │ ├── deleteBook │ ├── __init__.py │ ├── api.py │ ├── command.py │ └── impl.py │ ├── findBookByTitle │ ├── __init__.py │ ├── api.py │ └── impl.py │ └── newBook │ ├── __init__.py │ ├── api.py │ ├── command.py │ └── impl.py ├── persistence ├── __init__.py ├── author │ ├── __init__.py │ ├── entity.py │ └── repository.py └── book │ ├── __init__.py │ ├── entity.py │ └── repository.py ├── poetry.lock └── pyproject.toml /.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/.gitignore -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/Dockerfile -------------------------------------------------------------------------------- /README.ko.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/README.ko.md -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/README.md -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/app.py -------------------------------------------------------------------------------- /common/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /common/errors/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /common/errors/exception.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/common/errors/exception.py -------------------------------------------------------------------------------- /common/protocols/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/common/protocols/__init__.py -------------------------------------------------------------------------------- /common/protocols/event.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/common/protocols/event.py -------------------------------------------------------------------------------- /common/protocols/model_mapper.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/common/protocols/model_mapper.py -------------------------------------------------------------------------------- /common/protocols/persistence_adapter.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/common/protocols/persistence_adapter.py -------------------------------------------------------------------------------- /common/protocols/usecase.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/common/protocols/usecase.py -------------------------------------------------------------------------------- /container.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/container.py -------------------------------------------------------------------------------- /core/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /core/fastapi/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /core/fastapi/error.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/core/fastapi/error.py -------------------------------------------------------------------------------- /core/fastapi/event/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /core/fastapi/event/dispatcher.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/core/fastapi/event/dispatcher.py -------------------------------------------------------------------------------- /core/fastapi/event/exception.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/core/fastapi/event/exception.py -------------------------------------------------------------------------------- /core/fastapi/event/handler.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/core/fastapi/event/handler.py -------------------------------------------------------------------------------- /core/fastapi/event/middleware.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/core/fastapi/event/middleware.py -------------------------------------------------------------------------------- /core/fastapi/responses.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/core/fastapi/responses.py -------------------------------------------------------------------------------- /core/fastapi/routes.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/core/fastapi/routes.py -------------------------------------------------------------------------------- /core/pydantic.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/core/pydantic.py -------------------------------------------------------------------------------- /core/snowflake.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/core/snowflake.py -------------------------------------------------------------------------------- /images/cqrs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/images/cqrs.png -------------------------------------------------------------------------------- /images/ddd_db_schema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/images/ddd_db_schema.png -------------------------------------------------------------------------------- /images/normal_db_schema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/images/normal_db_schema.png -------------------------------------------------------------------------------- /images/python_event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/images/python_event.png -------------------------------------------------------------------------------- /modules/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/author/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/author/domain/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/author/domain/aggregate/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/author/domain/aggregate/id.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/author/domain/aggregate/id.py -------------------------------------------------------------------------------- /modules/author/domain/aggregate/model.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/author/domain/aggregate/model.py -------------------------------------------------------------------------------- /modules/author/domain/value_objects.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/author/domain/value_objects.py -------------------------------------------------------------------------------- /modules/author/infrastructure/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/author/infrastructure/persistence/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/author/infrastructure/persistence/adapter.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/author/infrastructure/persistence/adapter.py -------------------------------------------------------------------------------- /modules/author/infrastructure/persistence/mapper.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/author/infrastructure/persistence/mapper.py -------------------------------------------------------------------------------- /modules/author/infrastructure/persistence/uow.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/author/infrastructure/persistence/uow.py -------------------------------------------------------------------------------- /modules/author/infrastructure/query/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/author/infrastructure/query/dto.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/author/infrastructure/query/dto.py -------------------------------------------------------------------------------- /modules/author/infrastructure/query/mapper.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/author/infrastructure/query/mapper.py -------------------------------------------------------------------------------- /modules/author/infrastructure/query/repository/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/author/infrastructure/query/repository/impl.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/author/infrastructure/query/repository/impl.py -------------------------------------------------------------------------------- /modules/author/infrastructure/query/repository/protocol.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/author/infrastructure/query/repository/protocol.py -------------------------------------------------------------------------------- /modules/author/infrastructure/query/uow.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/author/infrastructure/query/uow.py -------------------------------------------------------------------------------- /modules/author/usecase/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/author/usecase/__init__.py -------------------------------------------------------------------------------- /modules/author/usecase/addBookToAuthor/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/author/usecase/addBookToAuthor/command.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/author/usecase/addBookToAuthor/command.py -------------------------------------------------------------------------------- /modules/author/usecase/addBookToAuthor/event_handler.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/author/usecase/addBookToAuthor/event_handler.py -------------------------------------------------------------------------------- /modules/author/usecase/addBookToAuthor/impl.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/author/usecase/addBookToAuthor/impl.py -------------------------------------------------------------------------------- /modules/author/usecase/newAuthor/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/author/usecase/newAuthor/api.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/author/usecase/newAuthor/api.py -------------------------------------------------------------------------------- /modules/author/usecase/newAuthor/command.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/author/usecase/newAuthor/command.py -------------------------------------------------------------------------------- /modules/author/usecase/newAuthor/impl.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/author/usecase/newAuthor/impl.py -------------------------------------------------------------------------------- /modules/book/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/book/domain/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/book/domain/aggregate/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/book/domain/aggregate/id.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/domain/aggregate/id.py -------------------------------------------------------------------------------- /modules/book/domain/aggregate/model.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/domain/aggregate/model.py -------------------------------------------------------------------------------- /modules/book/domain/event.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/domain/event.py -------------------------------------------------------------------------------- /modules/book/domain/value_objects.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/domain/value_objects.py -------------------------------------------------------------------------------- /modules/book/infrastructure/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/book/infrastructure/persistence/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/book/infrastructure/persistence/adapter.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/infrastructure/persistence/adapter.py -------------------------------------------------------------------------------- /modules/book/infrastructure/persistence/mapper.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/infrastructure/persistence/mapper.py -------------------------------------------------------------------------------- /modules/book/infrastructure/persistence/uow.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/infrastructure/persistence/uow.py -------------------------------------------------------------------------------- /modules/book/infrastructure/query/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/book/infrastructure/query/dto.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/infrastructure/query/dto.py -------------------------------------------------------------------------------- /modules/book/infrastructure/query/mapper.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/infrastructure/query/mapper.py -------------------------------------------------------------------------------- /modules/book/infrastructure/query/repository/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/book/infrastructure/query/repository/impl.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/infrastructure/query/repository/impl.py -------------------------------------------------------------------------------- /modules/book/infrastructure/query/repository/protocol.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/infrastructure/query/repository/protocol.py -------------------------------------------------------------------------------- /modules/book/infrastructure/query/uow.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/infrastructure/query/uow.py -------------------------------------------------------------------------------- /modules/book/usecase/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/usecase/__init__.py -------------------------------------------------------------------------------- /modules/book/usecase/addAuthor/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/book/usecase/addAuthor/api.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/usecase/addAuthor/api.py -------------------------------------------------------------------------------- /modules/book/usecase/addAuthor/command.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/usecase/addAuthor/command.py -------------------------------------------------------------------------------- /modules/book/usecase/addAuthor/impl.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/usecase/addAuthor/impl.py -------------------------------------------------------------------------------- /modules/book/usecase/deleteBook/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/book/usecase/deleteBook/api.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/usecase/deleteBook/api.py -------------------------------------------------------------------------------- /modules/book/usecase/deleteBook/command.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/usecase/deleteBook/command.py -------------------------------------------------------------------------------- /modules/book/usecase/deleteBook/impl.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/usecase/deleteBook/impl.py -------------------------------------------------------------------------------- /modules/book/usecase/findBookByTitle/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/book/usecase/findBookByTitle/api.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/usecase/findBookByTitle/api.py -------------------------------------------------------------------------------- /modules/book/usecase/findBookByTitle/impl.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/usecase/findBookByTitle/impl.py -------------------------------------------------------------------------------- /modules/book/usecase/newBook/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/book/usecase/newBook/api.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/usecase/newBook/api.py -------------------------------------------------------------------------------- /modules/book/usecase/newBook/command.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/usecase/newBook/command.py -------------------------------------------------------------------------------- /modules/book/usecase/newBook/impl.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/modules/book/usecase/newBook/impl.py -------------------------------------------------------------------------------- /persistence/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /persistence/author/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /persistence/author/entity.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/persistence/author/entity.py -------------------------------------------------------------------------------- /persistence/author/repository.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/persistence/author/repository.py -------------------------------------------------------------------------------- /persistence/book/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /persistence/book/entity.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/persistence/book/entity.py -------------------------------------------------------------------------------- /persistence/book/repository.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/persistence/book/repository.py -------------------------------------------------------------------------------- /poetry.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/poetry.lock -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NEONKID/fastapi-ddd-example/HEAD/pyproject.toml --------------------------------------------------------------------------------