# luisrfuentes54/web-practice architecture

> Architecture diagram of the GitHub repository luisrfuentes54/web-practice, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/luisrfuentes54/web-practice
- Repository: https://github.com/luisrfuentes54/web-practice

## Overview

This repository is a small Express movie API with a WebSocket endpoint. The HTTP workflow is client request → Express app → route dispatch → movie controller → in-memory movie service → JSON response; the API supports listing, lookup by ID, and creation. The entry point creates and listens on the HTTP server, then attaches the WebSocket server to it. The excerpts show these connections; no README or sampled code documents persistence beyond process memory or additional product features.

Main entry points: [`src/app/server.js`](https://github.com/luisrfuentes54/web-practice/blob/main/src/app/server.js) (Express app), [`src/index.js`](https://github.com/luisrfuentes54/web-practice/blob/main/src/index.js) (Server entry), [`src/routes/index.routes.js`](https://github.com/luisrfuentes54/web-practice/blob/main/src/routes/index.routes.js) (API routes), [`src/modules/movies/movies.router.js`](https://github.com/luisrfuentes54/web-practice/blob/main/src/modules/movies/movies.router.js) (Movie router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Server runtime"]
  node_entry["Server entry<br/>[index.js]"]
  node_express_app["Express app<br/>[server.js]"]
  node_environment["Port config<br/>[enviroment.js]"]
end

subgraph group_movie_api["Movie API"]
  node_api_routes["API routes<br/>[index.routes.js]"]
  node_movie_router["Movie router<br/>[movies.router.js]"]
  node_movie_controller["Movie controller"]
  node_movie_service["Movie service<br/>[movies.service.js]"]
  node_movie_state[("Movie memory<br/>[movies.service.js]")]
end

subgraph group_realtime["WebSocket"]
  node_socket_server["Socket server<br/>[socketServer.js]"]
end

node_http_client(("HTTP client"))
node_ws_client(("WebSocket client"))

node_http_client -->|"sends requests"| node_express_app
node_entry -->|"creates server"| node_express_app
node_entry -->|"reads port via app"| node_environment
node_express_app -->|"configures port"| node_environment
node_express_app -->|"mounts at /api"| node_api_routes
node_api_routes -->|"mounts at /movies"| node_movie_router
node_movie_router -->|"dispatches requests"| node_movie_controller
node_movie_controller -->|"calls operations"| node_movie_service
node_movie_service -->|"reads and writes"| node_movie_state
node_entry -->|"initializes on server"| node_socket_server
node_ws_client -->|"connects and messages"| node_socket_server

click node_entry "https://github.com/luisrfuentes54/web-practice/blob/main/src/index.js"
click node_express_app "https://github.com/luisrfuentes54/web-practice/blob/main/src/app/server.js"
click node_environment "https://github.com/luisrfuentes54/web-practice/blob/main/src/config/enviroment.js"
click node_api_routes "https://github.com/luisrfuentes54/web-practice/blob/main/src/routes/index.routes.js"
click node_movie_router "https://github.com/luisrfuentes54/web-practice/blob/main/src/modules/movies/movies.router.js"
click node_movie_controller "https://github.com/luisrfuentes54/web-practice/blob/main/src/modules/movies/movies.controller.js"
click node_movie_service "https://github.com/luisrfuentes54/web-practice/blob/main/src/modules/movies/movies.service.js"
click node_movie_state "https://github.com/luisrfuentes54/web-practice/blob/main/src/modules/movies/movies.service.js"
click node_socket_server "https://github.com/luisrfuentes54/web-practice/blob/main/src/app/socketServer.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_entry,node_express_app,node_environment,node_http_client,node_ws_client toneBlue
class node_api_routes,node_movie_router,node_movie_controller,node_movie_service,node_movie_state toneAmber
class node_socket_server toneMint
```

## Components

### Server runtime

- [Server entry](https://github.com/luisrfuentes54/web-practice/blob/main/src/index.js): `src/index.js`
- [Express app](https://github.com/luisrfuentes54/web-practice/blob/main/src/app/server.js): `src/app/server.js`
- [Port config](https://github.com/luisrfuentes54/web-practice/blob/main/src/config/enviroment.js): `src/config/enviroment.js`

### Movie API

- [API routes](https://github.com/luisrfuentes54/web-practice/blob/main/src/routes/index.routes.js): `src/routes/index.routes.js`
- [Movie router](https://github.com/luisrfuentes54/web-practice/blob/main/src/modules/movies/movies.router.js): `src/modules/movies/movies.router.js`
- [Movie controller](https://github.com/luisrfuentes54/web-practice/blob/main/src/modules/movies/movies.controller.js): `src/modules/movies/movies.controller.js`
- [Movie service](https://github.com/luisrfuentes54/web-practice/blob/main/src/modules/movies/movies.service.js): `src/modules/movies/movies.service.js`
- [Movie memory](https://github.com/luisrfuentes54/web-practice/blob/main/src/modules/movies/movies.service.js): `src/modules/movies/movies.service.js`

### WebSocket

- [Socket server](https://github.com/luisrfuentes54/web-practice/blob/main/src/app/socketServer.js): `src/app/socketServer.js`

### Other components

- **HTTP client**
- **WebSocket client**

## Connections

- HTTP client → Express app: sends requests (evidence: `src/app/server.js`)
- Server entry → Express app: creates server (evidence: `src/index.js`)
- Server entry → Port config: reads port via app
- Express app → Port config: configures port (evidence: `src/app/server.js`)
- Express app → API routes: mounts at /api (evidence: `src/app/server.js`)
- API routes → Movie router: mounts at /movies (evidence: `src/routes/index.routes.js`)
- Movie router → Movie controller: dispatches requests (evidence: `src/modules/movies/movies.router.js`)
- Movie controller → Movie service: calls operations (evidence: `src/modules/movies/movies.controller.js`)
- Movie service → Movie memory: reads and writes (evidence: `src/modules/movies/movies.service.js`)
- Server entry → Socket server: initializes on server (evidence: `src/index.js`)
- WebSocket client → Socket server: connects and messages (evidence: `src/app/socketServer.js`)
