# pavanck2006/pavanck2006-parttime-job-using-ai-tools architecture

> Architecture diagram of the GitHub repository pavanck2006/pavanck2006-parttime-job-using-ai-tools, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools
- Repository: https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools

## Overview

#### Purpose and Entry Points
PartTime Job is a role-based marketplace for students and catering/event owners, with administrative moderation. The active runtime is Node.js/Express, launched via `npm start`; its application bootstrap is `server.js`. It serves the browser UI and REST API, backed by MySQL. A legacy Spring Boot/H2 implementation remains represented by `src/main/resources/application.yml` and `src/main/resources/application-h2.yml`.

#### Server Composition
The Node backend is concentrated in `server.js`, with database access in `server/db.js` and chat support in `server/chat.js`. `server.js` is the API/control-plane boundary: authentication, public discovery, student, owner, admin, reports, notifications, and lifecycle actions described by the API are expected to be routed here or delegated to these server modules.

#### Identity, Roles, and Authorization
Users operate as `STUDENT`, `OWNER`, or `ADMIN`, authenticated with JWT bearer tokens and password hashes. Authorization gates role-specific portals and suspended-account restrictions. Registration additionally requires emailed six-digit verification codes, creating an SMTP integration boundary configured through `.env` / `.env.example`. Core paths: `server.js`, `.env.example`.

#### Marketplace and Job Lifecycle
Owners create and manage catering shifts; public users search open jobs; students apply; owners accept/reject applicants. Acceptance is a capacity-sensitive transition: worker limits prevent over-hiring and move jobs to `FILLED` when full. Public job views conceal exact addresses/contact data, while accepted applications unlock those fields. API and business control flow originate from `server.js`; persistence schema is `src/main/resources/schema.sql`.

#### Shift Completion, Payment, and Disputes
After attendance and completion, owners record on-spot payment as `PAID`; students confirm receipt as `CONFIRMED`. Users can submit payment, conduct, fake-job, and location complaints; admins resolve them. Notifications and audit records preserve event visibility and traceability. Database-level entity definitions and seeded lifecycle examples are in `src/main/resources/schema.sql` and `src/main/resources/data.sql`.

#### Persistence and Initialization
MySQL 8+ is the current production datastore, accessed through promise-based `mysql2` infrastructure in `server/db.js`. On startup, schema initialization runs `src/main/resources/schema.sql`; optional duplicate-safe demo seeding runs `src/main/resources/data.sql`. H2 configuration exists only for the legacy Java/Spring run mode under `src/main/resources/application-h2.yml`.

#### Browser Client and API Boundary
The frontend is static HTML/CSS/ES modules served from `src/main/resources/static/index.html`. `src/main/resources/static/js/api.js` centralizes HTTP/API interaction, while role and cross-cutting screens are split across `auth.js`, `student.js`, `owner.js`, `admin.js`, `chat.js`, and `notifications.js`. The client holds JWT-authenticated API interactions; server endpoints remain the enforcement boundary.

#### External Services and Runtimes
Material dependencies are Node.js 18+, Express, MySQL, JWT, BCrypt, and SMTP email delivery. Bootstrap assets and custom styling support the static UI. Maven/Spring Boot/H2 remains a separate legacy execution path rather than the primary backend stack. Core manifests: `package.json`, `server.js`, `src/main/resources/application.yml`.

