How nasa-pds/registry-api works
Project type and purpose
• This is a Maven multi-module Java project providing a standalone Search API (Spring Boot) for NASA’s PDS registry.
• It has three subcomponents:
– lexer: ANTLR4 grammar and parser for incoming “q” query strings
– model: generated OpenAPI client/server definitions and data transfer objects
– service: the Spring Boot application implementing REST endpoints, wiring lexer + model, and querying OpenSearch/Elasticsearch
File structure
• Top-level modules:
– pom.xml (parent POM)
– lexer/ (parser library)
– model/ (OpenAPI-based DTOs and controller interfaces)
– service/ (Spring Boot application, controllers, configuration, provisioning, tests)
– docker/ (Dockerfiles for local and CI images)
– terraform/ (IaC for AWS, ECS, networking, API URI rewrites)
• service/src/main/java/gov/nasa/pds/api/registry: layered package structure (configuration, controllers, model, search, util, view) follows a classic layered-MVC pattern
• CI/CD manifests under .github/workflows drive build, test, security checks, release
Extract README insights
• It implements PDS Search API v1.0.0 via Spring Boot
• External dependency: an OpenSearch/Elasticsearch cluster (can be stood up via docker-compose in the “registry” repo)
• Two run modes: non-containerized (mvn spring-boot:run) or containerized (mvn spring-boot:build-image + Docker)
• Integration tests driven by Postman/Newman against a running stack
Main components & interactions
a. Code modules & build pipeline
– GitHub Source → Maven multi-module build → JARs (lexer.jar, model.jar, service.jar)
– CI/CD (GitHub Actions) automates build → unit tests → Docker image push to registry
b. Runtime deployment
– Docker (container image of registry-api-service) deployed via Docker Compose (dev) or AWS ECS (prod via Terraform)
– Spring Boot Service exposes HTTPS endpoints (/search, /health, /docs)
– Internal processing: HTTP request → SecurityValidationFilter → Controllers → RequestConstructionContext & RequestBuildContext → Antlr4 parser (lexer) → OpenSearch client (OpenSearchRegistryConnectionImpl) → Transform results via ResponseTransformerRegistry → Serialize via Pds4Json/Product serializers → HTTP response
– Swagger UI served from static resources for API docs
c. External services & infrastructure
– OpenSearch/Elasticsearch cluster (multi-tenant discipline nodes)
– AWS (ECS tasks, IAM for secrets via AWSSecretsAccess, CloudWatch for logs)
– Terraform manages AWS infra: provider.tf, variables.tf, ecs.tf, api_uri_rewrite.js
Architectural patterns & principles
• Maven multi-module for separation of concerns (lexer, model, service)
• Layered MVC + Service pattern within “service” module:
– Controllers handle HTTP → Services build/search contexts → Repository/Client layer for OpenSearch
• Use of Antlr4 for query parsing (lexer component)
• Dependency-injection (Spring) and AOP for cross-cutting concerns (LoggingAspect, execution timing)
• OpenAPI-first development for model generation
Final advice
• Be exhaustive: represent all modules, infra bits, and external systems.
• Keep the service-layer breakdown detailed—this is where most complexity lives.