# madeshwar-a/freelancer-marketplace architecture

> Architecture diagram of the GitHub repository madeshwar-a/freelancer-marketplace, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/madeshwar-a/freelancer-marketplace
- Repository: https://github.com/madeshwar-a/freelancer-marketplace

## Overview

Workly is a two-sided freelancer marketplace: clients post projects, freelancers browse and bid, clients review and decide on proposals, and users communicate by chat. The Express server serves the browser UI and REST API; controllers implement the marketplace actions over a database layer, while a separately handled WebSocket path supports live messaging. The README documents the broader frontend and PostgreSQL option; sampled source confirms the server, controller, routing, and database relationships shown here.

Main entry points: [`server.js`](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/server.js) (Express server), [`config/db.js`](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/config/db.js) (Database adapter), [`routes/projects.js`](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/routes/projects.js) (Project routes), [`middleware/auth.js`](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/middleware/auth.js) (Authentication and roles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Browser experience"]
  node_browser["Marketplace UI"]
  node_frontend["Browser behavior<br/>[script.js]"]
end

subgraph group_api["API and access"]
  node_server["Express server<br/>[server.js]"]
  node_auth_routes["Auth routes<br/>[auth.js]"]
  node_project_routes["Project routes<br/>[projects.js]"]
  node_proposal_routes["Proposal routes<br/>[proposals.js]"]
  node_user_routes["User routes<br/>[users.js]"]
  node_message_routes["Message routes<br/>[messages.js]"]
  node_access["Authentication and roles<br/>[auth.js]"]
  node_validation["Request validation<br/>[validate.js]"]
end

subgraph group_marketplace["Marketplace workflows"]
  node_auth["Account and sessions<br/>[authController.js]"]
  node_projects["Project listings"]
  node_proposals["Bids and decisions"]
  node_profiles["User profiles<br/>[userController.js]"]
end

subgraph group_messaging["Messaging"]
  node_message_history["Chat history"]
  node_live_chat["Live chat delivery<br/>[server.js]"]
end

subgraph group_persistence["Persistence"]
  node_db_layer["Database adapter<br/>[db.js]"]
  node_schema["Database schema<br/>[init-db.js]"]
  node_seed["Demo data<br/>[seed-demo.js]"]
  node_database[("Marketplace database<br/>[.marketplace.db]")]
end

node_users(("Clients and freelancers"))

node_users -->|"uses"| node_browser
node_browser -->|"loads"| node_frontend
node_frontend -->|"requests API"| node_server
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_project_routes
node_server -->|"mounts"| node_proposal_routes
node_server -->|"mounts"| node_user_routes
node_server -->|"mounts"| node_message_routes
node_auth_routes -->|"dispatches"| node_auth
node_auth_routes -->|"checks session"| node_access
node_auth_routes -->|"validates signup"| node_validation
node_project_routes -->|"dispatches"| node_projects
node_project_routes -->|"updates status"| node_proposals
node_project_routes -->|"checks roles"| node_access
node_project_routes -->|"validates projects"| node_validation
node_proposal_routes -->|"dispatches"| node_proposals
node_proposal_routes -->|"checks session"| node_access
node_user_routes -->|"dispatches"| node_profiles
node_user_routes -->|"checks session"| node_access
node_message_routes -->|"dispatches"| node_message_history
node_message_routes -->|"checks session"| node_access
node_auth -->|"queries users"| node_db_layer
node_projects -->|"queries projects"| node_db_layer
node_proposals -->|"queries bids"| node_db_layer
node_profiles -->|"queries profiles"| node_db_layer
node_message_history -->|"reads messages"| node_db_layer
node_server -->|"checks health"| node_db_layer
node_server -->|"initializes"| node_schema
node_server -->|"seeds demo"| node_seed
node_schema -->|"executes schema"| node_db_layer
node_seed -->|"writes demo data"| node_db_layer
node_db_layer -.->|"reads and writes"| node_database
node_server -->|"handles upgrades"| node_live_chat
node_users -->|"sends chat"| node_live_chat

click node_browser "https://github.com/madeshwar-a/freelancer-marketplace/tree/main/public"
click node_frontend "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/public/script.js"
click node_server "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/server.js"
click node_auth_routes "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/routes/auth.js"
click node_project_routes "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/routes/projects.js"
click node_proposal_routes "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/routes/proposals.js"
click node_user_routes "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/routes/users.js"
click node_message_routes "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/routes/messages.js"
click node_access "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/middleware/auth.js"
click node_validation "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/middleware/validate.js"
click node_auth "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/controllers/authController.js"
click node_projects "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/controllers/projectController.js"
click node_proposals "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/controllers/proposalController.js"
click node_profiles "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/controllers/userController.js"
click node_message_history "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/controllers/messageController.js"
click node_live_chat "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/server.js"
click node_db_layer "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/config/db.js"
click node_schema "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/config/init-db.js"
click node_seed "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/config/seed-demo.js"
click node_database "https://github.com/madeshwar-a/freelancer-marketplace/blob/main/.marketplace.db"

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_browser,node_frontend,node_users toneBlue
class node_server,node_auth_routes,node_project_routes,node_proposal_routes,node_user_routes,node_message_routes,node_access,node_validation toneAmber
class node_auth,node_projects,node_proposals,node_profiles toneMint
class node_message_history,node_live_chat toneRose
class node_db_layer,node_schema,node_seed,node_database toneIndigo
```

## Components

### Browser experience

- [Marketplace UI](https://github.com/madeshwar-a/freelancer-marketplace/tree/main/public): `public`
- [Browser behavior](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/public/script.js): `public/script.js`

### API and access

- [Express server](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/server.js): `server.js`
- [Auth routes](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/routes/auth.js): `routes/auth.js`
- [Project routes](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/routes/projects.js): `routes/projects.js`
- [Proposal routes](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/routes/proposals.js): `routes/proposals.js`
- [User routes](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/routes/users.js): `routes/users.js`
- [Message routes](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/routes/messages.js): `routes/messages.js`
- [Authentication and roles](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/middleware/auth.js): `middleware/auth.js`
- [Request validation](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/middleware/validate.js): `middleware/validate.js`

### Marketplace workflows

- [Account and sessions](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/controllers/authController.js): `controllers/authController.js`
- [Project listings](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/controllers/projectController.js): `controllers/projectController.js`
- [Bids and decisions](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/controllers/proposalController.js): `controllers/proposalController.js`
- [User profiles](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/controllers/userController.js): `controllers/userController.js`

### Messaging

- [Chat history](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/controllers/messageController.js): `controllers/messageController.js`
- [Live chat delivery](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/server.js): `server.js`

### Persistence

- [Database adapter](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/config/db.js): `config/db.js`
- [Database schema](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/config/init-db.js): `config/init-db.js`
- [Demo data](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/config/seed-demo.js): `config/seed-demo.js`
- [Marketplace database](https://github.com/madeshwar-a/freelancer-marketplace/blob/main/.marketplace.db): `.marketplace.db`

### Other components

- **Clients and freelancers**

## Connections

- Clients and freelancers → Marketplace UI: uses (evidence: `README.md`)
- Marketplace UI → Browser behavior: loads (evidence: `README.md`)
- Browser behavior → Express server: requests API (evidence: `README.md`)
- Express server → Auth routes: mounts (evidence: `server.js`)
- Express server → Project routes: mounts (evidence: `server.js`)
- Express server → Proposal routes: mounts (evidence: `server.js`)
- Express server → User routes: mounts (evidence: `server.js`)
- Express server → Message routes: mounts (evidence: `server.js`)
- Auth routes → Account and sessions: dispatches (evidence: `routes/auth.js`)
- Auth routes → Authentication and roles: checks session (evidence: `routes/auth.js`)
- Auth routes → Request validation: validates signup (evidence: `routes/auth.js`)
- Project routes → Project listings: dispatches (evidence: `routes/projects.js`)
- Project routes → Bids and decisions: updates status (evidence: `routes/projects.js`)
- Project routes → Authentication and roles: checks roles (evidence: `routes/projects.js`)
- Project routes → Request validation: validates projects (evidence: `routes/projects.js`)
- Proposal routes → Bids and decisions: dispatches (evidence: `routes/proposals.js`)
- Proposal routes → Authentication and roles: checks session (evidence: `routes/proposals.js`)
- User routes → User profiles: dispatches (evidence: `routes/users.js`)
- User routes → Authentication and roles: checks session (evidence: `routes/users.js`)
- Message routes → Chat history: dispatches (evidence: `routes/messages.js`)
- Message routes → Authentication and roles: checks session (evidence: `routes/messages.js`)
- Account and sessions → Database adapter: queries users (evidence: `controllers/authController.js`)
- Project listings → Database adapter: queries projects (evidence: `controllers/projectController.js`)
- Bids and decisions → Database adapter: queries bids (evidence: `controllers/proposalController.js`)
- User profiles → Database adapter: queries profiles (evidence: `controllers/userController.js`)
- Chat history → Database adapter: reads messages (evidence: `controllers/messageController.js`)
- Express server → Database adapter: checks health (evidence: `server.js`)
- Express server → Database schema: initializes (evidence: `server.js`)
- Express server → Demo data: seeds demo (evidence: `server.js`)
- Database schema → Database adapter: executes schema (evidence: `config/init-db.js`)
- Demo data → Database adapter: writes demo data (evidence: `config/seed-demo.js`)
- Database adapter → Marketplace database: reads and writes
- Express server → Live chat delivery: handles upgrades (evidence: `server.js`)
- Clients and freelancers → Live chat delivery: sends chat (evidence: `README.md`)
