# teus369/portifolio-back architecture

> Architecture diagram of the GitHub repository teus369/portifolio-back, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/teus369/portifolio-back
- Repository: https://github.com/teus369/portifolio-back

## Overview

This is a small Express backend for protected form-submission retrieval. A client request enters the server, passes authentication, is routed to the transaction controller, and the controller obtains submissions through the model and Firestore repository before returning JSON. Firebase Admin verifies ID tokens and accesses Firestore. The server also exposes a protected example route. The excerpts show the main calls; the README provides no additional product capabilities, and the global plus route-level authentication wiring means some requests may pass through the same middleware twice.

Main entry points: [`index.js`](https://github.com/teus369/portifolio-back/blob/main/index.js) (Express server), [`routes.js`](https://github.com/teus369/portifolio-back/blob/main/routes.js) (Submission routes), [`transactions/controllers.js`](https://github.com/teus369/portifolio-back/blob/main/transactions/controllers.js) (Transaction controller), [`middlewares/authenticate-jws.js`](https://github.com/teus369/portifolio-back/blob/main/middlewares/authenticate-jws.js) (JWT middleware)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_server["Express server<br/>[index.js]"]
  node_auth["JWT middleware"]
  node_routes["Submission routes<br/>[routes.js]"]
end

subgraph group_domain["Transaction access"]
  node_controller["Transaction controller<br/>[controllers.js]"]
  node_model["Transaction model<br/>[model.js]"]
  node_repository["Submission repository<br/>[repository.js]"]
end

subgraph group_firebase["Firebase services"]
  node_firebase_auth{{"Firebase Auth"}}
  node_firestore[("Firestore")]
end

node_client(("API client"))

node_client -->|"sends request"| node_server
node_server -->|"applies middleware"| node_auth
node_server -->|"mounts routes"| node_routes
node_routes -->|"protects route"| node_auth
node_routes -->|"dispatches request"| node_controller
node_auth -->|"verifies token"| node_firebase_auth
node_controller -->|"requests submissions"| node_model
node_model -->|"delegates query"| node_repository
node_repository -->|"reads submissions"| node_firestore
node_controller -->|"returns JSON"| node_client

click node_server "https://github.com/teus369/portifolio-back/blob/main/index.js"
click node_auth "https://github.com/teus369/portifolio-back/blob/main/middlewares/authenticate-jws.js"
click node_routes "https://github.com/teus369/portifolio-back/blob/main/routes.js"
click node_controller "https://github.com/teus369/portifolio-back/blob/main/transactions/controllers.js"
click node_model "https://github.com/teus369/portifolio-back/blob/main/model.js"
click node_repository "https://github.com/teus369/portifolio-back/blob/main/repository.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_server,node_auth,node_routes,node_client toneBlue
class node_controller,node_model,node_repository toneAmber
class node_firebase_auth,node_firestore toneMint
```

## Components

### HTTP API

- [Express server](https://github.com/teus369/portifolio-back/blob/main/index.js): `index.js`
- [JWT middleware](https://github.com/teus369/portifolio-back/blob/main/middlewares/authenticate-jws.js): `middlewares/authenticate-jws.js`
- [Submission routes](https://github.com/teus369/portifolio-back/blob/main/routes.js): `routes.js`

### Transaction access

- [Transaction controller](https://github.com/teus369/portifolio-back/blob/main/transactions/controllers.js): `transactions/controllers.js`
- [Transaction model](https://github.com/teus369/portifolio-back/blob/main/model.js): `model.js`
- [Submission repository](https://github.com/teus369/portifolio-back/blob/main/repository.js): `repository.js`

### Firebase services

- **Firebase Auth**
- **Firestore**

### Other components

- **API client**

## Connections

- API client → Express server: sends request (evidence: `index.js`)
- Express server → JWT middleware: applies middleware (evidence: `index.js`)
- Express server → Submission routes: mounts routes (evidence: `index.js`)
- Submission routes → JWT middleware: protects route (evidence: `routes.js`)
- Submission routes → Transaction controller: dispatches request (evidence: `routes.js`)
- JWT middleware → Firebase Auth: verifies token (evidence: `middlewares/authenticate-jws.js`)
- Transaction controller → Transaction model: requests submissions (evidence: `transactions/controllers.js`)
- Transaction model → Submission repository: delegates query (evidence: `model.js`)
- Submission repository → Firestore: reads submissions (evidence: `repository.js`)
- Transaction controller → API client: returns JSON (evidence: `transactions/controllers.js`)
