# ff897794-maker/safepass-projet-studi architecture

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

- Interactive diagram: https://gitdiagram.com/ff897794-maker/safepass-projet-studi
- Repository: https://github.com/ff897794-maker/safepass-projet-studi

## Overview

Safepass is a browser-based password manager: users sign in, generate credentials, and save, view, or delete vault entries. The browser calls an Express API; the server authenticates users, protects vault routes with JWTs, and stores encrypted credentials in PostgreSQL. The graph includes the documented UI theme and password-strength behavior. Evidence is limited to the README (empty) and the sampled files; some UI and server code appears inconsistent, so the graph reflects stated calls rather than assuming they work successfully.

Main entry points: [`public/script.js`](https://github.com/ff897794-maker/safepass-projet-studi/blob/master/public/script.js) (Client interactions), [`server.js`](https://github.com/ff897794-maker/safepass-projet-studi/blob/master/server.js) (Authentication routes), [`public/index.html`](https://github.com/ff897794-maker/safepass-projet-studi/blob/master/public/index.html) (Password manager UI), [`init.sql`](https://github.com/ff897794-maker/safepass-projet-studi/blob/master/init.sql) (Database schema)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser client"]
  node_web_ui["Password manager UI<br/>[index.html]"]
  node_client_logic["Client interactions<br/>[script.js]"]
  node_password_generator["Password generator<br/>[script.js]"]
  node_theme["Theme toggle<br/>[script.js]"]
end

subgraph group_backend["API and access"]
  node_auth_api["Authentication routes<br/>[server.js]"]
  node_vault_api["Vault routes<br/>[server.js]"]
  node_token_guard["JWT protection<br/>[server.js]"]
end

subgraph group_security_storage["Security and storage"]
  node_password_crypto["Credential encryption<br/>[crypto.js]"]
  node_password_hashing["Password hashing<br/>[server.js]"]
  node_jwt_service["JWT signing<br/>[server.js]"]
  node_postgres[("PostgreSQL")]
  node_schema["Database schema<br/>[init.sql]"]
end

node_user(("User"))
node_browser_storage[("Browser local storage")]

node_user -->|"uses"| node_web_ui
node_web_ui -->|"runs"| node_client_logic
node_client_logic -->|"logs in"| node_auth_api
node_client_logic -->|"manages entries"| node_vault_api
node_client_logic -->|"generates with"| node_password_generator
node_client_logic -->|"toggles"| node_theme
node_client_logic -->|"stores token and theme"| node_browser_storage
node_auth_api -->|"hashes and checks"| node_password_hashing
node_auth_api -->|"reads and writes users"| node_postgres
node_auth_api -->|"signs token"| node_jwt_service
node_vault_api -->|"requires"| node_token_guard
node_vault_api -->|"reads and writes entries"| node_postgres
node_vault_api -->|"encrypts and decrypts"| node_password_crypto
node_token_guard -->|"verifies token"| node_jwt_service
node_schema -.->|"defines schema"| node_postgres

click node_web_ui "https://github.com/ff897794-maker/safepass-projet-studi/blob/master/public/index.html"
click node_client_logic "https://github.com/ff897794-maker/safepass-projet-studi/blob/master/public/script.js"
click node_password_generator "https://github.com/ff897794-maker/safepass-projet-studi/blob/master/public/script.js"
click node_theme "https://github.com/ff897794-maker/safepass-projet-studi/blob/master/public/script.js"
click node_auth_api "https://github.com/ff897794-maker/safepass-projet-studi/blob/master/server.js"
click node_vault_api "https://github.com/ff897794-maker/safepass-projet-studi/blob/master/server.js"
click node_token_guard "https://github.com/ff897794-maker/safepass-projet-studi/blob/master/server.js"
click node_password_crypto "https://github.com/ff897794-maker/safepass-projet-studi/blob/master/utils/crypto.js"
click node_password_hashing "https://github.com/ff897794-maker/safepass-projet-studi/blob/master/server.js"
click node_jwt_service "https://github.com/ff897794-maker/safepass-projet-studi/blob/master/server.js"
click node_schema "https://github.com/ff897794-maker/safepass-projet-studi/blob/master/init.sql"

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_web_ui,node_client_logic,node_password_generator,node_theme,node_user toneBlue
class node_auth_api,node_vault_api,node_token_guard,node_browser_storage toneAmber
class node_password_crypto,node_password_hashing,node_jwt_service,node_postgres,node_schema toneMint
```

## Components

### Browser client

- [Password manager UI](https://github.com/ff897794-maker/safepass-projet-studi/blob/master/public/index.html): `public/index.html`
- [Client interactions](https://github.com/ff897794-maker/safepass-projet-studi/blob/master/public/script.js): `public/script.js`
- [Password generator](https://github.com/ff897794-maker/safepass-projet-studi/blob/master/public/script.js): `public/script.js`
- [Theme toggle](https://github.com/ff897794-maker/safepass-projet-studi/blob/master/public/script.js): `public/script.js`

### API and access

- [Authentication routes](https://github.com/ff897794-maker/safepass-projet-studi/blob/master/server.js): `server.js`
- [Vault routes](https://github.com/ff897794-maker/safepass-projet-studi/blob/master/server.js): `server.js`
- [JWT protection](https://github.com/ff897794-maker/safepass-projet-studi/blob/master/server.js): `server.js`

### Security and storage

- [Credential encryption](https://github.com/ff897794-maker/safepass-projet-studi/blob/master/utils/crypto.js): `utils/crypto.js`
- [Password hashing](https://github.com/ff897794-maker/safepass-projet-studi/blob/master/server.js): `server.js`
- [JWT signing](https://github.com/ff897794-maker/safepass-projet-studi/blob/master/server.js): `server.js`
- **PostgreSQL**
- [Database schema](https://github.com/ff897794-maker/safepass-projet-studi/blob/master/init.sql): `init.sql`

### Other components

- **User**
- **Browser local storage**

## Connections

- User → Password manager UI: uses
- Password manager UI → Client interactions: runs
- Client interactions → Authentication routes: logs in (evidence: `public/script.js`)
- Client interactions → Vault routes: manages entries (evidence: `public/script.js`)
- Client interactions → Password generator: generates with (evidence: `public/script.js`)
- Client interactions → Theme toggle: toggles (evidence: `public/script.js`)
- Client interactions → Browser local storage: stores token and theme (evidence: `public/script.js`)
- Authentication routes → Password hashing: hashes and checks (evidence: `server.js`)
- Authentication routes → PostgreSQL: reads and writes users (evidence: `server.js`)
- Authentication routes → JWT signing: signs token (evidence: `server.js`)
- Vault routes → JWT protection: requires (evidence: `server.js`)
- Vault routes → PostgreSQL: reads and writes entries (evidence: `server.js`)
- Vault routes → Credential encryption: encrypts and decrypts (evidence: `server.js`)
- JWT protection → JWT signing: verifies token (evidence: `server.js`)
- Database schema → PostgreSQL: defines schema
