Skip to main content

Architecture Overview

OpenPrime follows a microservices architecture with clear separation of concerns between components.

System Architecture​

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ User Browser β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ React Frontend (3000) β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Context β”‚ β”‚ Router β”‚ β”‚ Config β”‚ β”‚ UI Components β”‚ β”‚
β”‚ β”‚ Providers β”‚ β”‚ β”‚ β”‚ Files β”‚ β”‚ β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ β”‚
β–Ό β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Keycloak (8080) β”‚ β”‚ Express Backend (3001) β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ OpenID Connect / PKCE β”‚ β”‚ β”‚ β”‚ REST API Routes β”‚ β”‚
β”‚ β”‚ User Management │◀─┼───────┼─▢│ JWT Validation β”‚ β”‚
β”‚ β”‚ Identity Federation β”‚ β”‚ β”‚ β”‚ Business Logic β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ β”‚ β”‚
β–Ό β–Ό β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ PostgreSQL (5432) β”‚ β”‚ Injecto (8000) β”‚ β”‚ StateCraft β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ Template Processor β”‚ β”‚ (8001) β”‚
β”‚ β”‚ Users β”‚ β”‚ β”‚ β”‚ β”‚ TF State Mgmt β”‚
β”‚ β”‚ Environments β”‚ β”‚ β”‚ @param processing β”‚ β”‚ β”‚
β”‚ β”‚ Credentials β”‚ β”‚ β”‚ @section handling β”‚ β”‚ S3 + DynamoDB β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ Code generation β”‚ β”‚ Management β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Component Overview​

Frontend (openprime-app)​

Technology: React 19, Tailwind CSS, React Router v6

Responsibilities:

  • User interface rendering
  • Configuration wizards
  • State management via Context API
  • Authentication flow (Keycloak JS)

Key Patterns:

  • Configuration-driven UI generation
  • Centralized context providers
  • Component composition

Backend (openprime-app-backend)​

Technology: Express.js, Sequelize ORM, PostgreSQL

Responsibilities:

  • REST API endpoints
  • JWT token validation
  • Database operations
  • Credential encryption
  • Service orchestration

Key Patterns:

  • Route/Controller/Service layers
  • Middleware chain (auth, validation, logging)
  • Repository pattern for data access

Authentication (Keycloak)​

Technology: Keycloak 24.x

Responsibilities:

  • User authentication (OIDC/PKCE)
  • Session management
  • Identity federation
  • User provisioning

Template Processor (Injecto)​

Technology: Python, FastAPI

Responsibilities:

  • Template parsing (@param, @section)
  • Variable substitution
  • Code generation
  • Validation

State Manager (StateCraft)​

Technology: Python, FastAPI

Responsibilities:

  • Terraform backend provisioning
  • S3 bucket management
  • DynamoDB table management

Data Flow​

Environment Creation​

1. User fills wizard form
β”‚
β–Ό
2. Frontend validates configuration
β”‚
β–Ό
3. POST /api/environments
β”‚
β–Ό
4. Backend validates JWT + authorization
β”‚
β–Ό
5. Save to PostgreSQL (JSONB)
β”‚
β–Ό
6. Return environment ID

Code Generation​

1. User requests code generation
β”‚
β–Ό
2. Backend fetches environment config
β”‚
β–Ό
3. Backend calls Injecto service
β”‚
β–Ό
4. Injecto processes templates
β”‚
β–Ό
5. Generated code returned
β”‚
β–Ό
6. Download or push to Git

Technology Stack​

LayerTechnologyPurpose
FrontendReact 19UI framework
StylingTailwind CSSUtility CSS
RoutingReact Router v6Client routing
IconsLucide ReactIcon library
BackendExpress.jsAPI server
ORMSequelizeDatabase abstraction
DatabasePostgreSQL 15Data persistence
AuthKeycloakIdentity management
TemplatesPython/FastAPICode generation
IaCTerraformInfrastructure provisioning
K8s AppsHelmPackage management

Design Principles​

Configuration-Driven​

UI components are generated from configuration files, not hardcoded:

// servicesConfig.js drives form generation
const schema = {
clusterName: { type: 'string', required: true },
version: { type: 'select', options: [...] }
};
// β†’ Auto-generates form fields

Separation of Concerns​

  • Frontend: UI and user interaction
  • Backend: Business logic and data
  • Injecto: Template processing
  • StateCraft: Infrastructure state

Security by Design​

  • All credentials encrypted at rest
  • User isolation at database level
  • JWT validation on every request
  • CORS and rate limiting enabled

Scalability Considerations​

Horizontal Scaling​

  • Frontend: Static files, CDN-friendly
  • Backend: Stateless, load-balanceable
  • Database: Read replicas supported

Vertical Scaling​

  • Injecto: CPU-bound, scales with cores
  • Database: Memory for query performance