Skip to main content

Deployment Overview

GospeLib runs as a set of containerized microservices on Kubernetes, backed by managed data stores on AWS. This guide covers the deployment architecture, environment topology, and prerequisites.

Service Inventory

ServiceLanguagePortRuntimePurpose
GatewayGo (chi)8080ContainerAPI routing, JWT validation, rate limiting
ContentPython (FastAPI)8100ContainerScripture graph queries (FalkorDB + Typesense)
AuthGo (chi)8200ContainerAuthentication wrapper (Clerk)
BillingGo (chi)8300ContainerSubscriptions (Stripe)
AIPython (FastAPI)8400ContainerLLM orchestration (Anthropic, OpenAI)
NotificationsGo (chi)8500ContainerPush + email (FCM, APNs, Resend)
IngestPython (Click)K8s JobCorpus → FalgorDB pipeline
WebNext.js3000AWS AmplifyWeb reader + marketing
AdminNext.js3001AWS AmplifyInternal dashboard
MobileReact Native (Expo)EAS BuildiOS + Android apps

Data Stores

StoreEngineStagingProduction
FalkorDBRedis-based graph DBK8s podK8s pod (dedicated node)
PostgreSQLpg16 + pgvectorRDS db.t3.microRDS db.r6g.large
RedisRedis 7ElastiCache t3.microElastiCache r6g.large
TypesenseTypesense 26K8s podK8s pod (dedicated node)
warning

FalkorDB (port 6379) and general Redis (port 6380) are separate instances. Do not confuse them.

Environment Topology

┌──────────────────────────┬─────────────────────────────┐
│ STAGING │ PRODUCTION │
│ staging.gospelib.com │ gospelib.com │
│ │ api.gospelib.com │
│ EC2 t3.micro (k3s) │ EKS Cluster │
│ ├ all services (×1) │ ├ all services (×2) │
│ ├ falkordb │ ├ falkordb │
│ └ typesense │ └ typesense │
│ │ │
│ RDS db.t3.micro │ RDS db.r6g.large │
│ ElastiCache t3.micro │ ElastiCache r6g.large │
│ ~$2.50/month │ ~$213/month │
└──────────────────────────┴─────────────────────────────┘

Design Principle: Staging = Production

Staging mirrors production in every meaningful way:

  • Same Docker images — identical container builds from the same ECR registry
  • Same Kubernetes manifests — Kustomize overlays only change namespace, replica count, and resource limits
  • Same database engines — RDS PostgreSQL, ElastiCache Redis, FalkorDB, Typesense (just smaller instances)
  • Same networking — Ingress, TLS, DNS structure, CloudFront CDN
  • Same secrets management — AWS Secrets Manager with per-environment paths
  • Same CI/CD pipeline — GitHub Actions → ECR → ArgoCD
  • Same monitoring stack — Grafana, Prometheus, Loki

The only differences are instance sizes and replica counts.

Prerequisites

Required Accounts

AccountPurposeFree Tier?
AWSAll infrastructureYes (12 months)
GitHubSource code, CI/CDYes
ClerkAuthenticationYes (10K MAU)
StripeBillingYes (test mode)
Expo / EASMobile buildsYes (limited)
AnthropicClaude APIPay-as-you-go
OpenAIGPT APIPay-as-you-go
ResendTransactional emailYes (100/day)
SentryError trackingYes (developer)

Required CLI Tools

node >= 22.0 # JS runtime
pnpm >= 9.15 # Package manager
go >= 1.23 # Go services
python3 >= 3.12 # Python services
uv latest # Python package manager
docker latest # Container builds
terraform >= 1.9 # Infrastructure as Code
aws latest # AWS CLI v2
kubectl latest # Kubernetes control
kustomize latest # K8s manifest management
k3sup latest # k3s installer (staging)
argocd latest # ArgoCD CLI
helm latest # Helm charts

Repository Secrets (GitHub Actions)

SecretDescription
AWS_ROLE_ARNIAM OIDC role ARN
ECR_URLECR registry URL
CLERK_SECRET_KEYClerk API key (per env)
STRIPE_SECRET_KEYStripe API key (per env)
ANTHROPIC_API_KEYAnthropic API key
OPENAI_API_KEYOpenAI API key
RESEND_API_KEYResend API key
SENTRY_DSNSentry DSN
EXPO_TOKENExpo/EAS access token
NX_CLOUD_ACCESS_TOKENNx Cloud cache token

Infrastructure as Code

All infrastructure is defined in infra/terraform/:

infra/terraform/
├── modules/
│ ├── eks/ # EKS cluster
│ ├── rds/ # PostgreSQL
│ ├── elasticache/ # Redis
│ ├── s3/ # S3 buckets
│ ├── ecr/ # Container registries
│ ├── cloudfront/ # CDN
│ ├── route53/ # DNS
│ └── secrets/ # AWS Secrets Manager
├── environments/
│ ├── staging/
│ └── production/
├── main.tf
├── variables.tf
└── outputs.tf

Kubernetes manifests use Kustomize with base + overlay pattern:

infra/k8s/
├── base/ # Base manifests for all services
├── overlays/
│ ├── staging/ # Staging overrides (1 replica, small resources)
│ └── production/ # Production overrides (2 replicas, larger resources)
└── jobs/
├── ingest-full.yaml
└── ingest-incremental.yaml

Next Steps