# tm-fuad05/past-portals-server architecture

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

- Interactive diagram: https://gitdiagram.com/tm-fuad05/past-portals-server
- Repository: https://github.com/tm-fuad05/past-portals-server

## Overview

PastPortals Server is an Express API for artifact records, liked-artifact records, and cookie-based JWT authentication. Requests enter through the server and app, which mounts three route families; routes dispatch to controllers, protected routes verify tokens, and artifact controllers access MongoDB. The README is empty, so capabilities and links here are limited to the supplied source excerpts; no client workflow or external service beyond configured MongoDB is documented.

Main entry points: [`src/app.ts`](https://github.com/tm-fuad05/past-portals-server/blob/main/src/app.ts) (Express app), [`src/routes/artifacts.route.ts`](https://github.com/tm-fuad05/past-portals-server/blob/main/src/routes/artifacts.route.ts) (Artifact routes), [`src/routes/likedArtifacts.route.ts`](https://github.com/tm-fuad05/past-portals-server/blob/main/src/routes/likedArtifacts.route.ts) (Liked routes), [`src/config/dbConnect.ts`](https://github.com/tm-fuad05/past-portals-server/blob/main/src/config/dbConnect.ts) (Mongo connection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_server["HTTP server<br/>[server.ts]"]
  node_app["Express app<br/>[app.ts]"]
end

subgraph group_auth["Authentication"]
  node_jwt_routes["JWT routes<br/>[jwt.route.ts]"]
  node_jwt_controller["Token controller<br/>[jwt.controller.ts]"]
  node_token_middleware["Token verification"]
end

subgraph group_artifacts["Artifacts"]
  node_artifact_routes["Artifact routes<br/>[artifacts.route.ts]"]
  node_artifact_controller["Artifact controller"]
end

subgraph group_likes["Liked artifacts"]
  node_liked_routes["Liked routes"]
  node_liked_controller["Liked controller"]
end

subgraph group_data["Persistence"]
  node_db_config["Mongo connection<br/>[dbConnect.ts]"]
  node_mongo[("MongoDB")]
end

node_client(("API client"))

node_client -->|"sends requests"| node_server
node_server -->|"starts"| node_app
node_app -->|"mounts auth"| node_jwt_routes
node_app -->|"mounts artifacts"| node_artifact_routes
node_app -->|"mounts likes"| node_liked_routes
node_jwt_routes -->|"dispatches"| node_jwt_controller
node_artifact_routes -->|"guards writes"| node_token_middleware
node_artifact_routes -->|"dispatches"| node_artifact_controller
node_liked_routes -->|"guards writes"| node_token_middleware
node_liked_routes -->|"dispatches"| node_liked_controller
node_artifact_controller -->|"uses client"| node_db_config
node_liked_controller -->|"uses client"| node_db_config
node_db_config -.->|"connects"| node_mongo

click node_server "https://github.com/tm-fuad05/past-portals-server/blob/main/src/server.ts"
click node_app "https://github.com/tm-fuad05/past-portals-server/blob/main/src/app.ts"
click node_jwt_routes "https://github.com/tm-fuad05/past-portals-server/blob/main/src/routes/jwt.route.ts"
click node_jwt_controller "https://github.com/tm-fuad05/past-portals-server/blob/main/src/controllers/jwt.controller.ts"
click node_token_middleware "https://github.com/tm-fuad05/past-portals-server/blob/main/src/middlewares/verifyToken.middleware.ts"
click node_artifact_routes "https://github.com/tm-fuad05/past-portals-server/blob/main/src/routes/artifacts.route.ts"
click node_artifact_controller "https://github.com/tm-fuad05/past-portals-server/blob/main/src/controllers/artifacts.controller.ts"
click node_liked_routes "https://github.com/tm-fuad05/past-portals-server/blob/main/src/routes/likedArtifacts.route.ts"
click node_liked_controller "https://github.com/tm-fuad05/past-portals-server/blob/main/src/controllers/likedArtifacts.controller.ts"
click node_db_config "https://github.com/tm-fuad05/past-portals-server/blob/main/src/config/dbConnect.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_server,node_app,node_client toneBlue
class node_jwt_routes,node_jwt_controller,node_token_middleware toneAmber
class node_artifact_routes,node_artifact_controller toneMint
class node_liked_routes,node_liked_controller toneRose
class node_db_config,node_mongo toneIndigo
```

## Components

### API entry

- [HTTP server](https://github.com/tm-fuad05/past-portals-server/blob/main/src/server.ts): `src/server.ts`
- [Express app](https://github.com/tm-fuad05/past-portals-server/blob/main/src/app.ts): `src/app.ts`

### Authentication

- [JWT routes](https://github.com/tm-fuad05/past-portals-server/blob/main/src/routes/jwt.route.ts): `src/routes/jwt.route.ts`
- [Token controller](https://github.com/tm-fuad05/past-portals-server/blob/main/src/controllers/jwt.controller.ts): `src/controllers/jwt.controller.ts`
- [Token verification](https://github.com/tm-fuad05/past-portals-server/blob/main/src/middlewares/verifyToken.middleware.ts): `src/middlewares/verifyToken.middleware.ts`

### Artifacts

- [Artifact routes](https://github.com/tm-fuad05/past-portals-server/blob/main/src/routes/artifacts.route.ts): `src/routes/artifacts.route.ts`
- [Artifact controller](https://github.com/tm-fuad05/past-portals-server/blob/main/src/controllers/artifacts.controller.ts): `src/controllers/artifacts.controller.ts`

### Liked artifacts

- [Liked routes](https://github.com/tm-fuad05/past-portals-server/blob/main/src/routes/likedArtifacts.route.ts): `src/routes/likedArtifacts.route.ts`
- [Liked controller](https://github.com/tm-fuad05/past-portals-server/blob/main/src/controllers/likedArtifacts.controller.ts): `src/controllers/likedArtifacts.controller.ts`

### Persistence

- [Mongo connection](https://github.com/tm-fuad05/past-portals-server/blob/main/src/config/dbConnect.ts): `src/config/dbConnect.ts`
- **MongoDB**

### Other components

- **API client**

## Connections

- API client → HTTP server: sends requests
- HTTP server → Express app: starts (evidence: `src/server.ts`)
- Express app → JWT routes: mounts auth (evidence: `src/app.ts`)
- Express app → Artifact routes: mounts artifacts (evidence: `src/app.ts`)
- Express app → Liked routes: mounts likes (evidence: `src/app.ts`)
- JWT routes → Token controller: dispatches (evidence: `src/routes/jwt.route.ts`)
- Artifact routes → Token verification: guards writes (evidence: `src/routes/artifacts.route.ts`)
- Artifact routes → Artifact controller: dispatches (evidence: `src/routes/artifacts.route.ts`)
- Liked routes → Token verification: guards writes (evidence: `src/routes/likedArtifacts.route.ts`)
- Liked routes → Liked controller: dispatches (evidence: `src/routes/likedArtifacts.route.ts`)
- Artifact controller → Mongo connection: uses client (evidence: `src/controllers/artifacts.controller.ts`)
- Liked controller → Mongo connection: uses client (evidence: `src/controllers/likedArtifacts.controller.ts`)
- Mongo connection → MongoDB: connects
