How pavanck2006/pavanck2006-parttime-job-using-ai-tools works
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 Express API server · api.js API client · index.html Static UI shell · db.js MySQL access
Components 15
Node.js runtime
Active application stack.
- Node package · Defines the npm start entry point and Node dependencies.
package.json - Express API server · Serves the UI and enforces marketplace, role, and lifecycle APIs.
server.js - MySQL access · Promise-based database connectivity.
server/db.js - Chat support
server/chat.js - JWT role authorization · Authenticates users and gates STUDENT, OWNER, ADMIN, and suspension rules.
server.js - Job lifecycle · Applications, capacity-based acceptance, completion, payment, and disputes.
server.js - SMTP email · Delivers six-digit registration verification codes.
.env.example
Browser client
Static role-based user interface.
- Static UI shell
src/main/resources/static/index.html - API client · Centralizes JWT-authenticated API calls.
src/main/resources/static/js/api.js - Role screens · Authentication, student, owner, admin, chat, and notification views.
src/main/resources/static/js/auth.js
Persistence
Current MySQL data and initialization.
- MySQL 8+ · Stores users, jobs, applications, payments, complaints, notifications, and audit records.
- Schema initialization · Initializes the current database schema at startup.
src/main/resources/schema.sql - Demo seed data · Optional duplicate-safe lifecycle examples.
src/main/resources/data.sql
Legacy Java runtime
Separate Spring Boot/H2 execution path.
- Spring Boot config
src/main/resources/application.yml - H2 profile · Enables the legacy H2 run mode.
src/main/resources/application-h2.yml
Connections 14
- 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