# mmn92/node-logins architecture

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

- Interactive diagram: https://gitdiagram.com/mmn92/node-logins
- Repository: https://github.com/mmn92/node-logins

## Overview

This repository contains three small Node.js login-server examples: Fastify, Koa, and Node’s built-in HTTP server. Each exposes login and token-validation endpoints; the Fastify and Koa implementations check an in-memory user list and issue or verify JWTs, while the native HTTP version does likewise with explicit request-body parsing. The Fastify app also autoloads plugins and routes, including an example route. The README describes the project only generally, so the graph reflects the sampled implementations rather than assuming they share runtime components.

Main entry points: [`fast-login/src/app.ts`](https://github.com/mmn92/node-logins/blob/main/fast-login/src/app.ts) (App and autoload), [`fast-login/src/routes/root.ts`](https://github.com/mmn92/node-logins/blob/main/fast-login/src/routes/root.ts) (Login and validation), [`login-server/src/server.ts`](https://github.com/mmn92/node-logins/blob/main/login-server/src/server.ts) (Server and routes), [`node-http/src/server.ts`](https://github.com/mmn92/node-logins/blob/main/node-http/src/server.ts) (HTTP server and routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_fastify["Fastify server"]
  node_fastify_app["App and autoload<br/>[app.ts]"]
  node_fastify_login["Login and validation<br/>[root.ts]"]
  node_fastify_users[("In-memory users<br/>[root.ts]")]
  node_fastify_jwt["JWT signing and verification<br/>[root.ts]"]
  node_fastify_example["Example routes<br/>[index.ts]"]
  node_fastify_sensible["HTTP utilities plugin<br/>[sensible.ts]"]
  node_fastify_support["Support decorator<br/>[support.ts]"]
end

subgraph group_koa["Koa server"]
  node_koa_server["Server and routes<br/>[server.ts]"]
  node_koa_body["Body parsing<br/>[server.ts]"]
  node_koa_auth["Login and validation<br/>[server.ts]"]
  node_koa_users[("In-memory users<br/>[server.ts]")]
  node_koa_jwt["JWT signing and verification<br/>[server.ts]"]
end

subgraph group_native["Native HTTP server"]
  node_native_server["HTTP server and routes<br/>[server.ts]"]
  node_native_body["Body parsing<br/>[server.ts]"]
  node_native_auth["Login and validation<br/>[server.ts]"]
  node_native_users[("In-memory users<br/>[server.ts]")]
  node_native_jwt["JWT signing and verification<br/>[server.ts]"]
end

node_client(("HTTP client"))

node_client -->|"sends requests"| node_fastify_login
node_fastify_app -->|"autoloads routes"| node_fastify_login
node_fastify_app -->|"autoloads routes"| node_fastify_example
node_fastify_app -->|"autoloads plugins"| node_fastify_sensible
node_fastify_app -->|"autoloads plugins"| node_fastify_support
node_fastify_login -->|"checks credentials"| node_fastify_users
node_fastify_login -->|"signs or verifies"| node_fastify_jwt
node_client -->|"sends requests"| node_koa_server
node_koa_server -->|"registers parser"| node_koa_body
node_koa_server -->|"registers routes"| node_koa_auth
node_koa_auth -->|"checks credentials"| node_koa_users
node_koa_auth -->|"signs or verifies"| node_koa_jwt
node_client -->|"sends requests"| node_native_server
node_native_server -->|"parses login body"| node_native_body
node_native_server -->|"dispatches routes"| node_native_auth
node_native_auth -->|"checks credentials"| node_native_users
node_native_auth -->|"signs or verifies"| node_native_jwt

click node_fastify_app "https://github.com/mmn92/node-logins/blob/main/fast-login/src/app.ts"
click node_fastify_login "https://github.com/mmn92/node-logins/blob/main/fast-login/src/routes/root.ts"
click node_fastify_users "https://github.com/mmn92/node-logins/blob/main/fast-login/src/routes/root.ts"
click node_fastify_jwt "https://github.com/mmn92/node-logins/blob/main/fast-login/src/routes/root.ts"
click node_fastify_example "https://github.com/mmn92/node-logins/blob/main/fast-login/src/routes/example/index.ts"
click node_fastify_sensible "https://github.com/mmn92/node-logins/blob/main/fast-login/src/plugins/sensible.ts"
click node_fastify_support "https://github.com/mmn92/node-logins/blob/main/fast-login/src/plugins/support.ts"
click node_koa_server "https://github.com/mmn92/node-logins/blob/main/login-server/src/server.ts"
click node_koa_body "https://github.com/mmn92/node-logins/blob/main/login-server/src/server.ts"
click node_koa_auth "https://github.com/mmn92/node-logins/blob/main/login-server/src/server.ts"
click node_koa_users "https://github.com/mmn92/node-logins/blob/main/login-server/src/server.ts"
click node_koa_jwt "https://github.com/mmn92/node-logins/blob/main/login-server/src/server.ts"
click node_native_server "https://github.com/mmn92/node-logins/blob/main/node-http/src/server.ts"
click node_native_body "https://github.com/mmn92/node-logins/blob/main/node-http/src/server.ts"
click node_native_auth "https://github.com/mmn92/node-logins/blob/main/node-http/src/server.ts"
click node_native_users "https://github.com/mmn92/node-logins/blob/main/node-http/src/server.ts"
click node_native_jwt "https://github.com/mmn92/node-logins/blob/main/node-http/src/server.ts"

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_fastify_app,node_fastify_login,node_fastify_users,node_fastify_jwt,node_fastify_example,node_fastify_sensible,node_fastify_support,node_client toneBlue
class node_koa_server,node_koa_body,node_koa_auth,node_koa_users,node_koa_jwt toneAmber
class node_native_server,node_native_body,node_native_auth,node_native_users,node_native_jwt toneMint
```

## Components

### Fastify server

- [App and autoload](https://github.com/mmn92/node-logins/blob/main/fast-login/src/app.ts): `fast-login/src/app.ts`
- [Login and validation](https://github.com/mmn92/node-logins/blob/main/fast-login/src/routes/root.ts): `fast-login/src/routes/root.ts`
- [In-memory users](https://github.com/mmn92/node-logins/blob/main/fast-login/src/routes/root.ts): `fast-login/src/routes/root.ts`
- [JWT signing and verification](https://github.com/mmn92/node-logins/blob/main/fast-login/src/routes/root.ts): `fast-login/src/routes/root.ts`
- [Example routes](https://github.com/mmn92/node-logins/blob/main/fast-login/src/routes/example/index.ts): `fast-login/src/routes/example/index.ts`
- [HTTP utilities plugin](https://github.com/mmn92/node-logins/blob/main/fast-login/src/plugins/sensible.ts): `fast-login/src/plugins/sensible.ts`
- [Support decorator](https://github.com/mmn92/node-logins/blob/main/fast-login/src/plugins/support.ts): `fast-login/src/plugins/support.ts`

### Koa server

- [Server and routes](https://github.com/mmn92/node-logins/blob/main/login-server/src/server.ts): `login-server/src/server.ts`
- [Body parsing](https://github.com/mmn92/node-logins/blob/main/login-server/src/server.ts): `login-server/src/server.ts`
- [Login and validation](https://github.com/mmn92/node-logins/blob/main/login-server/src/server.ts): `login-server/src/server.ts`
- [In-memory users](https://github.com/mmn92/node-logins/blob/main/login-server/src/server.ts): `login-server/src/server.ts`
- [JWT signing and verification](https://github.com/mmn92/node-logins/blob/main/login-server/src/server.ts): `login-server/src/server.ts`

### Native HTTP server

- [HTTP server and routes](https://github.com/mmn92/node-logins/blob/main/node-http/src/server.ts): `node-http/src/server.ts`
- [Body parsing](https://github.com/mmn92/node-logins/blob/main/node-http/src/server.ts): `node-http/src/server.ts`
- [Login and validation](https://github.com/mmn92/node-logins/blob/main/node-http/src/server.ts): `node-http/src/server.ts`
- [In-memory users](https://github.com/mmn92/node-logins/blob/main/node-http/src/server.ts): `node-http/src/server.ts`
- [JWT signing and verification](https://github.com/mmn92/node-logins/blob/main/node-http/src/server.ts): `node-http/src/server.ts`

### Other components

- **HTTP client**

## Connections

- HTTP client → Login and validation: sends requests (evidence: `fast-login/src/routes/root.ts`)
- App and autoload → Login and validation: autoloads routes (evidence: `fast-login/src/app.ts`)
- App and autoload → Example routes: autoloads routes (evidence: `fast-login/src/app.ts`)
- App and autoload → HTTP utilities plugin: autoloads plugins (evidence: `fast-login/src/app.ts`)
- App and autoload → Support decorator: autoloads plugins (evidence: `fast-login/src/app.ts`)
- Login and validation → In-memory users: checks credentials (evidence: `fast-login/src/routes/root.ts`)
- Login and validation → JWT signing and verification: signs or verifies (evidence: `fast-login/src/routes/root.ts`)
- HTTP client → Server and routes: sends requests (evidence: `login-server/src/server.ts`)
- Server and routes → Body parsing: registers parser (evidence: `login-server/src/server.ts`)
- Server and routes → Login and validation: registers routes (evidence: `login-server/src/server.ts`)
- Login and validation → In-memory users: checks credentials (evidence: `login-server/src/server.ts`)
- Login and validation → JWT signing and verification: signs or verifies (evidence: `login-server/src/server.ts`)
- HTTP client → HTTP server and routes: sends requests (evidence: `node-http/src/server.ts`)
- HTTP server and routes → Body parsing: parses login body (evidence: `node-http/src/server.ts`)
- HTTP server and routes → Login and validation: dispatches routes (evidence: `node-http/src/server.ts`)
- Login and validation → In-memory users: checks credentials (evidence: `node-http/src/server.ts`)
- Login and validation → JWT signing and verification: signs or verifies (evidence: `node-http/src/server.ts`)
