Goal:
Optimise and streamline backend services by removing duplication, consolidating entry points, and unifying API documentation.
Description:
Currently, each backend service (fetch_company_details, fetch_infra_types, fetch_internal_env_details) has a separate main.go entry point, separate API port, and independent Swagger documentation. This Epic aims to consolidate these into a unified entry point for easier management, reduced redundancy, and an improved development experience.
Tasks
Task 1: Consolidate Main Entry Point for Backend Services
Description:
Replace individual main.go files with a single main.go that serves as the primary entry point for all backend services. This main file should:
- Initialize the database connection once, shared across all services.
- Register each service’s routes under a single API (e.g.,
localhost:8080/api).
- Handle all CORS and middleware configuration centrally.
Acceptance Criteria:
- All services are routed through
localhost:8080/api.
- Each service has a distinct path, e.g.,
/api/company, /api/infra-types, /api/internal-env-details.
- Database connection is initialized once and accessible by all services.
Task 2: Integrate All Services into a Unified Swagger Documentation
Description:
Merge the Swagger documentation of each service into a single Swagger file to provide a comprehensive API overview. This will simplify API documentation for both current and future services.
Acceptance Criteria:
- A single Swagger file (
swagger.yaml) documents all endpoints.
- Documentation for all existing services (
fetch_company_details, fetch_infra_types, fetch_internal_env_details) is visible in the Swagger UI.
- Configure Swagger to automatically update as new services or endpoints are added.
Task 3: Refactor and Modularize Common Functions and Utilities
Description:
Reduce redundancy by centralizing commonly used functions and utilities across services. This includes:
- Error handling (use of standardized error responses).
- Logger initialization.
- HTTP client and service utilities.
Acceptance Criteria:
- Duplicate code across services (e.g., HTTP client, error handling, logging) is moved to the
common package.
- Each service uses the centralized functions from
common where applicable.
User Stories
- As a developer, I want to have a single entry point (
main.go) for all backend services, so that the application is easier to run, manage, and scale.
- As a developer, I want all backend services to be accessible under a single API URL (
localhost:8080/api), so that API routing is simplified.
- As an API consumer, I want a unified Swagger documentation for all services, so that I can easily understand and use the full API.
- As a developer, I want centralized common functions and utilities (e.g., HTTP client, logging, error handling) to avoid code duplication and promote code reuse.
Acceptance Criteria for Epic
- The backend services operate from a single
main.go with one entry point (localhost:8080/api).
- All API documentation is consolidated in a single Swagger UI.
- Common functions are modularized and reused across services.
- The architecture allows for easy addition of future services without additional entry points or redundant code.
Goal:
Optimise and streamline backend services by removing duplication, consolidating entry points, and unifying API documentation.
Description:
Currently, each backend service (
fetch_company_details,fetch_infra_types,fetch_internal_env_details) has a separatemain.goentry point, separate API port, and independent Swagger documentation. This Epic aims to consolidate these into a unified entry point for easier management, reduced redundancy, and an improved development experience.Tasks
Task 1: Consolidate Main Entry Point for Backend Services
Description:
Replace individual
main.gofiles with a singlemain.gothat serves as the primary entry point for all backend services. This main file should:localhost:8080/api).Acceptance Criteria:
localhost:8080/api./api/company,/api/infra-types,/api/internal-env-details.Task 2: Integrate All Services into a Unified Swagger Documentation
Description:
Merge the Swagger documentation of each service into a single Swagger file to provide a comprehensive API overview. This will simplify API documentation for both current and future services.
Acceptance Criteria:
swagger.yaml) documents all endpoints.fetch_company_details,fetch_infra_types,fetch_internal_env_details) is visible in the Swagger UI.Task 3: Refactor and Modularize Common Functions and Utilities
Description:
Reduce redundancy by centralizing commonly used functions and utilities across services. This includes:
Acceptance Criteria:
commonpackage.commonwhere applicable.User Stories
main.go) for all backend services, so that the application is easier to run, manage, and scale.localhost:8080/api), so that API routing is simplified.Acceptance Criteria for Epic
main.gowith one entry point (localhost:8080/api).