Architecture

How Snapline Hub is structured: components, data flow, storage, and relationship to the Snapline framework.

System overview

┌─────────────────────────────────────────────────────────────┐ │ Snapline Ecosystem │ ├─────────────────────────┬───────────────────────────────────┤ │ snapline (Node.js) │ snapline-python │ │ @vaagatech/snapline-* │ snapline_* packages │ │ │ │ │ testSuite() │ test_suite() │ │ runApiFixtureCases() │ run_api_fixture_cases() │ │ buildReport() │ build_report() │ │ pushTestReportToHub() │ push_test_report_to_hub() │ └────────────┬────────────┴──────────────┬────────────────────┘ │ │ │ POST /api/reports │ │ (TestRunReport JSON) │ ▼ ▼ ┌─────────────────────────────────────────────────────────────┐ │ snapline-hub │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ │ │ │ Express API │ │ SQLite DB │ │ React Dashboard │ │ │ │ server/ │ │ data/*.db │ │ web/src/ │ │ │ └──────────────┘ └──────────────┘ └──────────────────┘ │ └─────────────────────────────────────────────────────────────┘

Design principles

Repository layout

snapline-hub/
├── server/              # Express API (TypeScript)
│   ├── index.ts         # App entry, static file serving
│   ├── routes.ts        # REST route handlers
│   ├── db.ts            # Storage factory re-exports
│   ├── storage/         # ReportStore adapters (sqlite, postgres, custom)
│   └── api.test.ts      # API integration tests
├── web/                 # React UI (Vite)
│   ├── src/
│   │   ├── pages/       # Dashboard, Reports, Detail, Upload
│   │   ├── api.ts       # Fetch client
│   │   └── App.tsx      # Router + layout
│   └── vite.config.ts
├── shared/
│   └── types.ts         # TestRunReport types (shared server + web)
├── docs/                # GitHub Pages documentation (this site)
├── data/                # SQLite database (gitignored, created at runtime)
└── package.json

Server components

ModuleResponsibility
server/index.tsCreates Express app, mounts API router, serves web/dist in production
server/routes.tsREST endpoints: health, stats, reports CRUD
server/db.tsStorage factory; re-exports validation helpers
server/storage/ReportStore interface, SQLite/PostgreSQL adapters, query builders
shared/types.tsTypeScript interfaces aligned with Snapline core

Database schema

Single table reports — default backend is SQLite (WAL mode). PostgreSQL uses the same layout. See Storage Adapters for other backends.

ColumnTypeDescription
idTEXT PKUUID v4
generated_atTEXTFrom report.generatedAt
frameworkTEXTFrom report.framework
labelTEXT NULLDisplay name (push/upload only)
totalINTEGERsummary.total
passedINTEGERsummary.passed
failedINTEGERsummary.failed
duration_msINTEGER NULLsummary.durationMs
environmentTEXT NULLJSON-serialized environment object
report_jsonTEXTFull TestRunReport JSON
created_atTEXTServer ingest timestamp

Indexed on generated_at DESC and framework for list queries.

Data model

Hub stores Snapline's standard report hierarchy:

TestRunReport ├── generatedAt: string ├── framework: string ├── summary: { total, passed, failed, durationMs? } ├── environment?: Record<string, string> └── suites: TestSuiteResult[] ├── name: string ├── passed: boolean └── results: TestStepResult[] ├── step: string ├── passed: boolean ├── message?: string ├── diff?: DiffResult ├── processed?, source?, target?, data? └── ...

Framework identifiers

Runtimeframework value
Node.js@vaagatech/snapline-engine
Pythonsnapline-engine

Web UI

React 19 SPA with React Router. Pages fetch from /api/*:

PageAPI calls
DashboardGET /api/stats
All RunsGET /api/reports
Run DetailGET /api/reports/:id, DELETE
UploadPOST /api/reports

Development vs production

ModeUIAPIHow
Development:5173 (Vite):3847Vite proxies /api to backend
Production:3847:3847Express serves web/dist + API

Integration with Snapline

Hub does not import Snapline packages. Integration is HTTP-only:

  1. Snapline test runner produces TestSuiteResult[]
  2. buildReport() wraps into TestRunReport
  3. pushTestReportToHub() POSTs JSON to Hub
  4. Hub validates, stores in SQLite, UI reads via GET

This loose coupling means Hub can be upgraded independently of Snapline framework versions, as long as the TestRunReport schema remains compatible.

What Hub does not do

Security considerations

TopicGuidance
Network exposureRun on internal network or behind authenticated reverse proxy
Sensitive dataRedact before push using Snapline redactSuiteResults
Database fileContains full test payloads — restrict filesystem permissions
DeletionDELETE endpoint has no auth — protect at network layer
Request size50 MB JSON limit — avoid pushing unbounded payloads

Scaling

Hub is designed for team-scale usage (hundreds to low thousands of reports). For very high volume: