How akto-api-security/akto works
Project type and purpose
• This is a large, full‑stack, microservice‑based API security platform (Akto API Security).
• It consists of backend services for inventory, runtime analysis, testing, billing, threat detection, plus a rich web dashboard.
File structure
• Top‑level dirs:
• apps/ – each subfolder (api-analyser, api-runtime, billing, dashboard, database-abstractor, internal, mini-runtime, source-code-analyser, testing-cli, testing, threat-detection, threat-detection-backend, etc.) is a standalone service or tool.
• libs/ – shared libraries (DAO, utils, protobuf, integrations) consumed by multiple services.
• docker-compose.yml & .devcontainer/ – orchestrate local deployment in containers.
• README.md – describes overall use cases (inventory, testing, runtime scanning) and Docker‑Compose quickstart.
• Each app has its own Dockerfile, Maven pom.xml, source under src/main/java, tests under src/test.
• Presence of Kafka sync tasks, gRPC/protobuf definitions, MongoDB collections, Redis caches, and a Jetty‑based Java web dashboard.
README for additional insights
• Architecture is implied: mirrored traffic → collectors (api-runtime, mini-runtime, database-abstractor) → message bus (Kafka) → storage (MongoDB, Redis) → analytic services (analyser, threat-detection) → UI (dashboard).
• Quickstart uses docker-compose to wire all components.
Main components & interactions
a. Agents & traffic sources
• BurpSuite/GCP/AWS/Postman etc. mirror or forward API requests to the runtime collector (api-runtime & mini-runtime).
b. Data pipeline
• api-runtime consumes HTTP calls, writes to Kafka topics; Database‑abstractor may read DB‑level traffic.
• Kafka→ multiple consumers:
• Resource analyser (api-analyser) processes API patterns.
• Threat‑detection microservice detects malicious patterns.
• Testing engine (apps/testing, testing-cli) executes business logic tests.
c. Storage layers
• MongoDB: primary data store for API inventory, policies, logs.
• Redis: caching (e.g., CounterCache in threat-detection).
d. Shared libraries
• libs/dao: data‑access objects, entity definitions.
• libs/utils: HTTP clients, Kafka utilities, authentication.
• libs/protobuf: gRPC message definitions for cross‑service communication.
e. Control & orchestration
• docker-compose spins up all services plus Kafka, MongoDB, Redis.
• .github/workflows handle CI/CD.
f. Frontend dashboard
• Java‑based server on Jetty exposing REST endpoints (apps/dashboard).
• Polaris_web (React) and Vue.js dashboard under apps/dashboard/web.
• Interacts with backend via REST (HTTP) and gRPC (where applicable).
Architectural patterns and design principles
• Microservices for modular functionality (analyser, runtime, billing, threat‑detection).
• Event‑driven via Kafka for decoupling producers & consumers.
• Layered storage (MongoDB for persistence, Redis for caching).
• Shared library approach (libs/) to enforce consistency.
• Containerization (Docker + Docker‑Compose).
• Use of CI/CD pipelines (.github/workflows).