Projeto de Ecommerce criado durante o programa LevelUp da Alura
Factor | Description | Status |
---|---|---|
1. Codebase | One codebase tracked in revision control, many deploys | ✔ |
2. Dependencies | Explicitly declare and isolate dependencies | ✔ |
3. Config | Store config in the environment | ✔ |
4. Backing services | Treat backing services as attached resources | ✔ |
5. Build, release, run | Strictly separate build and run stages | ✔ |
6. Processes | Execute the app as one or more stateless processes | ✔ |
7. Port binding | Export services via port binding | ✔ |
8. Concurrency | Scale out via the process model | ❌ |
9. Disposability | Maximize robustness with fast startup and graceful shutdown | ✔ |
10. Dev/prod parity | Keep development, staging, and production as similar as possible | ✔ |
11. Logs | Treat logs as event streams | ✔ |
12. Admin processes | Run admin/management tasks as one-off processes | ✔ |
Pattern | Applicable |
---|---|
Domain Services | Yes |
Business Services | Yes |
API Gateway | Yes |
Process Aggregator | Yes |
Edge Services | Yes |
Single DB vs Multiple DBs | Yes, Multiple DBs |
Asynchronous Events | Yes |
Log Aggregation | Yes |
Metrics Aggregation | Yes |
- Standardization of the service stacks
- Service discovery solution
- Security aspects
- Technologies for deploy and build
- Handle fault tolerance in synchronous applications
- When to use asynchronous communication
All services are built in node.js
using only Common Javascript
. All services use MongoDB
except Payments
, that uses mySQL
. Services run on a Docker container and are reachable through an Api Gateway.
Service discovery is needed to locate service instances in dynamically assigned network locations in a cloud-based microservices location. It helps the instances to adapt and balance the load among themselves.
As an application that deal with sensitive data, cryptography must be used. Not only with customer info, but also with order history, which contain payments info as well.
Network traffic must be managed with authentication, using tokens to prevent malicious and/or misuse access.
Services like Travis-CI, Jenkins or something similar to GitHub Actions can be used to provide a continuous integration and deployment enviroment.
Tools like cache
and circuit breaker
must be used in synchronous applications to prevent overloads and to handle server side problems, such as inactivity, overloads and other events that might break the server.
Asynchronous communication should be used within the order process. When a customer makes an order, the payment or other processes can take some time, so they should receive a response that the order is in process while the system does it's task.