Skip to main content

GospeLib — Technical Overview

Version: 1.0.0 Status: Draft Last Updated: 2026-06-15 Author: GospeLib Engineering

Modular Documentation

This page was originally a monolithic 2,600-line "Exhaustive Technical Specification." That content has been decomposed into focused, maintainable pages across the Architecture, Services, Frontend, and Operations sections. This overview preserves the core thesis and design philosophy, then points you to each detailed page.


Core Thesis

GospeLib starts as a solo-founder product and must eventually support tens of thousands of subscribers. The architecture accomplishes two competing goals simultaneously: be buildable by one person on day one, and never require a rewrite to reach enterprise scale.

The failure mode to avoid is "startup architecture" -- early decisions that bake in assumptions forcing a complete rewrite when the product achieves traction. Instead, we adopt evolutionary architecture: add complexity only where it is earned, but design every seam so that complexity can be added without breaking what exists.

Architecture Principles

  1. Language-right, not TypeScript-by-default. Each service uses the language whose ecosystem best matches its problem domain (Go for high-throughput gateways, Python for graph queries and AI, TypeScript for UI).
  2. Shared infrastructure, independent deployability. Services share config schemas, CI/CD patterns, and logging conventions -- but each builds, tests, and deploys independently. Shared logic lives in explicitly versioned packages.
  3. Seams before premature splitting. Logically distinct services may initially run in the same process, but are authored as separate modules with their own API contracts from the start.
  4. Infrastructure as code, from day one. Even local development runs through Docker Compose driven by the same variable definitions used in production.
  5. Observability is not optional. Every service emits structured JSON logs, OpenTelemetry metrics, and distributed traces with correlation IDs.
  6. Data at the boundary. Services communicate through well-typed contracts (OpenAPI). Internal data models are never exposed directly.
  7. The graph is the product. FalkorDB is not a cache or secondary store -- it IS the product. PostgreSQL handles operational data that does not belong in the graph.

Growth Phases

PhaseTimelineScaleKey Constraints
Phase 1: Solo/SeedMonths 0-181-3 engineers, 0-10K usersSpeed of execution, minimal ops overhead
Phase 2: GrowthMonths 18-483-12 engineers, 10K-100K usersTeam coordination, service independence, horizontal scale
Phase 3: EnterpriseMonth 48+12+ engineers, 100K+ usersCompliance, SLA, multi-region, data residency

Detailed Documentation Map

Architecture

TopicPageCovers
Monorepo structureMonorepoNx workspace, pnpm/uv/Go modules, directory layout, naming conventions
Technology stackStack DecisionsLanguage-by-service rationale, decision matrix, alternatives rejected
Data architectureData OverviewStorage layer summary, FalkorDB, PostgreSQL, Redis, Typesense
Graph databaseFalkorDBCypher queries, schema, connection pooling
Relational databasePostgreSQLUser/billing/study schemas, pgvector embeddings
Cache and queuesRedisKey schema, rate limiting, job queues, session cache
SearchTypesenseCollection schemas, indexing strategy
Graph schemasSchemasNode/edge types, property definitions
Inter-service communicationCommunicationREST contracts, response envelope, request routing
SecuritySecurity OverviewAuth flow, entitlements, secrets management
Scaling strategyScalingPhase-based scaling, horizontal scaling patterns
Repository mapRepo MapFull annotated directory tree

Services

ServicePageLanguagePort
API GatewayGatewayGo (chi)8080
Content APIContentPython (FastAPI)8100
AuthAuthGo8200
BillingBillingGo8300
AI FeaturesAIPython (FastAPI)8400
NotificationsNotificationsGo8500
Ingest PipelineIngestPython (CLI)--

Frontend

TopicPageCovers
Frontend overviewFrontendArchitecture summary, rendering strategy
Design systemDesign SystemTokens, components, cross-platform primitives
Web appApp RouterNext.js 15, RSC, ISR, client reader
Mobile appMobileExpo, React Native, offline-first
State managementStateZustand, TanStack Query
Shared UIShared UI@gospelib/ui, @gospelib/sdk, @gospelib/types

Operations

TopicPageCovers
InfrastructureInfrastructureTerraform, Kubernetes, Docker Compose
CI/CDCI/CDGitHub Actions, ArgoCD, Nx Cloud
MonitoringMonitoringOpenTelemetry, Prometheus, Grafana, Loki, Tempo, Sentry
DeploymentDeploymentStaging, production, rollback procedures

API Reference

TopicPage
Content APIContent Endpoints
AI APIAI Endpoints
Auth APIAuth Endpoints
Billing APIBilling Endpoints
Error codesError Handling