# silvsane/microservices-architecture-to-do-list architecture

> Architecture diagram of the GitHub repository silvsane/microservices-architecture-to-do-list, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/silvsane/microservices-architecture-to-do-list
- Repository: https://github.com/silvsane/microservices-architecture-to-do-list

## Overview

#### Purpose and topology
This is a Node.js microservice-style task application: a frontend is served separately, an API gateway fronts backend services, an authentication service issues/manages credentials, and a task service exposes protected task operations. No persistent database or deployment manifests are present; service state appears to be process-local stores.

#### Process entry points
- Auth service bootstraps from `auth-service/src/app.js`, with environment/config loading in `auth-service/src/config/config.js`.
- Gateway bootstraps from `gateway/src/app.js` and is the intended backend-facing integration boundary.
- Task service has a root entry point at `task-service/app.js`; its domain routes and implementation live under `task-service/src/`.
- Frontend is served by `frontend/server.js`; static/UI content is likely rooted around `frontend/test/index.html`.

#### Authentication service
Authentication is layered as HTTP routes → controller → service → in-memory stores:
- `auth-service/src/routes/auth.routes.js`
- `auth-service/src/controllers/auth.controller.js`
- `auth-service/src/services/auth.service.js`

User records and refresh-token state are isolated behind `auth-service/src/store/users.store.js` and `auth-service/src/store/refTokens.store.js`. This service owns credential validation and token lifecycle rather than allowing task APIs to access user data directly.

#### Gateway boundary
`gateway/src/app.js` is the cross-service ingress point and likely forwards frontend API traffic to auth and task backends. Environment examples at `gateway/.env.example` and `auth-service/.env.example` indicate service URLs, ports, secrets, or similar runtime settings are externally configured. The gateway is the principal place to centralize routing, exposure policy, and service discovery/configuration rather than coupling the frontend directly to internal services.

#### Task domain service
Task HTTP handling follows the same layered design:
- `task-service/src/routes/task.routes.js`
- `task-service/src/controllers/task.controller.js`
- `task-service/src/services/task.service.js`

Task state is encapsulated in `task-service/src/store/tasks.store.js`. The lack of database adapters, migrations, or ORM files means tasks are likely volatile and reset on service restart; replacing this store is the natural persistence boundary.

#### Authorization flow
Protected task requests enter `task-service/src/middlewares/auth.middleware.js` before reaching task routes. The expected control flow is frontend → gateway → task service middleware → task controller/service/store. Authentication/token issuance flows instead target the auth service. The middleware is the trust boundary: it should validate propagated credentials and establish authenticated request context before task business logic runs.

#### Runtime and operational constraints
Each component has its own `package.json` and lockfile (`auth-service/package.json`, `gateway/package.json`, `task-service/package.json`, `frontend/package.json`), implying independently installable/runnable Node.js processes. `.env.example` files exist for auth, gateway, and task services, while the frontend has no equivalent shown. No container orchestration, database, message broker, or external SaaS integration is represented in the repository tree.

