|
|
5 months ago | |
|---|---|---|
| cpp17 | 5 months ago | |
| .gitignore | 5 months ago | |
| LICENSE | 5 months ago | |
| README.md | 5 months ago | |
README.md
About this Repository
This repository hosts multiple implementations of the same back-end application. The aim is to provide quick, side-by-side comparisons of different technologies (languages, frameworks, libraries) while preserving consistent business logic across all implementations.
Following principles such as SOLID and maintainable architectural patterns (Clean, Hexagonal, Onion, or even DDD) is recommended to clearly showcase the strengths and idioms of each technology.
Some over-engineering is acceptable to demonstrate architectural features, but please keep implementations readable and avoid excessive complexity (e.g., skip event sourcing or strict CQRS unless intentionally focusing on those patterns for comparison).
Project Idea: AutoStore
A system to store items with expiration dates. When items expire, new ones are automatically ordered by making a POST request to the configured order URL.
Business Rules (Domain)
- Each item has a name and an expiration date.
- Expired items are automatically removed from the store.
- When an item expires, a new item of the same type is automatically ordered.
- Expired items can be added to the store, triggering immediate ordering.
- Every item belongs to a user.
Application Requirements
- Users can register and log in to obtain a JWT.
- Authenticated users manage their personal collection of items via an HTTP API.
- Each item has an associated "order URL".
- When an item expires, the system must notify the "order URL" with an HTTP POST request.
- This call should occur immediately when the item's expiration date is reached, or when an expired item is added.
- Upon startup, the system must verify expiration dates for all items.
- Persistent storage must be used (file, database, etc.).
Layer Boundaries
| Layer | Responsibility | Internal Dependencies | External Dependencies |
|---|---|---|---|
| Domain | Entities, value objects, domain services (pure business logic) | None | None (language only) |
| Application | Use cases, orchestration, DTOs, infrastructure interfaces | Domain | None or minimal |
| Infrastructure | Implementations (repositories, HTTP, auth), background jobs | Application | Any (framework/lib) |
| Presentation | API controllers, DTOs, auth middleware | Application | UI/web/CLI/others |
| Assembly | Main app, DI, startup logic, job scheduling | Any layer | DI container, config, framework, etc. |
Possible directory layout (will vary from tech to tech)
AutoStore/
├── App
│ ├── Main
│ ├── AppConfig
│ └── ...
├── Extern
│ ├── <jwt-lib, http-client, etc.>
│ └── <...downloaded libraries and git submodules>
└── Src
├── Domain/
│ ├── Entities/
│ │ ├── User
│ │ └── Item
│ └── Services/
│ └── ExpirationPolicy
├── Application/
│ ├── UseCases/
│ │ ├── RegisterUser
│ │ ├── LoginUser
│ │ ├── AddItem
│ │ ├── GetItem
│ │ ├── DeleteItem
│ │ └── HandleExpiredItems
│ ├── Interfaces/
│ │ ├── IUserRepository
│ │ ├── IItemRepository
│ │ ├── IAuthService
│ │ └── IClock
│ ├── Dto/
│ └── Services/
├── Infrastructure/
│ ├── Repositories/
│ │ ├── FileUserRepository
│ │ └── FileItemRepository
│ ├── Adapters/
│ │ ├── JwtAuthAdapter
│ │ ├── OrderUrlHttpClient
│ │ ├── SystemClockImpl
│ │ └── <... some extern lib adapters>
│ └── Helpers/
│ └── <... DRY helpers>
└── WebApi/
├── Controllers/
│ ├── StoreController
│ └── UserController
└── Auth/
└── JwtMiddleware
Build and Run
Ideally, each implementation should include a <impl>/docker/docker-compose.yml file so that you can simply run:
docker compose up
to build and run the application.
Otherwise, please provide a <impl>/README.md file with setup and running instructions.