This is a backend technical task implementing a user management system using Laravel and PostgreSQL. The project follows Domain-Driven Design (DDD) and Test-Driven Development (TDD) principles. JWT-based authentication is used for securing the API.
- ✅ Full CRUD operations for users:
- Create, Read, Update, Delete
- ✅ JWT authentication system
- Login, Logout, Refresh, Profile (me)
- ✅ Country selection from a predefined list
- ✅ Value Objects:
- Email (validated format, lowercase)
- PhoneNumber (sanitized & validated)
- Country (predefined values)
- ✅ Profile image upload (optional)
- ✅ Validation via Form Requests
- ✅ Tests:
- Unit tests for Value Objects & User model
- Feature tests for Auth & User API
- 68%+ test coverage
- ✅ PostgreSQL compatibility
- ✅ DDD folder structure
- Laravel 10.x
- PostgreSQL 16.x
- JWT (tymon/jwt-auth)
- PHPUnit (Testing)
git clone <repository-url>
cd tech-task
composer install
cp .env.example .env
php artisan key:generate
php artisan jwt:secret
DB_CONNECTION=pgsql
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=your_db
DB_USERNAME=your_user
DB_PASSWORD=your_pass
php artisan migrate --seed
php artisan serve
POST /api/auth/login
POST /api/auth/logout
POST /api/auth/refresh
GET /api/auth/me
GET /api/users
POST /api/users
GET /api/users/{id}
PUT /api/users/{id}
DELETE /api/users/{id}
GET /api/countries
app/
├── Domain/
│ └── User/
│ ├── Models/
│ ├── ValueObjects/
│ ├── Services/
│ └── Repositories/
├── Infrastructure/
│ └── User/ (EloquentRepository)
├── Http/
│ ├── Controllers/
│ ├── Requests/
│ └── Middleware/
php artisan test --coverage
Test coverage: 68.3% with full coverage on key services and validations.
- All features were developed based on task acceptance criteria.
- Follows clean code principles and readable structure.
- Error handling with consistent JSON structure.
This forked repository includes all required features as per the original task instructions, with full implementation of:
- Domain-Driven Design (DDD)
- JWT authentication
- Test-Driven Development (TDD)
- PostgreSQL compatibility
- Value Objects & Service Layer
Please refer to the test suite and documentation above.