How seanhao/jobboard works
Project type and purpose
• This is a full-stack web application (“人力銀行網站”) built on Node.js using the Koa framework for the backend and MongoDB as the datastore.
• It provides job posting CRUD, address lookups via Google Maps API, article search/comments, OAuth (Facebook/Google) login, and role-based account permissions.
File-structure analysis
• Top-level entry: app.js
• config/: app initialization and environment settings
• routes/: route definitions (admin_route.js, route.js)
• controls/: controller layer (subfolders for admin vs. app/user flows)
• models/: data schemas and MongoDB access logic
• views/: HTML templates (admin & app views)
• public/: static assets (Bootstrap/AdminLTE theme, JS/CSS plugins, images)
This follows an MVC-style pattern:
• Models (models/)
• Controllers (controls/) invoked by Routes (routes/)
• Views (views/) rendered server-side
• Static resource serving from public/
Key README insights
• Backend: Koa (Node.js)
• Datastore: MongoDB
• External integrations: Google Maps API, OAuth providers
• Core features: job management, search, commenting, multi-provider sign-in, RBAC
Main components
a. Client layer (Web browser)
• Requests HTML views & static assets
• Forms/JS calls to REST endpoints
b. Static asset layer (public/)
• CSS/JS/theme served by Koa’s static middleware
c. Application server (Koa app)
• app.js (entry)
• config/init & config/config.js (bootstrapping, environment)
• routes/* → map URL → controls/*
• controls/admin & controls/app (business logic)
• models/models.js (MongoDB schemas & queries)
d. Database (MongoDB)
e. External services
• Google Maps API (geocoding, maps)
• OAuth providers (Facebook, Google)
Relationships and interactions
• Browser → HTTP GET/POST → Koa server
• Koa server routes → controllers → models → MongoDB (CRUD)
• Controllers call external APIs (Google Maps, OAuth flows)
• Server renders views (HTML) or returns JSON
• Browser fetches static assets (CSS, JS, plugins) in parallel
Architectural patterns & design principles
• MVC (Model, View, Controller) separation
• Single Koa process handles routing & rendering
• Static asset pipeline (public/) separate from dynamic logic
• Layered security: OAuth + role-based access in controllers
• All top-level directories as grouped components (config, routes, controls, models, views, public)
• Notes on OAuth and Google Maps integrations