Browse documents

GP Data Platform + SFMS — Engineering Build Plan

Product: Atlas Data Platform + Smart Facility Management System (SFMS) Codename: Tsugumi (placeholder) Reference inspiration: ThingsBoard (open-source IoT platform) + ISO 41001 Smart FM Status: v1.0 — engineering plan handed to the team Owner: Engineering Lead (to be named) Issued: Planning document for execution

This folder contains the full Software Development Lifecycle (SDLC) plan for the GP Atlas Data Platform and Smart Facility Management System (SFMS). The plan is decomposed into 10 phases that an engineering team can pick up and execute in order. Some phases parallelize after Phase 2 (see §Sequencing below).


1. Product summary

A multi-tenant Data Platform + SFMS that ingests building telemetry and operational data (BMS, IoT, work orders, asset ledger, documents) into a governed canonical schema, exposes it through:

  • Customisable drag-and-drop dashboards (per-user, theme-aware, with TV-wall and war-room modes)
  • Modular widget library drawn from every module (asset, work order, telemetry, AI, workflow)
  • OpenAPI 3.x developer API with Swagger UI / Scalar for third-party integration
  • AI Second Brain that auto-categorises data, suggests workflows, and answers natural-language questions over the platform
  • Visual Workflow Creator Studio (drag-and-drop nodes, approval flows, triggers, conditions, AI steps)
  • Mobile-first PWA with responsive views, offline inspection mode, and push notifications

Everything is built full-stack Next.js 15+ (App Router) with MongoDB as the primary data store (URI configured via .env). UI is modern, themable (light/dark + brand themes), and component-driven.


2. Phase inventory

#PhasePurposeDurationGate
0Foundation & SetupRepo, CI/CD, environments, tooling, design system1 weekG0
1Requirements & ArchitectureFull FRS + NFRS, system architecture, data model, ADRs2 weeksG1
2Core PlatformNext.js scaffold, MongoDB, Auth/RBAC, OpenAPI/Swagger, audit3 weeksG2
3Data PlatformIngestion, ontology, connectors (BACnet/MQTT/REST), time-series4 weeksG3
4SFMS Core ModulesAsset, Location, System, Work Order, Document, Notifications4 weeksG4
5Dashboard SystemWidget framework, drag-drop layout, themes, TV / war-room modes4 weeksG5
6AI Second BrainLLM integration, auto-categorisation, NL query, RAG, agent loops4 weeksG6
7Workflow Creator StudioVisual designer, state machine, approvals, triggers, audit3 weeksG7
8Mobile + PWAResponsive, PWA, offline mode, push notifications, mobile UX2 weeksG8
9QA, Security, DeployTest, pentest, performance, hardening, deploy, handover2 weeksG9

Total elapsed: ~29 weeks single-thread, ~22 weeks with Phase 4–8 partially parallelised.


3. Sequencing

P0 ─┐
    ├─▶ P1 ──▶ P2 ──┬──▶ P3 ──┬──▶ P4 ──▶ P9
                    │         ├──▶ P5 ──▶ P9
                    │         ├──▶ P6 ──▶ P9
                    │         └──▶ P7 ──▶ P9
                    └─────────────▶ P8 ──▶ P9
  • P0–P2 are strictly sequential (foundation → architecture → core platform).
  • P3 must complete before P4 (SFMS modules read from the data platform).
  • P5 (Dashboards), P6 (AI), P7 (Workflow), P8 (Mobile) can run in parallel after P4 ships, sharing the platform foundation.
  • P9 (QA / Deploy) integrates everything before go-live.

4. Engineering principles

  1. Spec-driven — every endpoint is in the OpenAPI spec before code is written. Generated types power both server and client.
  2. Schema-first — every collection is defined with Zod/Joi schemas and Mongoose models (or native MongoDB validators) before any business logic.
  3. Multi-tenant from day one — every collection is tenant-scoped; tenant isolation is enforced at the data layer, not just the application layer.
  4. RBAC + ABAC — role-based defaults with attribute-based overrides for fine-grained per-record access.
  5. Audit by default — every mutating action writes to an immutable audit log; AI decisions include reasoning trace.
  6. Real-time first — WebSocket / SSE channels for live data; REST for CRUD.
  7. Componentized — Tailwind + shadcn/ui as base, with a documented design system in Storybook.
  8. Test pyramid — unit (Vitest/Jest), integration (Playwright API), end-to-end (Playwright UI), with ≥80% coverage on business logic.
  9. Observability by default — OpenTelemetry traces, Prometheus metrics, structured logs; SLOs defined per service.
  10. Documentation as code — every PR updates relevant ADRs, OpenAPI spec, runbook, and changelog.