Main entry points: [`server.js`](https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/server.js) (Express API server), [`src/main/resources/static/js/api.js`](https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/src/main/resources/static/js/api.js) (API client), [`src/main/resources/static/index.html`](https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/src/main/resources/static/index.html) (Static UI shell), [`server/db.js`](https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/server/db.js) (MySQL access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_node_runtime["Node.js runtime"]
  node_package["Node package<br/>manifest<br/>[package.json]"]
  node_server["Express API server<br/>API and control plane<br/>[server.js]"]
  node_db["MySQL access<br/>mysql2 data layer<br/>[db.js]"]
  node_server_chat["Chat support<br/>server module<br/>[chat.js]"]
  node_auth{{"JWT role authorization<br/>security boundary<br/>[server.js]"}}
  node_marketplace["Job lifecycle<br/>domain workflow<br/>[server.js]"]
  node_smtp{{"SMTP email<br/>external service<br/>[.env.example]"}}
end

subgraph group_browser_client["Browser client"]
  node_static_shell["Static UI shell<br/>HTML entry<br/>[index.html]"]
  node_api_client["API client<br/>browser HTTP layer<br/>[api.js]"]
  node_role_screens["Role screens<br/>browser modules<br/>[auth.js]"]
end

subgraph group_persistence["Persistence"]
  node_mysql[("MySQL 8+<br/>production datastore")]
  node_schema["Schema initialization<br/>SQL schema<br/>[schema.sql]"]
  node_seed["Demo seed data<br/>SQL seed<br/>[data.sql]"]
end

subgraph group_legacy_runtime["Legacy Java runtime"]
  node_spring_config["Spring Boot config<br/>legacy configuration<br/>[application.yml]"]
  node_h2_config["H2 profile<br/>legacy configuration<br/>[application-h2.yml]"]
end

node_package -->|"npm start"| node_server
node_server -->|"authenticates and authorizes"| node_auth
node_server -->|"drives workflows"| node_marketplace
node_server -->|"queries"| node_db
node_server -->|"delegates chat"| node_server_chat
node_auth -->|"sends verification codes"| node_smtp
node_db -->|"mysql2"| node_mysql
node_schema -->|"initializes"| node_mysql
node_seed -.->|"optionally seeds"| node_mysql
node_static_shell -->|"loads"| node_api_client
node_static_shell -->|"loads"| node_role_screens
node_role_screens -->|"uses"| node_api_client
node_api_client -->|"JWT REST requests"| node_server
node_spring_config -.->|"legacy profile"| node_h2_config

click node_package "https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/package.json"
click node_server "https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/server.js"
click node_db "https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/server/db.js"
click node_server_chat "https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/server/chat.js"
click node_auth "https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/server.js"
click node_marketplace "https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/server.js"
click node_smtp "https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/.env.example"
click node_static_shell "https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/src/main/resources/static/index.html"
click node_api_client "https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/src/main/resources/static/js/api.js"
click node_role_screens "https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/src/main/resources/static/js/auth.js"
click node_schema "https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/src/main/resources/schema.sql"
click node_seed "https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/src/main/resources/data.sql"
click node_spring_config "https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/src/main/resources/application.yml"
click node_h2_config "https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/src/main/resources/application-h2.yml"

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_package,node_server,node_db,node_server_chat,node_auth,node_marketplace,node_smtp toneBlue
class node_static_shell,node_api_client,node_role_screens toneAmber
class node_mysql,node_schema,node_seed toneMint
class node_spring_config,node_h2_config toneRose
```

## Components

### Node.js runtime

Active application stack.

- [Node package](https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/package.json): manifest · Defines the npm start entry point and Node dependencies. · `package.json`
- [Express API server](https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/server.js): API and control plane · Serves the UI and enforces marketplace, role, and lifecycle APIs. · `server.js`
- [MySQL access](https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/server/db.js): mysql2 data layer · Promise-based database connectivity. · `server/db.js`
- [Chat support](https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/server/chat.js): server module · `server/chat.js`
- [JWT role authorization](https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/server.js): security boundary · Authenticates users and gates STUDENT, OWNER, ADMIN, and suspension rules. · `server.js`
- [Job lifecycle](https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/server.js): domain workflow · Applications, capacity-based acceptance, completion, payment, and disputes. · `server.js`
- [SMTP email](https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/.env.example): external service · Delivers six-digit registration verification codes. · `.env.example`

### Browser client

Static role-based user interface.

- [Static UI shell](https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/src/main/resources/static/index.html): HTML entry · `src/main/resources/static/index.html`
- [API client](https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/src/main/resources/static/js/api.js): browser HTTP layer · Centralizes JWT-authenticated API calls. · `src/main/resources/static/js/api.js`
- [Role screens](https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/src/main/resources/static/js/auth.js): browser modules · Authentication, student, owner, admin, chat, and notification views. · `src/main/resources/static/js/auth.js`

### Persistence

Current MySQL data and initialization.

- **MySQL 8+**: production datastore · Stores users, jobs, applications, payments, complaints, notifications, and audit records.
- [Schema initialization](https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/src/main/resources/schema.sql): SQL schema · Initializes the current database schema at startup. · `src/main/resources/schema.sql`
- [Demo seed data](https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/src/main/resources/data.sql): SQL seed · Optional duplicate-safe lifecycle examples. · `src/main/resources/data.sql`

### Legacy Java runtime

Separate Spring Boot/H2 execution path.

- [Spring Boot config](https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/src/main/resources/application.yml): legacy configuration · `src/main/resources/application.yml`
- [H2 profile](https://github.com/pavanck2006/pavanck2006-parttime-job-using-ai-tools/blob/main/src/main/resources/application-h2.yml): legacy configuration · Enables the legacy H2 run mode. · `src/main/resources/application-h2.yml`

## Connections

- Node package → Express API server: npm start
- Express API server → JWT role authorization: authenticates and authorizes
- Express API server → Job lifecycle: drives workflows
- Express API server → MySQL access: queries
- Express API server → Chat support: delegates chat
- JWT role authorization → SMTP email: sends verification codes
- MySQL access → MySQL 8+: mysql2
- Schema initialization → MySQL 8+: initializes
- Demo seed data → MySQL 8+: optionally seeds
- Static UI shell → API client: loads
- Static UI shell → Role screens: loads
- Role screens → API client: uses
- API client → Express API server: JWT REST requests
- Spring Boot config → H2 profile: legacy profile
