SecretSpec
Declarative secrets, every environment, any provider.
SecretSpec separates the declaration of what secrets an application needs from where they are stored, enabling portable applications that work across different secret storage backends without code changes.
Documentation | Quick Start | Announcement Blog Post
Features
- Declarative Configuration: Define your secrets in
secretspec.tomlwith descriptions and requirements - Multiple Provider Backends: Keyring, .env, OnePassword, LastPass, and environment variables
- Type-Safe Rust SDK: Generate strongly-typed structs from your
secretspec.tomlfor compile-time safety - Profile Support: Override secret requirements and defaults per profile (development, production, etc.)
- Configuration Inheritance: Extend and override shared configurations using the
extendsfeature - Discovery:
secretspec initto discover secrets from existing.envfiles
Quick Start
# 1. Initialize secretspec.toml (discovers secrets from .env)
# 2. Set up provider backend
> onepassword:
)
> development
# 3. Check and configure secrets
# 4. Run your application with secrets
# Or with a specific profile and provider
See the Quick Start Guide for detailed instructions.
Installation
# Quick install
|
See the installation guide for more options including Nix, Homebrew, and Docker.
Configuration
Each project has a secretspec.toml file that declares the required secrets:
[]
= "my-app" # Inferred from current directory name when using `secretspec init`
= "1.0"
# Optional: extend other configuration files
= ["../shared/common", "../shared/auth"]
[]
= { = "PostgreSQL connection string", = true }
= { = "Redis connection string", = false, = "redis://localhost:6379" }
# Profile-specific configurations
[]
= { = "PostgreSQL connection string", = false, = "sqlite://./dev.db" }
= { = "Redis connection string", = false, = "redis://localhost:6379" }
[]
= { = "PostgreSQL connection string", = true }
= { = "Redis connection string", = true }
See the configuration reference for all available options.
Profiles
Profiles allow you to define different secret requirements for each environment (development, production, etc.):
# Use specific profile
# Set default profile
Learn more about profiles and profile selection.
Providers
SecretSpec supports multiple storage backends for secrets:
- Keyring - System credential store (recommended)
- .env files - Traditional dotenv files
- Environment variables - Read-only for CI/CD
- OnePassword - Team secret management
- LastPass - Cloud password manager
# Use specific provider
# Configure default provider
See provider concepts and provider reference for details.
Rust SDK
Generate strongly-typed Rust structs from your secretspec.toml:
// Generate typed structs from secretspec.toml
declare_secrets!;
See the Rust SDK documentation for advanced usage including profile-specific types.
CLI Reference
Common commands:
# Initialize and configure
# Manage secrets
# Run with secrets
See the full CLI reference for all commands and options.
Contributing
We welcome contributions! Areas where you can help:
- New provider backends - See the provider implementation guide
- Language SDKs - Help us support more languages beyond Rust
- Package managers - Get SecretSpec into your favorite package manager
- Documentation - Improve guides and examples
See our GitHub repository to get started.
License
This project is licensed under the Apache License 2.0.