The application is developed with KISS, DRY and Fail-fast principle.
The application is developed with restrictions based on a requirements, such as:
- Using framework is not allowed but feel free to use Composer
- Must be authenticated or authorized to use the API
- Using worker or queue or message distribution
- Store all sent message/email into database
Based on points above:
- Point number
2
authorization is using OAuth2 - Point number
3
queued using RabbitMQ and usingsupervisord
to manageworker
- Point number
4
stored into postgresql database
There are several missing configuration from docker-compose.yml
environment variable and you need to fill it first in order to use the application. Such as
- SMTP account (can use google or sendgrid or anything) that allows sending emails
- Clone the repository
- Run
composer install
- Configuring
docker-compose.yml
environment variable file in.docker.env
- Run
docker-compose build
- Run
docker-compose up -d
You can access the API specification in localhost:8003
-- its a swagger-ui. Because the application is using OAuth2 Authorization Code Grant, there are several things you must do in order to be able to send email/hit the API
- Hit
/authorize
endpoint (using postman or similiar program) and get theauthorization_code
value -- The required params are all documented in swagger-ui - Hit
/access_token
endpoint (using postman or similiar program) and pass theauthorization_code
and getaccess_token
value -- the required parameter are all documented in swagger-ui - Put
access_token
in header withBearer {access_token}
format, and then hit/emails/send
endpoint. -- The required parameter are all documented in swagger-ui