Main entry points: [`gateway/src/app.js`](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/gateway/src/app.js) (API gateway), [`auth-service/src/services/auth.service.js`](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/auth-service/src/services/auth.service.js) (Auth service), [`frontend/test/index.html`](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/frontend/test/index.html) (Static UI), [`auth-service/src/app.js`](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/auth-service/src/app.js) (Auth app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_frontend_server["Frontend server<br/>Node.js entry point<br/>[server.js]"]
  node_frontend_ui["Static UI<br/>frontend content<br/>[index.html]"]
end

subgraph group_gateway["Gateway"]
  node_gateway_app["API gateway<br/>Node.js entry point<br/>[app.js]"]
end

subgraph group_auth["Auth Service"]
  node_auth_app["Auth app<br/>Node.js entry point<br/>[app.js]"]
  node_auth_routes["Auth routes<br/>HTTP routes<br/>[auth.routes.js]"]
  node_auth_controller["Auth controller<br/>[auth.controller.js]"]
  node_auth_service["Auth service<br/>credential service<br/>[auth.service.js]"]
  node_users_store[("Users store<br/>in-memory store<br/>[users.store.js]")]
  node_refresh_tokens_store[("Refresh token store<br/>in-memory store<br/>[refTokens.store.js]")]
end

subgraph group_tasks["Task Service"]
  node_task_app["Task app<br/>Node.js entry point<br/>[app.js]"]
  node_task_auth_middleware["Auth middleware<br/>authorization middleware<br/>[auth.middleware.js]"]
  node_task_routes["Task routes<br/>HTTP routes<br/>[task.routes.js]"]
  node_task_controller["Task controller<br/>[task.controller.js]"]
  node_task_service["Task service<br/>domain service<br/>[task.service.js]"]
  node_tasks_store[("Tasks store<br/>in-memory store<br/>[tasks.store.js]")]
end

node_frontend_server -->|"serves"| node_frontend_ui
node_frontend_ui -->|"API requests"| node_gateway_app
node_gateway_app -->|"forwards auth traffic"| node_auth_app
node_gateway_app -->|"forwards task traffic"| node_task_app
node_auth_app -->|"mounts"| node_auth_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_controller -->|"uses"| node_auth_service
node_auth_service -->|"reads/writes users"| node_users_store
node_auth_service -->|"manages tokens"| node_refresh_tokens_store
node_task_app -->|"protected requests"| node_task_auth_middleware
node_task_auth_middleware -->|"authorized requests"| node_task_routes
node_task_routes -->|"dispatches"| node_task_controller
node_task_controller -->|"uses"| node_task_service
node_task_service -->|"reads/writes tasks"| node_tasks_store

click node_frontend_server "https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/frontend/server.js"
click node_frontend_ui "https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/frontend/test/index.html"
click node_gateway_app "https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/gateway/src/app.js"
click node_auth_app "https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/auth-service/src/app.js"
click node_auth_routes "https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/auth-service/src/routes/auth.routes.js"
click node_auth_controller "https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/auth-service/src/controllers/auth.controller.js"
click node_auth_service "https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/auth-service/src/services/auth.service.js"
click node_users_store "https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/auth-service/src/store/users.store.js"
click node_refresh_tokens_store "https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/auth-service/src/store/refTokens.store.js"
click node_task_app "https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/task-service/app.js"
click node_task_auth_middleware "https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/task-service/src/middlewares/auth.middleware.js"
click node_task_routes "https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/task-service/src/routes/task.routes.js"
click node_task_controller "https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/task-service/src/controllers/task.controller.js"
click node_task_service "https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/task-service/src/services/task.service.js"
click node_tasks_store "https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/task-service/src/store/tasks.store.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_frontend_server,node_frontend_ui toneBlue
class node_gateway_app toneAmber
class node_auth_app,node_auth_routes,node_auth_controller,node_auth_service,node_users_store,node_refresh_tokens_store toneMint
class node_task_app,node_task_auth_middleware,node_task_routes,node_task_controller,node_task_service,node_tasks_store toneRose
```

## Components

### Frontend

- [Frontend server](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/frontend/server.js): Node.js entry point · `frontend/server.js`
- [Static UI](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/frontend/test/index.html): frontend content · `frontend/test/index.html`

### Gateway

- [API gateway](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/gateway/src/app.js): Node.js entry point · Public backend integration boundary. · `gateway/src/app.js`

### Auth Service

- [Auth app](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/auth-service/src/app.js): Node.js entry point · `auth-service/src/app.js`
- [Auth routes](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/auth-service/src/routes/auth.routes.js): HTTP routes · `auth-service/src/routes/auth.routes.js`
- [Auth controller](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/auth-service/src/controllers/auth.controller.js): controller · `auth-service/src/controllers/auth.controller.js`
- [Auth service](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/auth-service/src/services/auth.service.js): credential service · Owns credential validation and token lifecycle. · `auth-service/src/services/auth.service.js`
- [Users store](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/auth-service/src/store/users.store.js): in-memory store · Volatile user records. · `auth-service/src/store/users.store.js`
- [Refresh token store](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/auth-service/src/store/refTokens.store.js): in-memory store · Volatile refresh-token state. · `auth-service/src/store/refTokens.store.js`

### Task Service

- [Task app](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/task-service/app.js): Node.js entry point · `task-service/app.js`
- [Auth middleware](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/task-service/src/middlewares/auth.middleware.js): authorization middleware · Validates credentials and establishes request context. · `task-service/src/middlewares/auth.middleware.js`
- [Task routes](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/task-service/src/routes/task.routes.js): HTTP routes · `task-service/src/routes/task.routes.js`
- [Task controller](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/task-service/src/controllers/task.controller.js): controller · `task-service/src/controllers/task.controller.js`
- [Task service](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/task-service/src/services/task.service.js): domain service · `task-service/src/services/task.service.js`
- [Tasks store](https://github.com/silvsane/microservices-architecture-to-do-list/blob/main/task-service/src/store/tasks.store.js): in-memory store · Natural boundary for adding persistence. · `task-service/src/store/tasks.store.js`

## Connections

- Frontend server → Static UI: serves
- Static UI → API gateway: API requests
- API gateway → Auth app: forwards auth traffic
- API gateway → Task app: forwards task traffic
- Auth app → Auth routes: mounts
- Auth routes → Auth controller: dispatches
- Auth controller → Auth service: uses
- Auth service → Users store: reads/writes users
- Auth service → Refresh token store: manages tokens
- Task app → Auth middleware: protected requests
- Auth middleware → Task routes: authorized requests
- Task routes → Task controller: dispatches
- Task controller → Task service: uses
- Task service → Tasks store: reads/writes tasks
