# sanjaykolapkar02-sys/pactum architecture

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

- Interactive diagram: https://gitdiagram.com/sanjaykolapkar02-sys/pactum
- Repository: https://github.com/sanjaykolapkar02-sys/pactum

## Overview

PACTUM is a testnet accountability-challenge product: users authenticate, discover or create challenges, join with a wallet, submit evidence, review peers’ submissions, and view outcomes. The sampled runtime shows frontend routing and API flows, plus backend challenge, submission, vote, and user services backed by MongoDB. The README describes device verification, oracle decisions, and on-chain settlement as product capabilities, but the supplied excerpts do not establish their end-to-end implementation; those links are therefore marked optional or left unconnected.

Main entry points: [`frontend/src/App.tsx`](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/App.tsx) (Application routes), [`backend/src/app.ts`](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/app.ts) (Express API), [`frontend/src/services/apiClient.ts`](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/services/apiClient.ts) (API client), [`backend/src/modules/challenges/challenge.service.ts`](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/challenges/challenge.service.ts) (Challenge service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Participant experience"]
  node_app["Application routes<br/>[App.tsx]"]
  node_browse["Browse challenges"]
  node_create["Create challenge"]
  node_details["Challenge details"]
  node_workspace["Challenge workspace"]
  node_results["Challenge results"]
  node_dashboard["Dashboard<br/>[DashboardPage.tsx]"]
  node_apiclient["API client<br/>[apiClient.ts]"]
end

subgraph group_identity["Identity and wallet"]
  node_privy["Privy authentication<br/>[PrivyProvider.tsx]"]
  node_users["User sync<br/>[user.service.ts]"]
end

subgraph group_challenge["Challenge lifecycle"]
  node_challengeapi["Challenge API"]
  node_challengecontroller["Challenge handlers"]
  node_challengeservice["Challenge service"]
  node_challengemodel[("Challenge records<br/>[challenge.model.ts]")]
  node_participants[("Participant records")]
end

subgraph group_evidence["Evidence and review"]
  node_submissionapi["Submission API"]
  node_submissioncontroller["Submission handlers"]
  node_submissionservice["Submission service"]
  node_submissions[("Evidence records")]
  node_voteservice["Peer review service<br/>[vote.service.ts]"]
  node_votes[("Vote records<br/>[vote.model.ts]")]
end

subgraph group_platform["API and persistence"]
  node_backend["Express API<br/>[app.ts]"]
  node_databaseconfig["Database connection<br/>[database.ts]"]
  node_mongodb[("MongoDB")]
  node_chainservice["Blockchain service"]
  node_contract["Challenge contract<br/>[contract.config.ts]"]
end

node_participant(("Participant"))
node_monad{{"Monad network"}}

node_participant -->|"uses"| node_app
node_app -->|"authenticates through"| node_privy
node_app -->|"routes to"| node_browse
node_app -->|"routes to"| node_create
node_app -->|"routes to"| node_details
node_app -->|"routes to"| node_workspace
node_app -->|"routes to"| node_results
node_app -->|"routes to"| node_dashboard
node_app -->|"sets auth token"| node_apiclient
node_create -->|"uses"| node_apiclient
node_workspace -->|"uses"| node_apiclient
node_apiclient -->|"requests API"| node_backend
node_backend -->|"mounts routes"| node_challengeapi
node_backend -->|"mounts routes"| node_submissionapi
node_challengeapi -->|"dispatches"| node_challengecontroller
node_challengecontroller -->|"calls"| node_challengeservice
node_challengeservice -->|"reads and writes"| node_challengemodel
node_challengeservice -->|"manages membership"| node_participants
node_submissionapi -->|"dispatches"| node_submissioncontroller
node_submissioncontroller -->|"calls"| node_submissionservice
node_submissioncontroller -->|"calls"| node_voteservice
node_submissionservice -->|"reads and writes"| node_submissions
node_voteservice -->|"reads and writes"| node_votes
node_backend -->|"connects database"| node_databaseconfig
node_databaseconfig -->|"connects"| node_mongodb
node_users -->|"persists profiles"| node_mongodb
node_chainservice -.->|"configures"| node_contract
node_contract -.->|"targets"| node_monad
node_participant -.->|"stakes and settles"| node_monad

click node_app "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/App.tsx"
click node_browse "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/pages/BrowseChallengesPage.tsx"
click node_create "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/pages/CreateChallengePage.tsx"
click node_details "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/pages/ChallengeDetailsPage.tsx"
click node_workspace "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/pages/ChallengeWorkspacePage.tsx"
click node_results "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/pages/ChallengeResultsPage.tsx"
click node_dashboard "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/pages/DashboardPage.tsx"
click node_apiclient "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/services/apiClient.ts"
click node_privy "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/providers/PrivyProvider.tsx"
click node_users "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/users/user.service.ts"
click node_challengeapi "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/challenges/challenge.routes.ts"
click node_challengecontroller "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/challenges/challenge.controller.ts"
click node_challengeservice "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/challenges/challenge.service.ts"
click node_challengemodel "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/challenges/challenge.model.ts"
click node_participants "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/participants/participant.model.ts"
click node_submissionapi "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/submissions/submission.routes.ts"
click node_submissioncontroller "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/submissions/submission.controller.ts"
click node_submissionservice "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/submissions/submission.service.ts"
click node_submissions "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/submissions/submission.model.ts"
click node_voteservice "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/votes/vote.service.ts"
click node_votes "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/votes/vote.model.ts"
click node_backend "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/app.ts"
click node_databaseconfig "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/config/database.ts"
click node_chainservice "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/blockchain/blockchain.service.ts"
click node_contract "https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/blockchain/contract.config.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_app,node_browse,node_create,node_details,node_workspace,node_results,node_dashboard,node_apiclient toneBlue
class node_privy,node_users toneAmber
class node_challengeapi,node_challengecontroller,node_challengeservice,node_challengemodel,node_participants toneMint
class node_submissionapi,node_submissioncontroller,node_submissionservice,node_submissions,node_voteservice,node_votes toneRose
class node_backend,node_databaseconfig,node_mongodb,node_chainservice,node_contract,node_participant,node_monad toneIndigo
```

## Components

### Participant experience

- [Application routes](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Browse challenges](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/pages/BrowseChallengesPage.tsx): `frontend/src/pages/BrowseChallengesPage.tsx`
- [Create challenge](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/pages/CreateChallengePage.tsx): `frontend/src/pages/CreateChallengePage.tsx`
- [Challenge details](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/pages/ChallengeDetailsPage.tsx): `frontend/src/pages/ChallengeDetailsPage.tsx`
- [Challenge workspace](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/pages/ChallengeWorkspacePage.tsx): `frontend/src/pages/ChallengeWorkspacePage.tsx`
- [Challenge results](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/pages/ChallengeResultsPage.tsx): `frontend/src/pages/ChallengeResultsPage.tsx`
- [Dashboard](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/pages/DashboardPage.tsx): `frontend/src/pages/DashboardPage.tsx`
- [API client](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/services/apiClient.ts): `frontend/src/services/apiClient.ts`

### Identity and wallet

- [Privy authentication](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/frontend/src/providers/PrivyProvider.tsx): `frontend/src/providers/PrivyProvider.tsx`
- [User sync](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/users/user.service.ts): `backend/src/modules/users/user.service.ts`

### Challenge lifecycle

- [Challenge API](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/challenges/challenge.routes.ts): `backend/src/modules/challenges/challenge.routes.ts`
- [Challenge handlers](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/challenges/challenge.controller.ts): `backend/src/modules/challenges/challenge.controller.ts`
- [Challenge service](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/challenges/challenge.service.ts): `backend/src/modules/challenges/challenge.service.ts`
- [Challenge records](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/challenges/challenge.model.ts): `backend/src/modules/challenges/challenge.model.ts`
- [Participant records](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/participants/participant.model.ts): `backend/src/modules/participants/participant.model.ts`

### Evidence and review

- [Submission API](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/submissions/submission.routes.ts): `backend/src/modules/submissions/submission.routes.ts`
- [Submission handlers](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/submissions/submission.controller.ts): `backend/src/modules/submissions/submission.controller.ts`
- [Submission service](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/submissions/submission.service.ts): `backend/src/modules/submissions/submission.service.ts`
- [Evidence records](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/submissions/submission.model.ts): `backend/src/modules/submissions/submission.model.ts`
- [Peer review service](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/votes/vote.service.ts): `backend/src/modules/votes/vote.service.ts`
- [Vote records](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/votes/vote.model.ts): `backend/src/modules/votes/vote.model.ts`

### API and persistence

- [Express API](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [Database connection](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/config/database.ts): `backend/src/config/database.ts`
- **MongoDB**
- [Blockchain service](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/blockchain/blockchain.service.ts): `backend/src/modules/blockchain/blockchain.service.ts`
- [Challenge contract](https://github.com/sanjaykolapkar02-sys/pactum/blob/main/backend/src/modules/blockchain/contract.config.ts): `backend/src/modules/blockchain/contract.config.ts`

### Other components

- **Participant**
- **Monad network**

## Connections

- Participant → Application routes: uses (evidence: `frontend/src/App.tsx`)
- Application routes → Privy authentication: authenticates through (evidence: `frontend/src/main.tsx`)
- Application routes → Browse challenges: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Create challenge: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Challenge details: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Challenge workspace: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Challenge results: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → API client: sets auth token (evidence: `frontend/src/App.tsx`)
- Create challenge → API client: uses (evidence: `frontend/src/pages/CreateChallengePage.tsx`)
- Challenge workspace → API client: uses (evidence: `frontend/src/pages/ChallengeWorkspacePage.tsx`)
- API client → Express API: requests API
- Express API → Challenge API: mounts routes (evidence: `backend/src/app.ts`)
- Express API → Submission API: mounts routes (evidence: `backend/src/app.ts`)
- Challenge API → Challenge handlers: dispatches (evidence: `backend/src/modules/challenges/challenge.routes.ts`)
- Challenge handlers → Challenge service: calls (evidence: `backend/src/modules/challenges/challenge.controller.ts`)
- Challenge service → Challenge records: reads and writes (evidence: `backend/src/modules/challenges/challenge.service.ts`)
- Challenge service → Participant records: manages membership (evidence: `backend/src/modules/challenges/challenge.service.ts`)
- Submission API → Submission handlers: dispatches (evidence: `backend/src/modules/submissions/submission.routes.ts`)
- Submission handlers → Submission service: calls (evidence: `backend/src/modules/submissions/submission.controller.ts`)
- Submission handlers → Peer review service: calls (evidence: `backend/src/modules/submissions/submission.controller.ts`)
- Submission service → Evidence records: reads and writes (evidence: `backend/src/modules/submissions/submission.service.ts`)
- Peer review service → Vote records: reads and writes (evidence: `backend/src/modules/votes/vote.service.ts`)
- Express API → Database connection: connects database (evidence: `backend/src/app.ts`)
- Database connection → MongoDB: connects
- User sync → MongoDB: persists profiles (evidence: `backend/src/modules/users/user.service.ts`)
- Blockchain service → Challenge contract: configures
- Challenge contract → Monad network: targets
- Participant → Monad network: stakes and settles
