Skip to content

Repository files navigation

Async User REST API

Test assignment implementing a high-load ready REST API using Symfony.

The application accepts user data, processes it asynchronously via a queue, enriches it with GeoIP data, and exposes a paginated API with safe sorting.


🚀 Tech Stack

  • PHP 8.3
  • Symfony 7
  • PostgreSQL
  • Redis (Messenger transport)
  • Docker
  • PHPUnit
  • OpenAPI / Swagger

🧠 Architecture Highlights

✅ Async Processing

User creation is handled via Symfony Messenger + Redis, preventing direct database writes during HTTP requests and improving resilience under high load.

✅ Clean Architecture Principles

The project follows SOLID practices:

  • DTO for request/response isolation
  • Factory for domain object creation
  • Service layer for external API calls
  • Thin controllers
  • Enum-based sorting whitelist
  • Pagination to protect the database

✅ External API Integration

GeoIP lookup is performed using Symfony HttpClient with timeouts and graceful fallback handling.

✅ Test Coverage

Includes:

  • Unit tests (Factory, Service)
  • Functional API tests

🐳 Running the Project

1 Environment Setup

Copy the environment file:

cp .env.example .env

2 Start Containers

docker compose up -d --build

3 Install PHP dependencies:

docker compose exec php composer install

4 Run Database Migrations

docker compose exec php php bin/console doctrine:migrations:migrate

Open Swagger

http://localhost:8080/api/doc

Running Tests

docker compose exec php php bin/phpunit

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages