# amit-tripathii/digital-will-system architecture

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

- Interactive diagram: https://gitdiagram.com/amit-tripathii/digital-will-system
- Repository: https://github.com/amit-tripathii/digital-will-system

## Overview

DigiWill is a digital-legacy web application: users authenticate, maintain an encrypted asset vault and nominee list, and confirm activity; scheduled inactivity checks warn the owner or notify nominees. The graph follows the documented browser-to-API flow and the sampled server, route, and job calls. The README documents major features whose full implementations were not sampled; those are represented at their supported module paths. Some frontend-to-API links rely on SOURCE INDEX references rather than displayed page code.

Main entry points: [`backend/server.js`](https://github.com/amit-tripathii/digital-will-system/blob/main/backend/server.js) (Express server), [`frontend/src/services/api.js`](https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/services/api.js) (API client), [`backend/routes/assets.js`](https://github.com/amit-tripathii/digital-will-system/blob/main/backend/routes/assets.js) (Asset routes), [`backend/routes/auth.js`](https://github.com/amit-tripathii/digital-will-system/blob/main/backend/routes/auth.js) (Auth routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["Route app<br/>[App.jsx]"]
  node_api["API client<br/>[api.js]"]
  node_layout["Dashboard shell"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_settings["Settings<br/>[Settings.jsx]"]
  node_securitylog["Security log<br/>[SecurityLog.jsx]"]
end

subgraph group_identity["Authentication"]
  node_protected["Route guard<br/>[ProtectedRoute.jsx]"]
  node_login["Login and register<br/>[Login.jsx]"]
  node_authroutes["Auth routes<br/>[auth.js]"]
  node_authmw["JWT middleware<br/>[auth.js]"]
  node_authcontroller["Auth controller<br/>[authController.js]"]
end

subgraph group_legacy["Legacy management"]
  node_assetsui["Asset vault<br/>[AssetVault.jsx]"]
  node_nomineesui["Nominee management<br/>[Nominees.jsx]"]
  node_switchui["Switch controls<br/>[DeadManSwitch.jsx]"]
  node_assetroutes["Asset routes<br/>[assets.js]"]
  node_encryption["Password encryption<br/>[encryption.js]"]
  node_nomineeroutes["Nominee routes<br/>[nominees.js]"]
  node_deadmanroutes["Activity confirmation<br/>[deadman.js]"]
  node_scheduler["Inactivity scheduler<br/>[cronJobs.js]"]
end

subgraph group_runtime["Backend runtime"]
  node_server["Express server<br/>[server.js]"]
  node_activity["Activity tracking<br/>[activity.js]"]
end

subgraph group_persistence["Persistence and email"]
  node_users[("User records<br/>[User.js]")]
  node_assets[("Asset records<br/>[Asset.js]")]
  node_nominees[("Nominee records<br/>[Nominee.js]")]
  node_db["MongoDB connection<br/>[db.js]"]
  node_email["Email sender<br/>[sendEmail.js]"]
end

node_browser(("User"))
node_mailservice["Email service"]

node_browser -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"guards pages"| node_protected
node_protected -.->|"allows access"| node_dashboard
node_browser -->|"requests data"| node_api
node_api -->|"calls REST API"| node_server
node_dashboard -->|"uses"| node_api
node_assetsui -->|"uses"| node_api
node_nomineesui -->|"uses"| node_api
node_switchui -->|"uses"| node_api
node_server -->|"mounts routes"| node_authroutes
node_server -->|"mounts routes"| node_assetroutes
node_server -->|"mounts routes"| node_nomineeroutes
node_server -->|"mounts routes"| node_deadmanroutes
node_server -->|"connects database"| node_db
node_server -->|"starts job"| node_scheduler
node_authroutes -->|"reads and writes"| node_users
node_authroutes -->|"protects profile"| node_authmw
node_authroutes -.->|"delegates"| node_authcontroller
node_assetroutes -->|"authenticates"| node_authmw
node_assetroutes -->|"updates activity"| node_activity
node_assetroutes -->|"reads and writes"| node_assets
node_assetroutes -->|"encrypts passwords"| node_encryption
node_activity -->|"updates timestamp"| node_users
node_nomineeroutes -->|"authenticates"| node_authmw
node_nomineeroutes -->|"tracks activity"| node_activity
node_nomineeroutes -->|"reads and writes"| node_nominees
node_deadmanroutes -->|"authenticates"| node_authmw
node_deadmanroutes -->|"updates activity"| node_users
node_scheduler -->|"checks inactivity"| node_users
node_scheduler -->|"finds beneficiaries"| node_nominees
node_scheduler -->|"sends notifications"| node_email
node_email -->|"sends mail"| node_mailservice

click node_app "https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/App.jsx"
click node_protected "https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/components/auth/ProtectedRoute.jsx"
click node_login "https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/pages/Login.jsx"
click node_api "https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/services/api.js"
click node_layout "https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/components/layout/DashboardLayout.jsx"
click node_dashboard "https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/pages/Dashboard.jsx"
click node_assetsui "https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/pages/AssetVault.jsx"
click node_nomineesui "https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/pages/Nominees.jsx"
click node_switchui "https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/pages/DeadManSwitch.jsx"
click node_settings "https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/pages/Settings.jsx"
click node_securitylog "https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/pages/SecurityLog.jsx"
click node_server "https://github.com/amit-tripathii/digital-will-system/blob/main/backend/server.js"
click node_authroutes "https://github.com/amit-tripathii/digital-will-system/blob/main/backend/routes/auth.js"
click node_authmw "https://github.com/amit-tripathii/digital-will-system/blob/main/backend/middleware/auth.js"
click node_authcontroller "https://github.com/amit-tripathii/digital-will-system/blob/main/backend/controllers/authController.js"
click node_assetroutes "https://github.com/amit-tripathii/digital-will-system/blob/main/backend/routes/assets.js"
click node_encryption "https://github.com/amit-tripathii/digital-will-system/blob/main/backend/utils/encryption.js"
click node_nomineeroutes "https://github.com/amit-tripathii/digital-will-system/blob/main/backend/routes/nominees.js"
click node_deadmanroutes "https://github.com/amit-tripathii/digital-will-system/blob/main/backend/routes/deadman.js"
click node_activity "https://github.com/amit-tripathii/digital-will-system/blob/main/backend/middleware/activity.js"
click node_scheduler "https://github.com/amit-tripathii/digital-will-system/blob/main/backend/utils/cronJobs.js"
click node_users "https://github.com/amit-tripathii/digital-will-system/blob/main/backend/models/User.js"
click node_assets "https://github.com/amit-tripathii/digital-will-system/blob/main/backend/models/Asset.js"
click node_nominees "https://github.com/amit-tripathii/digital-will-system/blob/main/backend/models/Nominee.js"
click node_db "https://github.com/amit-tripathii/digital-will-system/blob/main/backend/config/db.js"
click node_email "https://github.com/amit-tripathii/digital-will-system/blob/main/backend/utils/sendEmail.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_app,node_api,node_layout,node_dashboard,node_settings,node_securitylog,node_browser toneBlue
class node_protected,node_login,node_authroutes,node_authmw,node_authcontroller toneAmber
class node_assetsui,node_nomineesui,node_switchui,node_assetroutes,node_encryption,node_nomineeroutes,node_deadmanroutes,node_scheduler toneMint
class node_server,node_activity toneRose
class node_users,node_assets,node_nominees,node_db,node_email,node_mailservice toneIndigo
```

## Components

### Web application

- [Route app](https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API client](https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Dashboard shell](https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/components/layout/DashboardLayout.jsx): `frontend/src/components/layout/DashboardLayout.jsx`
- [Dashboard](https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Settings](https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/pages/Settings.jsx): `frontend/src/pages/Settings.jsx`
- [Security log](https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/pages/SecurityLog.jsx): `frontend/src/pages/SecurityLog.jsx`

### Authentication

- [Route guard](https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/components/auth/ProtectedRoute.jsx): `frontend/src/components/auth/ProtectedRoute.jsx`
- [Login and register](https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Auth routes](https://github.com/amit-tripathii/digital-will-system/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [JWT middleware](https://github.com/amit-tripathii/digital-will-system/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`
- [Auth controller](https://github.com/amit-tripathii/digital-will-system/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`

### Legacy management

- [Asset vault](https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/pages/AssetVault.jsx): `frontend/src/pages/AssetVault.jsx`
- [Nominee management](https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/pages/Nominees.jsx): `frontend/src/pages/Nominees.jsx`
- [Switch controls](https://github.com/amit-tripathii/digital-will-system/blob/main/frontend/src/pages/DeadManSwitch.jsx): `frontend/src/pages/DeadManSwitch.jsx`
- [Asset routes](https://github.com/amit-tripathii/digital-will-system/blob/main/backend/routes/assets.js): `backend/routes/assets.js`
- [Password encryption](https://github.com/amit-tripathii/digital-will-system/blob/main/backend/utils/encryption.js): `backend/utils/encryption.js`
- [Nominee routes](https://github.com/amit-tripathii/digital-will-system/blob/main/backend/routes/nominees.js): `backend/routes/nominees.js`
- [Activity confirmation](https://github.com/amit-tripathii/digital-will-system/blob/main/backend/routes/deadman.js): `backend/routes/deadman.js`
- [Inactivity scheduler](https://github.com/amit-tripathii/digital-will-system/blob/main/backend/utils/cronJobs.js): `backend/utils/cronJobs.js`

### Backend runtime

- [Express server](https://github.com/amit-tripathii/digital-will-system/blob/main/backend/server.js): `backend/server.js`
- [Activity tracking](https://github.com/amit-tripathii/digital-will-system/blob/main/backend/middleware/activity.js): `backend/middleware/activity.js`

### Persistence and email

- [User records](https://github.com/amit-tripathii/digital-will-system/blob/main/backend/models/User.js): `backend/models/User.js`
- [Asset records](https://github.com/amit-tripathii/digital-will-system/blob/main/backend/models/Asset.js): `backend/models/Asset.js`
- [Nominee records](https://github.com/amit-tripathii/digital-will-system/blob/main/backend/models/Nominee.js): `backend/models/Nominee.js`
- [MongoDB connection](https://github.com/amit-tripathii/digital-will-system/blob/main/backend/config/db.js): `backend/config/db.js`
- [Email sender](https://github.com/amit-tripathii/digital-will-system/blob/main/backend/utils/sendEmail.js): `backend/utils/sendEmail.js`

### Other components

- **User**
- **Email service**

## Connections

- User → Route app: uses (evidence: `README.md`)
- Route app → Login and register: routes to (evidence: `frontend/src/App.jsx`)
- Route app → Route guard: guards pages (evidence: `frontend/src/App.jsx`)
- Route guard → Dashboard: allows access
- User → API client: requests data (evidence: `README.md`)
- API client → Express server: calls REST API (evidence: `README.md`)
- Dashboard → API client: uses (evidence: `frontend/src/pages/Dashboard.jsx`)
- Asset vault → API client: uses (evidence: `frontend/src/pages/AssetVault.jsx`)
- Nominee management → API client: uses (evidence: `frontend/src/pages/Nominees.jsx`)
- Switch controls → API client: uses (evidence: `frontend/src/pages/DeadManSwitch.jsx`)
- Express server → Auth routes: mounts routes (evidence: `backend/server.js`)
- Express server → Asset routes: mounts routes (evidence: `backend/server.js`)
- Express server → Nominee routes: mounts routes (evidence: `backend/server.js`)
- Express server → Activity confirmation: mounts routes (evidence: `backend/server.js`)
- Express server → MongoDB connection: connects database (evidence: `backend/server.js`)
- Express server → Inactivity scheduler: starts job (evidence: `backend/server.js`)
- Auth routes → User records: reads and writes (evidence: `backend/routes/auth.js`)
- Auth routes → JWT middleware: protects profile (evidence: `backend/routes/auth.js`)
- Auth routes → Auth controller: delegates
- Asset routes → JWT middleware: authenticates (evidence: `backend/routes/assets.js`)
- Asset routes → Activity tracking: updates activity (evidence: `backend/routes/assets.js`)
- Asset routes → Asset records: reads and writes (evidence: `backend/routes/assets.js`)
- Asset routes → Password encryption: encrypts passwords (evidence: `backend/routes/assets.js`)
- Activity tracking → User records: updates timestamp (evidence: `backend/middleware/activity.js`)
- Nominee routes → JWT middleware: authenticates (evidence: `backend/routes/nominees.js`)
- Nominee routes → Activity tracking: tracks activity (evidence: `backend/routes/nominees.js`)
- Nominee routes → Nominee records: reads and writes (evidence: `backend/routes/nominees.js`)
- Activity confirmation → JWT middleware: authenticates (evidence: `backend/routes/deadman.js`)
- Activity confirmation → User records: updates activity (evidence: `backend/routes/deadman.js`)
- Inactivity scheduler → User records: checks inactivity (evidence: `backend/utils/cronJobs.js`)
- Inactivity scheduler → Nominee records: finds beneficiaries (evidence: `backend/utils/cronJobs.js`)
- Inactivity scheduler → Email sender: sends notifications (evidence: `backend/utils/cronJobs.js`)
- Email sender → Email service: sends mail (evidence: `backend/utils/sendEmail.js`)
