You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NodeJS scalable solution with Open Charge Map integration + MongoDB
DESCRIPTION
USER STORIES
User story 01: As a project architect, I want Docker images to be built for each service to ensure they can be deployed to a Kubernetes cluster.
User story 02: As a project architect, I want services to be designed for scalability, taking into account potential timeouts and other issues that might impact uptime.
User story 03: As a project architect, I want a /graphql endpoint provided for each service, serving a sub-graph that can be accessed through a federated GraphQL gateway to serve data for several clients.
User story 04: As a project architect, I want data to be stored in a MongoDB database, using UUIDs (v4) instead of the default ObjectIds for internal identification.
User story 05: As a project architect, I want a service that fetches the latest charging station data from Open Charge Map and updates the database only when changes are detected.
User story 06: As a project architect, I want the /graphql endpoint to list all imported charging stations, with relay-style pagination to navigate through the results.
User story 07: As a project architect, I want separate Docker images to be created for the data pulling and the service itself.
User story 08: As a project architect, I want the following fields from Open Charge Map to be imported:
operatorInfo,
statusType,
addressInfo,
connections.
User story 09: As a project architect, I want a single command to run the entire service and import process locally, along with instructions and a docker-compose file for the additional local infrastructure.
User story 10: (Bonus) As a project architect, I want a minimum of 50% unit test coverage and at least one end-to-end test for the solution.
ASSUMPTIONS
use monorepo for all components
to demonstrate how the project works, it is enough to have docker images for all components and a docker-compose file, there is no need to create Kubernetes config
to synchronize with OCM, I use the undocumented modifiedsince parameter to fulfill the requirement to receive only the delta of updated data from OCM
use Apollo Server to support subgraphs
authentication and user management out of the scope of implementation
TODO
define user stories
create list of questions to the requirements
analyze the questions
create list of assumptions
create git repository and initial README.MD with user stories
define interface for OCMPersistenceRepository, ImportSessionRepository
define CoreReferenceData
fix: issue with start script ERR_UNSUPPORTED_DIR_IMPORT
define path aliases @dal, @domain and @presentation
implement initial version for ImportService, ImportSessionRepository, OCMPersistenceRepository, OpenChargeMapRepository
implement ImportService
refactor: implement bootstrap module
setup dependency injection
redefine ImportService with mocked repositories
implement 'storeReferenceData' method for OCMPersistenceRepository
fine-tune dao and models according to OpenAPI docs
implement 'storePOIs' method for OCMPersistenceRepository
implement 'getLastPOIUpdate' for OCMDataPersistenceRepository
implement 'create' and 'getAll' methods for ImportSessionRepository
implement generic network API
dependency injection, implement composition point inside bootstrap function
implement 'getReferenceData' method for OpenChargeMapRepository with network api
implement 'getPOI' method for OpenChargeMapRepository with network api
improve ImportService - extract 10 minutes from modifiedSince to ensure that no data is lost when importing OPM, define global constanst for values such this
use transaction for OCMPersistenceRepository and ImportSessionRepository, refactor ImportService
handle initial POI import using streams
graceful shutdown import-service
unit-tests
adjust service to work as a subgraph
implement error handling
implement generic middleware
define cors configuration
add logger
documentation
etc
client-api
initial project setup
define domain models (interfaces)
implement DAO (data access objects)
define DB connector
define GraphQL schema
add prisma support
define query for one POI
define query for POI list with relay-style pagination
define resolvers
define interfaces for repository and services
implement services
implement repositories
implement dependency injection
create Dockerfile and Dockerfile.dev
graceful shutdown import-service
define input parameter validation, generate an error
unit-tests
adjust service to work as a subgraph
define cors configuration
add logger
implement errror handling
documentation
etc
graph-router
create Dockerfile for graph-router
etc
docker-compose
feat: define initial docker-compose
fix: MongoServerError: Authentication failed
add client-api instance
add graph-router instance
etc
About
NodeJS scalable solution with Open Charge Map integration + MongoDB