This repository serves as a template for developing API and web services, utilizing Symfony framework for backend and Next.js for frontend. The architecture is designed to facilitate Docker-based development, optimized for Windows with WSL, and is easily adaptable for Linux & Docker environments.
- Docker installed on your system
- Docker Compose for orchestrating multi-container Docker applications
Before running the application, environment variables must be set. Execute the following command in the root of the repository to copy .env.example files to .env:
find . -type f -name ".env.example" -exec sh -c 'cp "$0" "${0%.example}"' {} \;Important:
.envfiles contain sensitive information and should not be committed to the repository.
With .env files prepared, start the application using Docker Compose:
docker-compose up -dThis will build and run the following services:
The ssl/ directory contains scripts to generate SSL certificates for securing your local services. Follow the instructions in ssl/readme.md to generate and manage your SSL certificates.
To use the reverse proxy, you need to add domain mapping to your hosts file (on both Windows and Linux). By default, the SSL certificates are prepared for *.template.com subdomains.
Add the following line to the hosts file located at C:\Windows\System32\drivers\etc\hosts
127.0.0.1 nginx.template.com
127.0.0.1 next.template.com
127.0.0.1 mailhog.template.comAdd the following line to the /etc/hosts file
127.0.0.1 nginx.template.com
127.0.0.1 next.template.com
127.0.0.1 mailhog.template.comNote: The default SSL certificates can be reconfigured by modifying the
ssl/config/extfile.cnffile according to your domain needs.
Before submitting a merge request, please ensure that the project passes the GitHub CI/CD pipeline. The following tests are performed:
-
PHP Code Sniffer: Checks the code against coding standards to ensure consistency.
docker-compose exec -t php sh -c "XDEBUG_MODE=off php vendor/bin/phpcs"
-
PHPStan: Performs static analysis to identify potential errors and improve code quality.
docker-compose exec -t php sh -c "XDEBUG_MODE=off php vendor/bin/phpstan analyse"
-
PHPUnit Tests: Runs the unit tests to ensure the functionality of the application.
docker-compose exec -t php sh -c "XDEBUG_MODE=off php vendor/bin/phpunit"
Make sure all tests pass without any errors before submitting your merge request.