A modern RESTful API for managing tasks and subtasks with unlimited nesting, built on Laravel 12, strict typing, service/repository/DTO architecture, and full OpenAPI documentation.
- User authentication (Laravel Sanctum)
- CRUD for tasks with unlimited nested subtasks
- Filtering by status, priority, full-text search (title, description)
- Sorting by multiple fields (priority, created_at, completed_at)
- Only the owner can modify/delete their tasks
- Cannot delete completed tasks
- Cannot mark as done if there are incomplete subtasks
- Strict typing, DTO, Enum, PSR-12 code style
- Service, repository, policy, resource layers
- Dockerized: Laravel + Nginx + MySQL
- OpenAPI (Swagger) documentation
- Clone repository:
git clone https://github.com/oleksandr-lysak/drum_n_code.git
- Copy and configure environment:
cp .env.example .env # Edit DB_*, APP_* if needed - Build and start containers:
docker-compose up --build -d
- Install dependencies and migrate:
docker-compose exec app composer install docker-compose exec app php artisan key:generate docker-compose exec app php artisan migrate --seed docker-compose exec app php artisan l5-swagger:generate
- API available at: http://localhost:8080
- Swagger docs: http://localhost:8080/api/documentation
- Register:
POST /api/register - Login:
POST /api/login(returns Bearer token) - Use
Authorization: Bearer <token>for all protected endpoints
Test users (seeded):
- user1@example.com / password
- user2@example.com / password
GET /api/tasks— List tasks (filters: status, priority, search, sort)POST /api/tasks— Create taskGET /api/tasks/{id}— Get task with subtasksPUT /api/tasks/{id}— Update taskDELETE /api/tasks/{id}— Delete taskPOST /api/tasks/{id}/done— Mark as done
See full request/response schemas and try requests in Swagger UI.
app/Http/Controllers— Thin controllers, only delegationapp/Http/Requests— FormRequest validation (with toDTO methods)app/Http/Resources— API Resources for response formattingapp/DTO— Data Transfer Objects (strict typed)app/Policies— Authorization logicapp/TaskService.php— All business logicapp/TaskRepository.php— All DB queries, filtering, search, sortapp/Models/Task.php— Eloquent model, recursive children relationapp/AuthService.php— Auth business logic
- PHP 8.3+
- Laravel 12
- MySQL 8+
- Docker, Docker Compose
- PSR-12 code style, strict_types
- OpenAPI 3.0 (Swagger)
GET /api/tasks?status=todo&priority=3&search=main&sort=priority:desc,created_at:asc
Authorization: Bearer <token>POST /api/tasks
Authorization: Bearer <token>
Content-Type: application/json
{
"status": "todo",
"priority": 3,
"title": "New Task",
"description": "Description"
}- Use Postman collection or Swagger UI for quick testing.
- All business rules are covered (ownership, completed/deletion, subtasks, etc).