Skip to content
forms-raw_singleitemedit-icon
navigation
modification_btn
docs
messages
flatprojectmap.handlebars
Main Application
modificationbutton
docs_htmltables.handlebars

Main Application

docs_html.handlebars
documentation.handlebars

Main Application

This section documents the core ShiftBulk web application that hosts plugins (e.g., Lynx/Costing), documentation pages, and navigation. It describes architecture, routing, UI conventions, and integration points. This fragment is designed for inclusion in your existing Handlebars layout — it intentionally omits <head> and <body> tags.


1. Overview

The Main Application provides the runtime shell for modules and plugins. It exposes shared middleware, a consistent layout, authentication, left-hand navigation panels, and partials registration. Feature areas are mounted under dedicated routes (e.g., /lynx for the costing system) and documented using static, non-interactive HTML fragments.

  • Server: Node.js + Express
  • Templating: Handlebars (partials & layouts registered at startup)
  • Database: MongoDB (via Mongoose), where applicable
  • UI Framework: Bootstrap 5 (or equivalent) for consistent styling

2. Architecture

The application is a layered Express stack. Core responsibilities are centralised while plugins encapsulate domain features.

Layer Purpose
HTTP & Middleware Security headers, request parsing, session/cookie handling, logging.
Routing Top-level routers mount feature modules (e.g., plugins/lynx).
Views Handlebars layout + partials render static documentation and UI pages.
Data Access Mongoose models (where present) encapsulate persistence and validation.
Plugins Self-contained feature units providing routes, controllers, and partials.

3. Routing

Routes are grouped by feature. Static documentation fragments are rendered via server routes without client-side interactivity.

PathDescription
/Landing layout, left navigation, and entry points to modules.
/docsDocumentation index composed from Handlebars partials.
/lynxLynx (Costing System) UI and API mount point.
/api/*JSON endpoints (module-specific under their routers).

4. UI Conventions

  • Left Navigation: All navigation panels are left-aligned to match site guidelines.
  • No Embedded Functionality in Docs: Documentation fragments must avoid live forms, accordions, or scripts.
  • Accessibility: Use semantic headings (h1–h3), table headers, and ARIA labels where appropriate.
  • Images: Prefer static images or base64 thumbnails when illustrating components.

5. Plugin Integration

Plugins register their own routes and optional partials. Example shows mounting the Lynx plugin (Costing System) under the main app.

// app.js (excerpt)
                    const express = require('express');
                    const app = express();
                    
                    // Register partials
                    partialsDir.push('./plugins/lynx/views/partials');
                    
                    // Mount plugins
                    const lynx = require('./plugins/lynx');
                    app.use('/', lynx); // UI and /api routes provided by the plugin

6. Data Flow

  1. User navigates via left menu to a feature page (e.g., Task List).
  2. Server renders a Handlebars template with any required, non-interactive documentation fragments.
  3. For data CRUD pages (outside of docs), controllers load models and format view models.
  4. APIs (/api/*) handle JSON operations and trigger any required recomputation.

Navigation is implemented as vertical panels. Keep the structure minimal and declarative.

<nav class="left-nav">
                      <ul>
                        <li><a href="/lynx">Tasks</a></li>
                        <li><a href="/lynx/projects">Projects</a></li>
                        <li><a href="/lynx/proposals">Proposals</a></li>
                        <li><a href="/lynx/reports">Reports</a></li>
                      </ul>
                    </nav>

8. Security & Roles

  • Protect sensitive routes with middleware (auth, role checks).
  • Prefer server-side rendering for documentation to avoid exposing internals.
  • Sanitise any user-supplied content before injecting into templates.

9. Environment & Configuration

VariablePurpose
MONGODB_URIMongoDB connection string for models.
SESSION_SECRETCookie/session encryption key.
PORTExpress server port.

10. Deployment Notes

  • Build as a standard Node/Express service; ensure partials are located and registered on boot.
  • Serve over HTTPS with HSTS where possible.
  • Enable gzip/brotli compression and cache headers for static assets.

11. Versioning & Change Control

Track feature flags and plugin versions. Update documentation fragments alongside code changes for consistency.

Appendix: Route Table (Summary)

MethodPathHandler / Notes
GET/Main layout & landing content
GET/docsStatic documentation index
GET/lynxCosting System UI landing
POST/lynx/tasksCreate task (UI form – outside of docs)
GET/api/projects/:id/catalogsProject-scoped catalogues

Note: Documentation fragments intentionally avoid embedded interactive elements (accordions, forms, scripts). Use the application’s existing layout and routes to render this content.

modal1
modal2
modal3
docs_javascript
new_issue_button.handlebars
shortcut_edit