Skip to main content

System Architecture

PBS Knowledge follows a modern three-tier architecture with a knowledge graph database at its core.

High-Level Architecture

┌─────────────────────────────────────────────────────────────┐
│ Frontend │
│ (Svelte 5 + Vite) │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │Dashboard│ │Planning │ │ Admin │ │ Network │ │
│ │ Views │ │ Tools │ │ Panels │ │ Graph │ │
│ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │
└─────────────────────────────────────────────────────────────┘

│ REST API

┌─────────────────────────────────────────────────────────────┐
│ Backend │
│ (Fastify + Node.js) │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ Auth │ │Services │ │ Jobs │ │ Sync │ │
│ │ SAML │ │ Layer │ │ BullMQ │ │ Workers │ │
│ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │
└─────────────────────────────────────────────────────────────┘

┌───────────────┼───────────────┐
│ │ │
▼ ▼ ▼
┌───────────┐ ┌───────────┐ ┌───────────┐
│TerminusDB │ │ Redis │ │ Firebase │
│ (Graph) │ │ (Cache) │ │ (Auth) │
└───────────┘ └───────────┘ └───────────┘

Components

Frontend (Svelte 5)

The frontend is a single-page application built with:

  • Svelte 5 - Reactive UI framework with runes
  • Vite - Fast build tool and dev server
  • Tailwind CSS - Utility-first styling
  • Cytoscape.js - Network graph visualization

Key frontend patterns:

  • Schema-driven forms using Felte + AJV
  • Centralized API client in lib/api.ts
  • Svelte stores for state management

Backend (Fastify)

The backend is a REST API server built with:

  • Fastify - High-performance Node.js framework
  • TypeScript - Type-safe development
  • BullMQ - Job queue for background tasks

Key backend patterns:

  • Service layer for business logic
  • Route handlers for HTTP endpoints
  • Middleware for auth and permissions

Database (TerminusDB)

TerminusDB is a knowledge graph database that provides:

  • Graph Data Model - Relationships as first-class citizens
  • GraphQL API - Query and mutation interface
  • Schema Validation - Type-safe data operations
  • Version Control - Git-like branching for data

Supporting Services

  • Redis - Job queues, caching, sessions
  • Firebase - Authentication, email templates
  • NGINX - Reverse proxy, SSL termination

Data Flow

Read Operations

User Request → NGINX → Backend → TerminusDB GraphQL → Response

Write Operations

User Request → NGINX → Backend → Validation → TerminusDB Mutation → Response

Background Jobs

Trigger → BullMQ Queue → Worker Process → External API/Database → Completion

External Integrations

SystemPurposeSync Direction
Dartmouth APIPeople, courses, enrollmentsInbound
OpenAlexPublications, citationsInbound
FirebaseAuthenticationBidirectional
AWS SESEmail deliveryOutbound

Deployment

The application runs in Docker containers orchestrated by Docker Compose:

services:
frontend: # Svelte app served by NGINX
backend: # Fastify API server
worker: # Background job processor
terminusdb: # Graph database
redis: # Queue and cache

See Deployment Guide for details.