Infisical is an open-source platform for secrets, PKI certificate, and privileged access management, with a React/Vite dashboard, a Node.js/TypeScript API on PostgreSQL, a companion Go service for KMS and HSM-backed keys, and ClickHouse for audit logs.
- Language
- TypeScript
- Database
- PostgreSQL
- Hosting
- Docker
- Running for
- 2 years 8 months
- Team
- 6-20 people
Why this architecture
Audit logs are split into ClickHouse for analytical-scale queries, key-management and HSM/PKCS11 operations run in a separate Go service backed by Redis task queues, and dynamic-secret rotation for Oracle and SAP ASE ships with vendored native drivers baked into the backend image.
Tech stack by layer
9 technologies · audited Sep 17, 2026- ReactRenders the dashboard SPA in frontend/, using Zustand for state and CASL for permission checks.
- ViteDev server and bundler for the frontend app.
- Tailwind CSSUtility CSS framework for the dashboard UI.
- Node.js / TypeScript APIMain backend in backend/, run with tsx in dev and bundled with tsup; exposes the REST API the dashboard and CLI use.
- Go service (backend-go)A second Go module alongside the Node backend, with AWS/GCP KMS clients, chi routing, and a Postgres driver.
- KnexMigration and query tooling for the Postgres schema, invoked through migration:* and seed npm scripts.
- PostgreSQLPrimary relational store for secrets, users, and org data, migrated and queried through Knex with the pg client.
- ClickHouseSeparate store for audit logs, with its own migration path distinct from the Postgres knex migrations.
- RedisUsed by the Go service as a Redis-backed task queue (asynq) and cache client (go-redis).
- DockerRoot Dockerfile.standalone-infisical (plus a FIPS variant) builds the all-in-one self-hosted image.
- HelmCharts for the gateway, NKP, and standalone-Postgres deployment topologies.
- PKCS11 / HSM supportNative pkcs11js build dependencies in the backend image and a Go PKCS11 client for hardware-backed keys.
Infisical architecture diagram
Open SVGDiagram as text
- Dashboard (React · Zustand · CASL) → API (Node.js · TypeScript): REST
- CLI & SDKs (REST) → API (Node.js · TypeScript): REST
- API (Node.js · TypeScript) → PostgreSQL (secrets · orgs (Knex)): Knex
- API (Node.js · TypeScript) → ClickHouse (audit logs): audit events
- backend-go (Go · chi) → PostgreSQL (secrets · orgs (Knex)): SQL
- backend-go (Go · chi) → Redis (queue · cache): enqueue
- Redis (queue · cache) → Task queue (asynq): tasks
- backend-go (Go · chi) → KMS / HSM (AWS · GCP · PKCS11): key ops
Key architectural decisions
7 decisions- 01
Audit logs are written to ClickHouse, separate from the Postgres relational store
backend/package.json defines a clickhouse-migration:latest script (running src/db/run-clickhouse-migrations.ts) distinct from the knex-based migration:* scripts used for the main Postgres schema, so audit-log writes and analytical queries do not compete with transactional Postgres load.
- 02
Postgres schema changes go through hand-written Knex migrations, not an ORM
backend/package.json scripts (migration:up, migration:latest, migration:rollback) all invoke knex --client pg against knexfile.ts/knexfile.mjs, and auditlog-migration:* scripts run a parallel Knex migration set for the audit-log tables.
- 03
A second Go module runs alongside the Node backend for KMS and keyed operations
backend-go/go.mod (module github.com/infisical/api) depends on AWS KMS and GCP KMS clients, github.com/jackc/pgx/v5 for Postgres, github.com/redis/go-redis/v9 and github.com/hibiken/asynq for Redis-backed task queuing, and the chi router, indicating key-management and background-job work is handled outside the TypeScript backend process.
- 04
Hardware security module support requires native PKCS11 bindings in both runtimes
backend/Dockerfile installs python3, make, and g++ specifically to compile pkcs11js during npm ci, and backend-go/go.mod depends on github.com/ThalesGroup/crypto11 and github.com/miekg/pkcs11, so HSM-backed keys are supported from both the Node and Go sides.
- 05
Dynamic secrets for Oracle and SAP ASE ship with vendored native drivers
backend/Dockerfile has a dedicated oracle build stage that downloads and checksum-verifies the Oracle Instant Client, and installs freetds-dev/unixodbc-dev at build time and freetds-bin/libaio1t64/smbclient at runtime, so rotating dynamic secrets against Oracle, SAP ASE, and MSSQL does not depend on drivers being present on the host.
- 06
Remote session recording for the PAM gateway is decoded in the browser via Rust-to-WASM
wasm/ironrdp-decoder/Cargo.toml builds a wasm-bindgen crate on top of the ironrdp-* crates for "offline session replay," matching the @devolutions/iron-remote-desktop-rdp dependency in frontend/package.json used to render RDP sessions in the dashboard.
- 07
Self-hosting ships as one all-in-one image plus separate Helm charts per topology
Dockerfile.standalone-infisical (and a FIPS variant, Dockerfile.fips.standalone-infisical) build a single combined image, while helm-charts/infisical-gateway, helm-charts/infisical-nkp, and helm-charts/infisical-standalone-postgres are separate charts for gateway, NKP, and standalone-Postgres deployments.
How Infisical is built
How Infisical is structured
The repository is not a single npm workspace but a set of independently built components coordinated by a root Makefile and Docker Compose files: frontend/ (React dashboard), backend/ (Node.js/TypeScript API), backend-go/ (a Go module, github.com/infisical/api), wasm/ironrdp-decoder/ (a Rust crate compiled to WebAssembly), and helm-charts/ for Kubernetes deployment. e2e/ and backend/bdd/ hold end-to-end and Gherkin/behave-driven BDD tests respectively. sink/ contains auxiliary services used in development and testing (an oidc-server package plus Cassandra and Coturn compose files). Root-level Dockerfile.standalone-infisical and Dockerfile.fips.standalone-infisical build the combined self-hosted image; docker-compose.dev.yml, docker-compose.prod.yml, and several test-focused compose files (docker-compose.bdd.yml, docker-compose.e2e-dbs.yml) exist at the repo root for local development.
Frontend
frontend/package.json is a React 18 app built with Vite and TypeScript, styled with Tailwind CSS v4. State management uses Zustand, and access-control checks in the UI go through @casl/ability/@casl/react. @devolutions/iron-remote-desktop and @devolutions/iron-remote-desktop-rdp render remote desktop sessions for the privileged-access-management (PAM) gateway feature, @codemirror/* packages power inline editors (for example SQL for dynamic-secret configuration), and posthog-js handles product analytics. The frontend has its own Dockerfile.dev for local development; the production build is folded into the root standalone Docker image rather than shipping a separate frontend-only production Dockerfile.
Backend & APIs
backend/package.json runs the main API: tsx for the dev server, tsup to bundle for production, and Vitest (test:unit, test:e2e) for tests. Database access goes through Knex against PostgreSQL — migration:latest, migration:up, migration:rollback, and matching auditlog-migration:* scripts all target --client pg — while a separate clickhouse-migration:latest script runs src/db/run-clickhouse-migrations.ts against ClickHouse for audit-log storage. Seed scripts (seed-ldap, seed-saml) point to built-in LDAP and SAML support, and an email:dev script previews SMTP templates. Alongside this Node service, backend-go/go.mod defines a second Go module depending on AWS and GCP KMS clients, github.com/jackc/pgx/v5 for Postgres, github.com/redis/go-redis/v9 and github.com/hibiken/asynq for Redis-backed background jobs, and github.com/go-chi/chi/v5 for HTTP routing — a separate service surface from the TypeScript API, handling key-management operations.
Data & persistence
PostgreSQL is the primary datastore for secrets, organizations, and users, accessed from the Node backend through Knex and from the Go service through pgx. ClickHouse is a second datastore used specifically for audit logs, with its own migration path (run-clickhouse-migrations.ts) kept separate from the Postgres knex migrations. Redis appears as a dependency of the Go service (go-redis, asynq) rather than the Node backend in the fetched manifest, backing that service's task queue.
Build, test & deploy
CI workflows under .github/workflows include dedicated TypeScript/lint checks for both backend and frontend (check-be-ts-and-lint.yml, check-fe-ts-and-lint.yml), API breaking-change detection (check-api-for-breaking-changes.yml), Dockerfile pin checks (check-dockerfile-pins.yml), Helm doc generation (helm-docs.yml), and separate Helm release workflows for infisical-core and infisical-nkp. backend/bdd/pyproject.toml defines a Python BDD suite (behave, matching the Gherkin feature files in the language breakdown) that exercises ACME/certificate flows, run via test:bdd in backend/package.json. The backend Dockerfile builds in parallel stages — Node build, Oracle Instant Client download-and-verify, and production dependency install — before assembling a single runtime image with FreeTDS, unixODBC, and PKCS11-related native modules baked in.
Self-hosting notes
Dockerfile.standalone-infisical is the primary self-hosting artifact, combining the backend API and frontend build into one image runnable with docker run; Dockerfile.fips.standalone-infisical is a FIPS-compliant variant. helm-charts/ offers three charts for Kubernetes: infisical-gateway, infisical-nkp, and infisical-standalone-postgres, each uploaded to Cloudsmith via dedicated upload-*-cloudsmith.sh scripts. A root render.yaml also exists for deploying to Render.com, but it references a MONGO_URL environment variable rather than Postgres, indicating it predates the project's move to PostgreSQL and should be treated as a stale template rather than a current deployment path.
What to copy (and what not to)
Separating audit-log writes into ClickHouse from day one, instead of writing high-volume append-only log rows into the same Postgres instance serving transactional secret reads, is a pattern worth copying for any product that expects audit logs to grow much faster than core data. Splitting HSM/KMS key operations into a dedicated Go service (backend-go) makes sense when a codebase needs native PKCS11 bindings and multiple cloud KMS SDKs that are awkward to depend on safely from a single Node process; a project without hardware-key requirements would not need that split. Vendoring the Oracle Instant Client and FreeTDS drivers directly into the backend Docker image is a reasonable way to guarantee dynamic-secret rotation works out of the box, but it is also why the backend image build has multiple slow, security-sensitive download-and-verify stages — a project only supporting one or two database engines would not need this.
Sources & repo audit
- Audited
- Sep 17, 2026
- Commit
- 6a258bb
- License
- NOASSERTION
- backend/package.json (Knex/Postgres migrations, ClickHouse migration script)
- backend-go/go.mod (KMS clients, pgx, go-redis, asynq, chi)
- frontend/package.json (React, Vite, Zustand, CASL, iron-remote-desktop)
- backend/Dockerfile (PKCS11, Oracle Instant Client, FreeTDS build stages)
- wasm/ironrdp-decoder/Cargo.toml (RDP session replay WASM decoder)
Independent analysis of repository at github.com/Infisical/infisical. Spotted an inaccuracy? Use the claim form to request a correction.
Show this stack on your README or website
[](https://stackitfast.com/project/infisical)Paste it into your README. It shows your current stack and links to this page.
Scaffold it with your agent
Paste this prompt into Claude Code, Cursor, Windsurf or AGY to start a project with Infisical's architecture.
- 1Copy the promptThe full markdown spec, with every layer and decision.
- 2Open your AI toolClaude Code, Cursor, Windsurf or Copilot, in a new repo.
- 3Paste and scaffoldUse it as the first instruction; review before you ship.
# MISSION: Scaffold "Infisical" Production Architecture
You are an expert Senior Staff Software Architect and Full-Stack Engineer. Your mission is to scaffold and implement a production-grade, highly reliable, and modular codebase following the proven architecture of **Infisical**.
---
## 1. PROJECT SPECIFICATIONS & BENCHMARK
- **Reference Architecture**: Infisical
- **What It Does**: Infisical is an open-source platform for secrets, PKI certificate, and privileged access management, with a React/Vite dashboard, a Node.js/TypeScript API on PostgreSQL, a companion Go service for KMS and HSM-backed keys, and ClickHouse for audit logs.
- **Domain & Category**: Secret Management
- **Production Scale**: 6-20 people
- **Development Mode**: HYBRID
- **Architectural Rationale**: Audit logs are split into ClickHouse for analytical-scale queries, key-management and HSM/PKCS11 operations run in a separate Go service backed by Redis task queues, and dynamic-secret rotation for Oracle and SAP ASE ships with vendored native drivers baked into the backend image.
- **Live Website Reference**: https://infisical.com
- **Source Repository**: https://github.com/Infisical/infisical
---
## 2. PRODUCTION TECH STACK
- **Full Stack Array**: React, TypeScript, Vite, Go, PostgreSQL, ClickHouse, Redis, Docker, Rust
- **Primary Language(s)**: TypeScript, Go, Gherkin, Python
- **License of the reference repo**: NOASSERTION
- **Frontend**: React — Renders the dashboard SPA in frontend/, using Zustand for state and CASL for permission checks.; Vite — Dev server and bundler for the frontend app.; Tailwind CSS — Utility CSS framework for the dashboard UI.
- **Backend & APIs**: Node.js / TypeScript API — Main backend in backend/, run with tsx in dev and bundled with tsup; exposes the REST API the dashboard and CLI use.; Go service (backend-go) — A second Go module alongside the Node backend, with AWS/GCP KMS clients, chi routing, and a Postgres driver.; Knex — Migration and query tooling for the Postgres schema, invoked through migration:* and seed npm scripts.
- **Data & persistence**: PostgreSQL — Primary relational store for secrets, users, and org data, migrated and queried through Knex with the pg client.; ClickHouse — Separate store for audit logs, with its own migration path distinct from the Postgres knex migrations.; Redis — Used by the Go service as a Redis-backed task queue (asynq) and cache client (go-redis).
- **Infrastructure & deploy**: Docker — Root Dockerfile.standalone-infisical (plus a FIPS variant) builds the all-in-one self-hosted image.; Helm — Charts for the gateway, NKP, and standalone-Postgres deployment topologies.; PKCS11 / HSM support — Native pkcs11js build dependencies in the backend image and a Go PKCS11 client for hardware-backed keys.
---
## 3. KEY ARCHITECTURAL DECISIONS (audited from https://github.com/Infisical/infisical @ 6a258bb)
1. **Audit logs are written to ClickHouse, separate from the Postgres relational store**: backend/package.json defines a clickhouse-migration:latest script (running src/db/run-clickhouse-migrations.ts) distinct from the knex-based migration:* scripts used for the main Postgres schema, so audit-log writes and analytical queries do not compete with transactional Postgres load.
2. **Postgres schema changes go through hand-written Knex migrations, not an ORM**: backend/package.json scripts (migration:up, migration:latest, migration:rollback) all invoke knex --client pg against knexfile.ts/knexfile.mjs, and auditlog-migration:* scripts run a parallel Knex migration set for the audit-log tables.
3. **A second Go module runs alongside the Node backend for KMS and keyed operations**: backend-go/go.mod (module github.com/infisical/api) depends on AWS KMS and GCP KMS clients, github.com/jackc/pgx/v5 for Postgres, github.com/redis/go-redis/v9 and github.com/hibiken/asynq for Redis-backed task queuing, and the chi router, indicating key-management and background-job work is handled outside the TypeScript backend process.
4. **Hardware security module support requires native PKCS11 bindings in both runtimes**: backend/Dockerfile installs python3, make, and g++ specifically to compile pkcs11js during npm ci, and backend-go/go.mod depends on github.com/ThalesGroup/crypto11 and github.com/miekg/pkcs11, so HSM-backed keys are supported from both the Node and Go sides.
5. **Dynamic secrets for Oracle and SAP ASE ship with vendored native drivers**: backend/Dockerfile has a dedicated oracle build stage that downloads and checksum-verifies the Oracle Instant Client, and installs freetds-dev/unixodbc-dev at build time and freetds-bin/libaio1t64/smbclient at runtime, so rotating dynamic secrets against Oracle, SAP ASE, and MSSQL does not depend on drivers being present on the host.
6. **Remote session recording for the PAM gateway is decoded in the browser via Rust-to-WASM**: wasm/ironrdp-decoder/Cargo.toml builds a wasm-bindgen crate on top of the ironrdp-* crates for "offline session replay," matching the @devolutions/iron-remote-desktop-rdp dependency in frontend/package.json used to render RDP sessions in the dashboard.
7. **Self-hosting ships as one all-in-one image plus separate Helm charts per topology**: Dockerfile.standalone-infisical (and a FIPS variant, Dockerfile.fips.standalone-infisical) build a single combined image, while helm-charts/infisical-gateway, helm-charts/infisical-nkp, and helm-charts/infisical-standalone-postgres are separate charts for gateway, NKP, and standalone-Postgres deployments.
---
## 4. NON-NEGOTIABLE ARCHITECTURAL GUARDRAILS
1. **Monorepo & Modular Separation**:
- Structure as a Turborepo monorepo with strict package boundaries:
- `apps/web`: Application UI, routing, layouts, and server endpoints.
- `packages/ui`: Shared design tokens, CSS variables, and Radix UI primitive components.
- `packages/db`: Database schemas, client singleton, declarative migrations, and seed scripts.
- `packages/config`: Shared TypeScript, ESLint, and build configurations.
2. **Strict Type Safety & Zero `any` Policy**:
- Enable `strict: true`, `noImplicitAny: true`, and `strictNullChecks: true`.
- Validate ALL external inputs, API request bodies, and query parameters with **Zod** schemas before execution.
3. **Frontend & Rendering Guidelines**:
- Utilize Vite 6 with TanStack Router for fully type-safe routing. Manage server state and caching via TanStack Query v5 with optimistic UI updates.
4. **Design System & Aesthetics**:
- Keep every color, radius, shadow and font in a single token file (CSS variables) and consume tokens everywhere; never hardcode hex values in components.
- Prefer crisp 1px borders and one subtle shadow scale over blurry default shadows. Pair one sans-serif for body/headings with one monospace for tags, badges, metrics, and code.
5. **Data Layer & Reliability**:
- Write declarative schema definitions with foreign keys, composite indexes on queried filters, and automated timestamp triggers.
- Use connection pooling and prepared statements for serverless database execution.
---
## 5. STEP-BY-STEP SCAFFOLDING ROADMAP
- **Phase 1: Workspace & Root Config**: Initialize package manager, monorepo configuration (`turbo.json`, `tsconfig.base.json`, `package.json`).
- **Phase 2: Database Schema & Client**: Set up the data layer (PostgreSQL, ClickHouse, Redis): client, connection pool, models, and migration scripts.
- **Phase 3: Design Tokens & UI Primitives**: Build accessible `Button`, `Input`, `Card`, `Badge`, and layout wrappers inside `packages/ui`.
- **Phase 4: Core Application Routes & Handlers**: Implement primary authentication, user session handling, and application routes.
- **Phase 5: Quality Assurance & Build Verification**: Run `tsc --noEmit`, ESLint, Prettier, and smoke test suites to ensure zero compilation or runtime errors.
---
## 6. EXECUTION INSTRUCTIONS
1. Review all specifications, architectural guardrails, and stack choices above.
2. Present the full monorepo directory tree structure.
3. Systematically generate the complete, production-ready codebase according to the 5-phase roadmap above — starting with the root workspace setup, followed by the database schema, UI design system package, and full-stack application routes until the repository is fully scaffolded and ready to run.Frequently asked about Infisical
What is Infisical built with?
The dashboard is React, Vite, and TypeScript; the main API is a Node.js/TypeScript service on PostgreSQL (via Knex); a separate Go service (backend-go) handles KMS and Redis-backed background jobs; and audit logs are stored in ClickHouse.
Does Infisical need a backend?
Yes. backend/package.json is the core API that stores secrets in PostgreSQL, and backend-go/go.mod adds a second Go service for key-management operations; the frontend dashboard is a client of both, not a standalone app.
Can I self-host Infisical?
Yes. Dockerfile.standalone-infisical (and a FIPS variant) build a combined all-in-one image, and helm-charts/ provides separate charts for gateway, NKP, and standalone-Postgres Kubernetes deployments.
How does Infisical store audit logs?
Audit logs are migrated and queried separately from the main Postgres schema: backend/package.json has a dedicated clickhouse-migration:latest script that runs migrations against a ClickHouse instance rather than Postgres.
Does Infisical support hardware security modules (HSM)?
Yes. backend/Dockerfile installs build tooling for the pkcs11js native module, and backend-go/go.mod depends on github.com/ThalesGroup/crypto11 and github.com/miekg/pkcs11 for PKCS11-based HSM key operations.
One email a month: new deep dives and stack trends
New source-audited architectures, head-to-head comparisons and the monthly stack report. No spam, unsubscribe anytime.
Similar architectures
- PostHogHybridProduct Analytics Platform · 20+ peopleShares React · TypeScript · ClickHouse
- LagoClassicBilling & Metering Engine · 6-20 peopleShares React · Go · PostgreSQL
- TwentyHybridCRM SaaS · 6-20 peopleShares TypeScript · React · PostgreSQL
- UmamiHybridWeb Analytics · SoloShares TypeScript · React · PostgreSQL
- PenpotClassicDesign & Prototyping Platform · 20+ peopleShares Rust · TypeScript · PostgreSQL
- Trigger.devHybridJob Queue / Dev Tool · 6-20 peopleShares TypeScript · PostgreSQL · ClickHouse