Dev stack is a PHP/React dev environment based on Docker.
- Docker version 20.10.23, build 7155243
- Docker Compose version v2.15.1
- PHP 8.2
- Symfony 6.2
- Nginx 1.22.1
- MailHog 1.14.7
- RabbitMQ 3.11.11
- React 18
- Node 16
- symfony/property-access
- symfony/serializer
- symfony/test-pack
- symfony/validator
- symfony/http-client
- symfony/event-dispatcher
- symfony/mailer
- symfony/notifier
- symfony/messenger
- symfony/amqp-messenger
- nelmio/cors-bundle
api
- symfony backendui
- react frontenddocker
- docker components
-
Cloning repo
-
Go to repo dir
-
Create
.env
cp .env.example .env
cp api/.env.example api/.env
cp ui/.env.example ui/.env
check availability for ports
-
Set valid
x_rapid_api_key
toapi/.env
-
Build docker containers
docker-compose build
#same thing here you can use the Makefile
make build
- Start app
docker-compose up -d
# same thing here you can use the Makefile
make up
- Install vendors
docker exec -it php_v21_0_5 composer install
# same thing here you can use the Makefile
make composer
- Run messenger listener
docker exec -it php_v21_0_5 php bin/console messenger:consume amqp_email_notification -vv
# same thing here you can use the Makefile
make messenger
- Run tests
docker exec -it php_v21_0_5 php bin/phpunit
# same thing here you can use the Makefile
make test
- test api
http://localhost:8081
(the port can be modified in .env${NGINX_PORT}
)
# List of prices
curl --location 'localhost:8081/api/prices-list' \
--header 'Content-Type: application/json' \
--data-raw '{
"symbol": "GOOG",
"startDate": "2023-03-25",
"endDate": "2023-03-25",
"email": "[email protected]"
}'
# List of symbols
curl --location 'localhost:8081/api/companies' \
--header 'Content-Type: application/json' \
--data ''
- test front
http://localhost:3000
(the port can be modified in .env${REACT_PORT}
)
after update don't forgot to actualize .env
in ui
dir
- test email sandbox
http://localhost:8025
(the port can be modified in .env${MAILER_SANDBOX_PORT}
)
before testing don't forgot to run consumer
docker exec -it php_v21_0_5 php bin/console messenger:consume amqp_email_notification -vv
# same thing here you can use the Makefile
make messenger
- test rabbitMQ dashboard
http://localhost:15672
(the port can be modified in .env${RABBITMQ_MANAGER_PORT}
)
RABBITMQ_USER=guest
RABBITMQ_PASS=guest
docker-compose down --remove-orphans
# same thing here you can use the Makefile
make down
- would be great to add caching for requests to speed up the response process
- split "SymbolService" - change to decorator
- add the bigger amount of tests. Cover not only happy path
- add functional tests
- add tests to "React"
- update error listener and make better error information
- add logger