A RESTful API for managing todo items with file attachment capabilities.
- Docker
- Docker Compose
Using Docker Compose:
make run
This will:
- Start PostgreSQL, LocalStack (S3, SQS), and the API service
- Run database migrations
- Create required S3 bucket and SQS queue
The API will be available at http://localhost:8080
make test
curl --location 'http://localhost:8080/api/v1/upload' \
--form 'description="Buy groceries"' \
--form 'dueDate="2024-12-29T15:04:05Z"' \
--form 'file=@/path/to/file.png'
Supported file types: .txt, .png, .jpg
The project follows a hexagonal (ports and adapters) architecture pattern:
- Domain Layer: Contains core business logic and entities
- Application Layer: Orchestrates the flow of data and implements use cases
- Infrastructure Layer: Implements external service integrations
- Ports Layer: Defines interfaces for input/output operations
- Handlers Layer: Manages HTTP request/response lifecycle
Here's how a typical create todo request flows through the system:
-
HTTP Request
- Client sends POST request to
/api/v1/upload
- Request includes todo description, due date, and optional file attachment
- Client sends POST request to
-
Handler Processing
- Handler validates request parameters
- Handler converts HTTP request to domain commands/queries
- Handler invokes the application layer
-
Application Layer Processing
- Application layer validates input parameters
- Application layer invokes the domain layer
- Application layer invokes the infrastructure layer
-
Domain Layer Processing
- Domain layer validates input parameters
- Domain layer invokes the infrastructure layer
-
Infrastructure Layer Processing
- Infrastructure layer handles file storage (S3) and message queue (SQS) operations
- Infrastructure layer invokes external services (AWS)
-
External Service Processing
- External services handle file storage (S3) and message queue (SQS) operations