Things to consider when creating new service in Microservices

How RESTful services in Microservices architecture can be more efficient. Here is the list of the things I would consider while planning for a new API service.

  • Each RESTful service should have a well‑defined boundary.
  • Individual services should be simple, faster to develop, and easier to understand and maintain.
  • Consider modularity of Service,
  • Consider network failures and recovery (see CAP theorem).
  • Use the Micro Framework or Micro Structure of codebase.
  • Each service should have it’s own database and cache if required. But try not to keep redundant data within services.
  • The developers are free to choose whatever technologies that make sense, maintaining an API contract.
  • Developers are not obligated to use the possibly obsolete technologies that existed at the start of a new project. 
  • Each microservice should deploy and scale independently.
  • Maintain Semantic Versioning( and major API versioning should be in URI (example: /v1/foo).
  • Follow for request and response.
  • Implement JSON schema validation ( for request JSON.
  • Health Check: Implement Health endpoint.
  • Implement graceful shutdown when a database or any resource transaction used by service.
  • Logging: Structured logging and Event logging with proper identifiable data.
  • Naming: Last but not least give service a short codename. use the name in code namespace and API-gateway URI. I would avoid using the name that tries to describe what it does (example SearchQueryCacheIndex) later it creates more confusions to other team members

Happy Coding