# hashicorp/vault architecture

> Architecture diagram of the GitHub repository hashicorp/vault, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hashicorp/vault
- Repository: https://github.com/hashicorp/vault
- Video tour (about a minute): https://gitdiagram.com/hashicorp/vault/video

## Overview

Vault is a secrets-management server: clients request secrets or cryptographic operations through a unified interface; Vault applies access controls, serves built-in secret and auth methods, persists data, and records audit events. The README documents secret storage, dynamic credentials, encryption, leases, renewal, and revocation. The sampled server and HTTP sources support the server-to-handler-to-core relationships; links from the core to individual engines are shown as unverified because their dispatch wiring was not sampled.

Main entry points: [`vault`](https://github.com/hashicorp/vault/tree/main/vault) (Vault Core), [`sdk/logical/storage.go`](https://github.com/hashicorp/vault/blob/main/sdk/logical/storage.go) (Logical Storage API), [`command/server/server.go`](https://github.com/hashicorp/vault/blob/main/command/server/server.go) (Server Runtime), [`http/handler.go`](https://github.com/hashicorp/vault/blob/main/http/handler.go) (HTTP API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Client and Server"]
  node_client["Vault Client<br/>[client.go]"]
  node_server["Server Runtime<br/>[server.go]"]
  node_http["HTTP API<br/>[handler.go]"]
  node_core["Vault Core"]
end

subgraph group_security["Access and Audit"]
  node_auth["Authentication Methods<br/>[auth.go]"]
  node_audit["Audit System<br/>[broker.go]"]
end

subgraph group_engines["Secret Engines"]
  node_kv["KV Secrets<br/>[kv.go]"]
  node_database["Database Credentials"]
  node_aws["AWS Credentials<br/>[path_user.go]"]
  node_transit["Transit Encryption<br/>[path_encrypt.go]"]
  node_pki["PKI Issuance"]
  node_leases["Lease Lifecycle<br/>[sys_leases.go]"]
end

subgraph group_storage["Persistence and Services"]
  node_logicalstorage["Logical Storage API<br/>[storage.go]"]
  node_physical[("Physical Backends<br/>[teststorage.go]")]
  node_keycrypt["Encrypted Key Storage"]
  node_packer["Packed Storage<br/>[storagepacker.go]"]
  node_activity["Activity Records<br/>[query.go]"]
  node_fairshare["Work Scheduling<br/>[jobmanager.go]"]
end

node_client -.->|"requests secrets"| node_http
node_server -->|"configures handler"| node_http
node_http -->|"routes requests"| node_core
node_server -->|"imports audit system"| node_audit
node_core -.->|"authenticates"| node_auth
node_core -.->|"serves secrets"| node_kv
node_core -.->|"generates credentials"| node_database
node_core -.->|"generates credentials"| node_aws
node_core -.->|"encrypts data"| node_transit
node_core -.->|"issues certificates"| node_pki
node_core -.->|"manages leases"| node_leases
node_core -.->|"uses storage interface"| node_logicalstorage
node_logicalstorage -.->|"persists entries"| node_physical
node_keycrypt -->|"wraps storage"| node_logicalstorage
node_packer -->|"reads and writes"| node_logicalstorage
node_activity -.->|"stores activity data"| node_logicalstorage
node_fairshare -.->|"schedules work"| node_server

click node_client "https://github.com/hashicorp/vault/blob/main/api/client.go"
click node_server "https://github.com/hashicorp/vault/blob/main/command/server/server.go"
click node_http "https://github.com/hashicorp/vault/blob/main/http/handler.go"
click node_core "https://github.com/hashicorp/vault/tree/main/vault"
click node_auth "https://github.com/hashicorp/vault/blob/main/api/auth.go"
click node_audit "https://github.com/hashicorp/vault/blob/main/audit/broker.go"
click node_kv "https://github.com/hashicorp/vault/blob/main/api/kv.go"
click node_database "https://github.com/hashicorp/vault/blob/main/builtin/logical/database/path_creds_create.go"
click node_aws "https://github.com/hashicorp/vault/blob/main/builtin/logical/aws/path_user.go"
click node_transit "https://github.com/hashicorp/vault/blob/main/builtin/logical/transit/path_encrypt.go"
click node_pki "https://github.com/hashicorp/vault/blob/main/builtin/logical/pki/acme_challenge_engine.go"
click node_leases "https://github.com/hashicorp/vault/blob/main/api/sys_leases.go"
click node_logicalstorage "https://github.com/hashicorp/vault/blob/main/sdk/logical/storage.go"
click node_physical "https://github.com/hashicorp/vault/blob/main/helper/testhelpers/teststorage/teststorage.go"
click node_keycrypt "https://github.com/hashicorp/vault/blob/main/sdk/helper/keysutil/encrypted_key_storage.go"
click node_packer "https://github.com/hashicorp/vault/blob/main/helper/storagepacker/storagepacker.go"
click node_activity "https://github.com/hashicorp/vault/blob/main/vault/activity/query.go"
click node_fairshare "https://github.com/hashicorp/vault/blob/main/helper/fairshare/jobmanager.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client,node_server,node_http,node_core toneBlue
class node_auth,node_audit toneAmber
class node_kv,node_database,node_aws,node_transit,node_pki,node_leases toneMint
class node_logicalstorage,node_physical,node_keycrypt,node_packer,node_activity,node_fairshare toneRose
```

## Components

### Client and Server

- [Vault Client](https://github.com/hashicorp/vault/blob/main/api/client.go): `api/client.go`
- [Server Runtime](https://github.com/hashicorp/vault/blob/main/command/server/server.go): `command/server/server.go`
- [HTTP API](https://github.com/hashicorp/vault/blob/main/http/handler.go): `http/handler.go`
- [Vault Core](https://github.com/hashicorp/vault/tree/main/vault): `vault`

### Access and Audit

- [Authentication Methods](https://github.com/hashicorp/vault/blob/main/api/auth.go): `api/auth.go`
- [Audit System](https://github.com/hashicorp/vault/blob/main/audit/broker.go): `audit/broker.go`

### Secret Engines

- [KV Secrets](https://github.com/hashicorp/vault/blob/main/api/kv.go): `api/kv.go`
- [Database Credentials](https://github.com/hashicorp/vault/blob/main/builtin/logical/database/path_creds_create.go): `builtin/logical/database/path_creds_create.go`
- [AWS Credentials](https://github.com/hashicorp/vault/blob/main/builtin/logical/aws/path_user.go): `builtin/logical/aws/path_user.go`
- [Transit Encryption](https://github.com/hashicorp/vault/blob/main/builtin/logical/transit/path_encrypt.go): `builtin/logical/transit/path_encrypt.go`
- [PKI Issuance](https://github.com/hashicorp/vault/blob/main/builtin/logical/pki/acme_challenge_engine.go): `builtin/logical/pki/acme_challenge_engine.go`
- [Lease Lifecycle](https://github.com/hashicorp/vault/blob/main/api/sys_leases.go): `api/sys_leases.go`

### Persistence and Services

- [Logical Storage API](https://github.com/hashicorp/vault/blob/main/sdk/logical/storage.go): `sdk/logical/storage.go`
- [Physical Backends](https://github.com/hashicorp/vault/blob/main/helper/testhelpers/teststorage/teststorage.go): `helper/testhelpers/teststorage/teststorage.go`
- [Encrypted Key Storage](https://github.com/hashicorp/vault/blob/main/sdk/helper/keysutil/encrypted_key_storage.go): `sdk/helper/keysutil/encrypted_key_storage.go`
- [Packed Storage](https://github.com/hashicorp/vault/blob/main/helper/storagepacker/storagepacker.go): `helper/storagepacker/storagepacker.go`
- [Activity Records](https://github.com/hashicorp/vault/blob/main/vault/activity/query.go): `vault/activity/query.go`
- [Work Scheduling](https://github.com/hashicorp/vault/blob/main/helper/fairshare/jobmanager.go): `helper/fairshare/jobmanager.go`

## Connections

- Vault Client → HTTP API: requests secrets (evidence: `README.md`)
- Server Runtime → HTTP API: configures handler (evidence: `command/server/server.go`)
- HTTP API → Vault Core: routes requests (evidence: `http/handler.go`)
- Server Runtime → Audit System: imports audit system (evidence: `command/server/server.go`)
- Vault Core → Authentication Methods: authenticates
- Vault Core → KV Secrets: serves secrets
- Vault Core → Database Credentials: generates credentials (evidence: `README.md`)
- Vault Core → AWS Credentials: generates credentials (evidence: `README.md`)
- Vault Core → Transit Encryption: encrypts data (evidence: `README.md`)
- Vault Core → PKI Issuance: issues certificates
- Vault Core → Lease Lifecycle: manages leases (evidence: `README.md`)
- Vault Core → Logical Storage API: uses storage interface
- Logical Storage API → Physical Backends: persists entries
- Encrypted Key Storage → Logical Storage API: wraps storage (evidence: `sdk/helper/keysutil/encrypted_key_storage.go`)
- Packed Storage → Logical Storage API: reads and writes (evidence: `helper/storagepacker/storagepacker.go`)
- Activity Records → Logical Storage API: stores activity data
- Work Scheduling → Server Runtime: schedules work
