Architecture Reference

Detailed technical architecture for DevOps and platform teams

High-Level Architecture

Core Services

Frontend Applications

Explorer (React + Vite)

  • Visual query builder interface
  • Real-time graph exploration
  • Advanced visualizations (node-link, charts, maps)
  • WebSocket support for live updates

Graph Designer (Svelte)

  • Data import and ETL configuration
  • Schema mapping interface
  • Import job monitoring
  • Lightweight and performant

Backend Microservices

ServiceRuntimePurpose
Client GatewayNode.js/BunAPI entry point, auth, routing
Database ServiceNode.js/BunGraph queries, schema extraction
ML ServicePythonML algorithms, graph analytics
LLM ServicePythonNLP, AI insights
Graph ImporterNode.js/BunETL pipeline, data import

Client Gateway

  • API entry point for all client requests
  • Authentication and session management (Better Auth)
  • Request routing and load balancing
  • WebSocket proxy
  • REST API endpoints

Database Service

  • Connects to external graph databases
  • Query translation (visual query → Cypher/Gremlin)
  • Schema extraction and parsing
  • Query optimization and execution
  • Result parsing and transformation
  • Supports: Neo4j, Memgraph, PostgreSQL

ML Service

  • Machine learning algorithms execution
  • Graph-specific algorithms (PageRank, community detection)
  • Data augmentation
  • Result enrichment for visualizations

LLM Service

  • Natural language query processing
  • AI-powered insights generation
  • Query recommendations
  • Documentation generation

Graph Importer

  • ETL pipeline for data import
  • CSV, Excel, JSON parsing
  • Data transformation and validation
  • Bulk import operations
  • Import job management

Data Layer

PostgreSQL (Metadata Storage)

Purpose: Application metadata, not graph data

Stores:

  • User accounts and organizations
  • Graph schemas and configurations
  • Import job metadata
  • Query history
  • Application settings

Requirements:

  • PostgreSQL 14+
  • 10 GB storage minimum
  • Connection pooling recommended

Redis (Caching & Sessions)

Purpose: Performance and session management

Stores:

  • Session storage
  • Query result caching
  • Schema caching
  • Pub/sub for real-time updates
  • Rate limiting data

Requirements:

  • Redis 7+
  • 2 GB RAM minimum
  • Persistence optional (sessions)

RabbitMQ (Message Queue)

Purpose: Asynchronous processing

Features:

  • Asynchronous job processing
  • Service-to-service communication
  • Event-driven architecture
  • Task queuing for long-running operations

Exchanges:

  • ui-direct-exchange - Frontend requests
  • ml-direct-exchange - ML job processing
  • import-exchange - Import jobs

Requirements:

  • RabbitMQ 3.12+
  • Clustering recommended for HA

Graph Database (External)

Your database - GraphPolaris connects to it

Supported:

  • Neo4j (4.4+, 5.x)
  • Memgraph

Service Communication

Communication Patterns:

  • Synchronous: REST API for user-facing operations
  • Asynchronous: RabbitMQ for background processing
  • Real-time: WebSockets for live updates
  • Caching: Redis for frequently accessed data

Technology Stack

Frontend

TechnologyPurpose
React 18+Explorer UI
SvelteDesigner UI
ViteBuild tool
TypeScriptType safety
D3.jsVisualizations
MapBoxGeographic vis

Backend

TechnologyPurpose
BunRuntime
TypeScriptLanguage
Python 3.11+ML/LLM services
Better AuthAuthentication
Drizzle ORMPostgreSQL

Infrastructure

TechnologyPurpose
KubernetesOrchestration
IstioService mesh
HelmPackage management
ArgoCDGitOps deployment
PrometheusMonitoring

Scaling Characteristics

Stateless Services (Horizontally Scalable)

All application services are stateless:

  • Frontend applications
  • Client Gateway
  • Database Service
  • ML Service
  • LLM Service
  • Graph Importer

Scaling Method: Add more pods/replicas via Kubernetes HPA

Stateful Services

ServiceScaling Strategy
PostgreSQLRead replicas, connection pooling
RedisCluster mode or Sentinel
RabbitMQCluster with mirrored queues

Autoscaling Configuration

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: client-gateway-hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: client-gateway
  minReplicas: 2
  maxReplicas: 10
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 70

Resource Requirements

Minimum (Development/Testing)

ComponentCPUMemoryStorage
Client Gateway500m512Mi-
Database Service500m512Mi-
ML Service1000m2Gi-
LLM Service1000m2Gi-
PostgreSQL500m1Gi10Gi
Redis250m512Mi1Gi
RabbitMQ500m512Mi5Gi
ComponentCPUMemoryStorageReplicas
Client Gateway2000m2Gi-3+
Database Service2000m2Gi-3+
ML Service4000m8Gi-2+
LLM Service4000m8Gi-2+
PostgreSQL2000m4Gi50Gi2+
Redis1000m2Gi10Gi3
RabbitMQ1000m2Gi20Gi3

Health Checks

All services expose health endpoints:

EndpointPurposeUsed By
/healthLivenessKubernetes liveness probe
/readyReadinessKubernetes readiness probe
/metricsPrometheusMonitoring

Probe Configuration

livenessProbe:
  httpGet:
    path: /health
    port: 3000
  initialDelaySeconds: 10
  periodSeconds: 10
  failureThreshold: 3

readinessProbe:
  httpGet:
    path: /ready
    port: 3000
  initialDelaySeconds: 5
  periodSeconds: 5
  failureThreshold: 3

Container Images

Registry: graphpolaris.azurecr.io

ImageDescription
graphpolaris-frontendExplorer UI
graphdesignerDesigner UI
client-gatewayAPI Gateway
database-serviceQuery engine
ml-serviceML processing
llm-serviceAI/NLP
graphimporterData import

Update Frequency: Multiple times per week

High Availability

Service Redundancy

  • Multiple replicas for all stateless services
  • Pod anti-affinity rules
  • Multi-zone deployment support

Database Redundancy

  • PostgreSQL replication
  • Redis Sentinel for failover
  • RabbitMQ mirrored queues

Recovery

  • Automated pod restarts
  • Health check-based recovery
  • Circuit breakers for failing dependencies
  • Graceful degradation

Performance Considerations

Query Optimization

  • Redis caching for repeated queries
  • Query result pagination
  • Cypher query optimization
  • Connection pooling

Data Processing

  • Asynchronous import jobs via RabbitMQ
  • Streaming for large datasets
  • Chunked data transfer
  • Parallel processing where applicable

Frontend Performance

  • Code splitting and lazy loading
  • Virtual scrolling for large lists
  • WebGL for graph rendering (large graphs)
  • Progressive Web App (PWA) capabilities