5. Technology stack (final)

LayerChoiceNotes
RuntimeNode.js LTS (≥20)Next.js 15+ requirement
FrameworkNext.js 15+ (App Router)Full-stack: UI + API Route Handlers + Server Actions
LanguageTypeScript (strict)No JS in product code
DatabaseMongoDB 7+URI in .env (MONGODB_URI); Atlas in prod
ODMMongoose 8+Or native driver behind a repository layer
Time-seriesMongoDB Time Series CollectionsFor BMS / IoT telemetry
VectorMongoDB Atlas Vector SearchFor RAG / Second Brain
AuthAuth.js (NextAuth v5)OIDC, SAML via providers, MFA
StylingTailwind CSS + shadcn/uiTheming via CSS variables
StateTanStack Query + ZustandServer state + client state
FormsReact Hook Form + ZodSchema-shared client/server
ChartsRecharts + EChartsRecharts for simple; ECharts for advanced
Dashboard gridreact-grid-layoutDrag-drop layout
Workflow canvasReact FlowVisual workflow designer
API docsSwagger UI + ScalarMounted at /api/docs
OpenAPI specnext-swagger-doc or zod-to-openapiSource of truth
RealtimeServer-Sent Events (default) + WebSocket where neededVia Next.js route handlers
QueueBullMQ + RedisFor background jobs
AIProvider-agnostic SDK (OpenAI, Anthropic, Ollama)Configured via .env
Object storeS3-compatible (MinIO local, AWS S3 prod)For documents, exports
ObservabilityOpenTelemetry + Grafana stackLogs/metrics/traces
CI/CDGitHub ActionsLint, test, build, scan, deploy
ContainerDocker + Kubernetes (optional)Single-binary Next.js viable for SMB
MobilePWA (no native shell required initially)Add Capacitor later if needed

6. Phase document conventions

Each Phase_N.md follows the same structure for predictability:

  1. Header (status, owner, duration, gate)
  2. Overview — what this phase is and why
  3. Objectives — measurable outcomes
  4. Scope — in / out of scope
  5. Dependencies — prior phases or external
  6. Architecture & Design — diagrams (in ascii / mermaid), key decisions
  7. Detailed Specifications — module by module
  8. Implementation Tasks — broken into Epics / Stories
  9. Acceptance Criteria — testable
  10. Test Requirements — what types of tests, coverage targets
  11. Documentation Requirements — what gets written / updated
  12. Sign-off Criteria — gate conditions
  13. Risks & Mitigations

Stories are written in user-story format: "As a [role], I want [capability], so that [value]."


7. Gates and sign-offs

Each phase ends with a gate (G0–G9). A gate is passed only when:

  • All acceptance criteria for the phase are met
  • All required documents in the phase are produced and reviewed
  • All Sev-1 and Sev-2 defects are closed
  • The phase demo is accepted by the Product Owner and Engineering Lead

Gate sign-off is recorded in _gates/Gate_GN_signoff.md (template provided in Phase 0).


8. File index

  • 00_README.md — this file
  • MASTER_PLAN.md — consolidated roadmap: timeline, critical path, RACI, gate calendar, cross-cutting workstreams
  • ../design/UX & design specification (personas, journeys, IA, design system, patterns, wireframes); a gate input to P1/P2/P4/P5/P8
  • Phase_0.md — Foundation & Setup
  • Phase_1.md — Requirements & Architecture
  • Phase_2.md — Core Platform
  • Phase_3.md — Data Platform
  • Phase_4.md — SFMS Core Modules
  • Phase_5.md — Dashboard System
  • Phase_6.md — AI Second Brain
  • Phase_7.md — Workflow Creator Studio
  • Phase_8.md — Mobile + PWA
  • Phase_9.md — QA, Security, Deployment

9. How to use this plan

For the Engineering Lead: read 00_README.md (this file) and Phase_1.md end-to-end before starting Phase 0. Confirm scope with the Product Owner. Assign owners for each phase.

For an Engineer picking up a phase: read Phase_(N-1).md first to understand inputs, then your phase. Each story is independently scoped; you can branch and PR per story.

For the QA Lead: test requirements at the bottom of each phase are non-optional. Build the test plan from these.

For the Product Owner: review the Acceptance Criteria sections — these are the demos the team will run for sign-off.