This a'la Enterprise Service Bus (ESB) service is a part of a project that required Service Oriented Architecture (SOA) implementation. We worked on a project in a group of four for a Master's class at the University of Aveiro. It demanded effective teamwork and communication skills.
- OAuth e.g. Login via Google / Github / Facebook are feasible to implement
- Contracts... In SOA, a contract defines the agreed-upon rules and expectations for service communication between providers and consumers.
- Cookie-Based Auth is vulnerable to CSRD attacks, next time use more modern approach featuring Edge Auth
- Consider using REST API instead of Queues when there is a need to reply-back
- Repository pattern: isolates persistence layer from the app very well
- Factory Pattern: When there is many of new Factories appearing, consider Abstract Factory for objects inheriting from the same parent class
- Parametrizing environment variables is a must approach when the app meets deployment. Never push hardcoded secrets.
- Authenticate, document and version REST API
- REST:
GET
/POST
/PUT
/DELETE
- "APIs are like resources"
- "The issue with REST is that the server always must reply back… Synchronous nature…"
- Never use verbs, use nouns
- DO NOT:
/getAllProducts
- DO:
/products
- DO NOT:
- Use plurals
- DO NOT:
/product/all
- DO:
/products
- DO NOT:
- Use parameters
- DO NOT:
/getProductsByName
- DO:
/products?name=’ABC'
- DO NOT:
- Use proper HTTP codes - there is more than
200
,403
,500
, especially errors - Always version your APIs
- DO NOT:
/products
- DO:
/v1/products
, later/v2/products
- DO NOT:
- Use pagination (when you expose data to public and load balancing is done wrong)
- DO NOT:
/products?limit=99999999
- DO:
/products?limit=25&offset=50
- DO NOT:
- Supported formats (mostly
JSON
or legacyXML
) - Use OpenAPI specifications // documentation
- "No need to reply back"
- Asynchronous
- Reliable queuing
- 1-to-1 interaction with failure resillience
- 1-to-many interaction - improve performance, “the message reaches everyone”
- many-to-many - as in replicated services for large amount of clients
- Allow to implement complex interaction patterns
- Flexibility at the cost of performance
- Queues promote clustering
- Backend: FastAPI
- Auth: Auth0
- Middlewares: ActiveMQ, Kubernetes Traefik (Ingress)
- Persistence: MySQL