How nasa-ammos/aerie works
MAIN COMPONENTS
a. API Layer & Gateway
• Hasura GraphQL Engine: auto-generated schema on Postgres; exposes tables & “Actions” that call custom services.
• Optional API proxy / NGINX (deployment/proxy).
b. Microservices (“Server” modules)
• merlin-server: planning & simulation HTTP/GraphQL endpoints.
• scheduler-server: scheduling HTTP/GraphQL endpoints.
• sequencing-server: sequence-generation HTTP endpoints.
• action-server (TypeScript): executes user-defined activity commands.
• stateless-aerie: CLI tool for offline plan simulation.
c. Background Workers
• merlin-worker: listens for simulation‐completed notifications (Postgres NOTIFY) & processes result cells.
• scheduler-worker: listens for scheduling requests & produces schedule results.
d. Shared Database & Event Bus
• Postgres DB: all domain data tables (merlin, scheduler, sequencing schemas).
• Hasura metadata & migrations (deployment/hasura).
• Pub/Sub via Postgres NOTIFY channels for workers.
e. Supporting Libraries & Utilities
• merlin-driver, merlin-framework, merlin-sdk: discrete‐event simulation engine & mission model interface.
• scheduler-driver: goal‐oriented scheduler library.
• constraints, parsing-utilities, permissions, orchestration-utils, type-utils: core Java libraries plugged into servers & drivers.
f. Clients & Tests
• Web UI (external repo) → GraphQL.
• e2e-tests, load-tests, db-tests drive APIs.
• Examples and scripts show DSL usage.
RELATIONSHIPS & DATA FLOWS
• Client → Hasura GraphQL → either direct SQL queries or Hasura Actions → HTTP call to corresponding “server” microservice.
• “Server” microservice → reads/writes Postgres tables → triggers DB notifications.
• Worker service → subscribes to Postgres notifications → processes tasks (simulation, scheduling) → writes back results.
• Custom DSL compilers (constraints-dsl-compiler, scheduling-dsl-compiler) invoked at build or runtime inside servers/workers.
• Deployment via Docker Compose or Kubernetes: services fronted by an API gateway.
ARCHITECTURAL PATTERNS & PRINCIPLES
• Microservices: one service per domain → clear separation of concerns.
• CQRS / Event-Driven: Commands via GraphQL Actions; results via DB write + NOTIFY/Listen.
• Plugin pattern: mission models & DSLs loaded dynamically (via Java ServiceLoader).
• Shared database schema but isolated logical schemas (merlin, scheduler, sequencing).
• Annotation processing: Java compile-time code generation for mission models & DSL mappers.
TECHNOLOGIES & FRAMEWORKS
• Java + Spring-style custom server code (no Spring, plain Java/Vert.x or Express).
• Node.js/TypeScript for sequencing-server & action-server.
• Hasura GraphQL Engine for auto-generated CRUD + Actions.
• Postgres with PL/pgSQL functions & triggers.
• Docker, Docker Compose, Kubernetes manifests under deployment/.
• Gradle builds for all Java modules.
• Jest & Mocha for JS/TS unit tests; JUnit for Java.