Software architecture¶
AP is a multi-tenant and web-based software. Multi-tenancy is an application architecture where a single instance of the software serves multiple "tenants", also known as clients or organizations. Each tenant's data and configuration are isolated, ensuring security and privacy, but they all share the same underlying infrastructure and codebase. This approach allows for efficient use of resource, as the software instance can be maintained and updated centrally while still catering to the unique needs of different tenants. For an on-premise installation scenario used by a single organization, a single tenant can be configured, alternatively, individual tenants for development, testing and production. The high-level architecture of the AP is described in the below diagram.

Network architecture¶
AP network architecture for on-prem hosting environments is described in the diagram below, which shows a typical example with a DHIS2 instance as data source, AP multi-tenant service and tenant-specific data storage and data warehouse.

Tech stack¶
The AP software is built using a client-server architecture, where the client (front-end) communicates with the server (backend) over a REST HTTP API.

Database¶
- PostgreSQL: Transactional data and metadata.
- Redis: In-memory caching and session store.
- ClickHouse: Data warehouse for data analytics.
Backend services¶
Backend services are written in Java.
Runtime
- Java: Java OpenJDK / JRE 17.
Core frameworks
- Spring Boot: Application framework with dependency injection container, transaction management and REST API support.
- Spring Cloud Gateway: Reactive routing, filtering, and rate-limiting engine for the API gateway.
- Spring Security: Authentication and authorization, including the OAuth2/OIDC authorization server.
- Spring Data JPA (Hibernate): ORM and repository layer for entity persistence and queries.
- Spring Session: Distributes HTTP session state via Redis across backend services.
- Apache Commons: General-purpose collection helpers, string utilities and validation logic.
Data & persistence
- Flyway: Versioned and predictable SQL schema migrations.
- Spring JDBC: Connections and queries against external data stores.
Messaging & integration
- Apache Pulsar: Event bus for events published and consumed across services.
- Apache HttpClient: HTTP transport and communication with external APIs.
- Jackson: JSON, XML, CSV, and YAML serialization and deserialization.
API docs
- Springdoc OpenAPI: Generates Swagger UI and OpenAPI docs.
Testing
- JUnit Jupiter: Test framework with text lifecycle handling and declarative assertion methods.
- Mockito: Mocking support in unit tests.
- Testcontainers: Spins up real database containers for integration tests.
AI and LLM
- Spring AI: Integrates LLM calls and embeddings generation and exposes an MCP server.
- LLM: Google Gemini or OpenAI ChatGPT for LLM content generation and embeddings.
Front-end web apps¶
Front-end web apps are written in Javascript/TypeScript.
Core frameworks
- React: Web UI library framework for building reusable components and rendering data.
- Vite: Build tool and dev server which compiles TypeScript and bundles the app for production.
- TypeScript: Static typing across the codebase.
- Yarn: Package and dependency manager.
Routing & state
- React Router: Client-side request routing.
- Redux: Global app state management, async action handling and local storage persistence.
- TanStack Query: Server-state management with caching, fetching and synchronization of API data.
UI & styling
- Ant Design: Primary component library, including for buttons, tables, forms and layout.
- Apache ECharts: Charts and data visualization library.
Forms
- Formik: Form state management, including values, submission and dirty tracking.
- Yup: Schema-based form validation.
Editor
- CodeMirror: In-browser code editor component supporting Python, SQL and R syntax.
Testing
- Cypress: End-to-end, integration and component testing, directly in the browser.
- Sentry: Error monitoring and reporting for Redux actions.