How sleepydogx/thechecklist-public works
1. Overall shape
- This is a single-page web app backed by a Node.js/Express API and PostgreSQL.
- The browser hosts the entire UI from frontend/index.html; the backend exposes all application logic over HTTP.
2. Primary runtime boundary
- The frontend is a thin client for interacting with the playbook, managing engagement state, and rendering reports.
- The backend is the authoritative layer for authentication, persistence, file uploads, exports, AI calls, and notebook/notion integrations.
3. Core backend structure
- backend/server.js is the entrypoint.
- backend/db.js centralizes database access.
- backend/middleware/auth.js enforces JWT-based authentication across protected routes.
- The backend is split into route modules by domain rather than by UI page.
4. Data model and persistence
- PostgreSQL is the main system of record.
- Schema changes are managed through SQL migrations in backend/migrations/ and applied on startup via run.js.
- The database stores users, clients, engagements, target profiles, playbooks/templates, findings, images, and saved state.
5. Domain subsystems
- routes/auth.js handles login/registration and first-user admin bootstrap.
- routes/clients.js, routes/engagements.js, and routes/profiles.js model the pentest workflow hierarchy: client → engagement → target profile.
- routes/state.js likely stores the live playbook/session state: variables, progress, notes, and findings.
- routes/templates.js and routes/seed.js support built-in playbook templates and initial template seeding.
6. Playbook execution layer
- The app centers on a structured AD internal pentest playbook with phases and steps.
- Variable replacement happens across commands and notes using engagement/profile data.
- The playbook can be edited as a canvas-style structure and persisted as templates or engagement-specific instances.
7. Findings and evidence
- Findings are first-class data, including severity, summaries, subsection association, and screenshots.
- routes/uploads.js handles image/evidence uploads, and the README indicates filenames are randomized with ownership checks.
- This creates a clear separation between narrative playbook content and evidence artifacts.
8. AI and analysis integration
- routes/ai.js connects the app to optional AI providers such as OpenRouter or Ollama.
- AI is used for per-section analysis of command output, extracting findings, suggesting variables, and recommending next steps.
- This is an external-call boundary: the backend mediates all AI traffic rather than the browser calling providers directly.
9. Notebook and documentation exports
- routes/jupyter.js supports importing/exporting playbooks as Jupyter notebooks.
- routes/notion.js integrates with Notion for publishing or exporting content there.
- These routes act as transformation/export adapters around the same underlying playbook data.
10. Security and access control
- All sensitive API access is JWT-protected.
- Ownership and isolation are enforced server-side and at the database/query layer.
- The app is designed so each authenticated user can manage multiple clients and engagements without cross-tenant leakage.
11. Deployment topology
- docker-compose.yml and Dockerfile indicate a containerized deployment with the app and database.
- The README describes a simple startup path: configure .env, start with Docker Compose, then open the app in a browser.
- This makes the system deployable as a self-contained internal tool.
12. How data flows through the system
- User action in the browser → Express route → PostgreSQL read/write → updated UI state.
- Evidence uploads follow the same path but add file storage handling.
- AI analysis and external exports introduce outbound integrations, but the backend remains the single integration gateway.
Main entry points: server.js API server · db.js DB access · ai.js AI analysis · state.js Playbook state
Components 18
Frontend
Browser-hosted single-page UI.
- SPA UI · Browser entrypoint that hosts the entire client interface.
frontend/index.html
Backend API
Express server, route modules, middleware, and shared DB access.
- API server · Bootstraps the HTTP server and wires backend routes.
backend/server.js - Auth middleware · Protects authenticated routes and enforces request-level access control.
backend/middleware/auth.js - DB access · Central database access layer used by backend routes.
backend/db.js - Auth routes · Handles registration, login, and first-user admin setup.
backend/routes/auth.js - Clients · Manages client records in the engagement hierarchy.
backend/routes/clients.js - Engagements · Manages engagements under each client.
backend/routes/engagements.js - Profiles · Manages target profiles and playbook context for an engagement.
backend/routes/profiles.js - Playbook state · Stores live playbook variables, progress, notes, and findings state.
backend/routes/state.js - Templates · Serves built-in templates and template CRUD for playbooks.
backend/routes/templates.js - Seed data · Loads initial built-in playbook content into the system.
backend/routes/seed.js - Uploads · Handles image and evidence uploads with ownership checks.
backend/routes/uploads.js
Persistence
PostgreSQL schema lifecycle and migration startup.
- Migration runner · Applies database migrations during startup.
backend/migrations/run.js - SQL migrations · Versioned SQL files that define and extend the PostgreSQL schema.
backend/migrations/001_initial.sql - Core schema · Primary records for users, clients, engagements, profiles, templates, findings, images, and saved state.
backend/migrations/001_initial.sql
External Integrations
Outbound adapters for AI, notebooks, and publishing.
- AI analysis · Mediates outbound AI requests for analysis, extraction, and recommendations.
backend/routes/ai.js - Jupyter · Imports and exports playbooks as Jupyter notebooks.
backend/routes/jupyter.js - Notion · Exports or publishes playbook content to Notion.
backend/routes/notion.js
Connections 29
- SPA UI → API server: HTTP API · The SPA talks to the backend for all application logic.
- API server → Auth middleware: protects · Server wires authentication into protected routes.
- API server → Auth routes: routes · Exposes login and registration endpoints.
- API server → Clients: routes · Exposes client management endpoints.
- API server → Engagements: routes · Exposes engagement management endpoints.
- API server → Profiles: routes · Exposes target profile endpoints.
- API server → Playbook state: routes · Exposes live playbook state endpoints.
- API server → Templates: routes · Exposes playbook template endpoints.
- API server → Seed data: routes · Exposes bootstrap seeding endpoints.
- API server → Uploads: routes · Exposes evidence upload endpoints.
- API server → AI analysis: routes · Exposes analysis endpoints that proxy AI providers.
- API server → Jupyter: routes · Exposes notebook import/export endpoints.
- API server → Notion: routes · Exposes Notion export/publish endpoints.
- Auth routes → DB access: reads/writes · Authentication data is persisted through the shared DB layer.
- Clients → DB access: reads/writes · Client records are stored in PostgreSQL.
- Engagements → DB access: reads/writes · Engagement records are stored in PostgreSQL.
- Profiles → DB access: reads/writes · Profile records and playbook context are stored in PostgreSQL.
- Playbook state → DB access: reads/writes · Live playbook state is persisted in PostgreSQL.
- Templates → DB access: reads/writes · Template data is persisted in PostgreSQL.
- Seed data → DB access: initializes · Seeds built-in content through the database layer.
- Uploads → DB access: records · Upload metadata and ownership data are stored in PostgreSQL.
- AI analysis → Playbook state: uses context · AI analysis consumes playbook state, variables, and findings.
- AI analysis → DB access: reads/writes · AI-assisted results are persisted through the DB layer.
- Jupyter → DB access: transforms · Notebook import/export operates on stored playbook data.
- Notion → DB access: transforms · Notion publishing/export operates on stored playbook data.
- Migration runner → SQL migrations: applies · Startup runner executes versioned SQL migrations.
- SQL migrations → Core schema: defines · Migrations establish and extend the PostgreSQL schema.
- Migration runner → DB access: prepares · Database access depends on the schema being migrated first.
- DB access → Core schema: operates on · Shared DB access reads and writes the core schema.