Enterprise-Grade Environment Management for TypeScript Applications
A comprehensive, TypeScript-native toolkit for managing complex application environments with security, compliance, and operational excellence. Provides unified APIs for secrets management, authentication, audit logging, deployment pipelines, change management, and rich ecosystem integrations.
@kitiumai/environments is a complete environment management platform that bridges the gap between development and production operations. It provides:
- Unified Environment Abstraction: Single API for managing secrets, configurations, and infrastructure across all environments
- Enterprise Security: Built-in authentication, RBAC, audit logging, and compliance reporting
- Operational Excellence: Deployment pipelines, change management, monitoring, and automated operations
- Developer Experience: TypeScript-native APIs with full type safety and IntelliSense support
- Extensibility: Plugin architecture for custom integrations and organization-specific workflows
Modern applications require sophisticated environment management that goes beyond simple configuration files. Organizations need:
- Security & Compliance: Centralized secrets management with audit trails and compliance reporting
- Operational Efficiency: Automated deployment pipelines and change management workflows
- Developer Productivity: Type-safe APIs that prevent configuration errors and provide excellent DX
- Scalability: Multi-environment hierarchies with inheritance and overrides
- Observability: Monitoring, alerting, and operational insights across all environments
Without proper environment management, teams face:
- β Secrets scattered across multiple systems
- β Manual deployment processes prone to errors
- β Lack of audit trails for compliance
- β Inconsistent configurations between environments
- β Poor visibility into operational health
| Feature | @kitiumai/environments | AWS Systems Manager | Azure App Configuration | HashiCorp Vault | Kubernetes ConfigMaps |
|---|---|---|---|---|---|
| TypeScript Native | β Full type safety | β | β | β | β |
| Secrets Management | β Multi-provider | β AWS only | β | β Enterprise | β |
| Authentication/RBAC | β Built-in | β AWS IAM | β Azure AD | β Enterprise | β |
| Audit Logging | β Structured events | β CloudTrail | β Activity logs | β Enterprise | β |
| Deployment Pipelines | β Native support | β | β | β | β |
| Change Management | β Request workflows | β | β | β | β |
| Multi-Environment | β Hierarchies | β Stacks | β Environments | β | β |
| Infrastructure as Code | β Provider abstraction | β CloudFormation | β ARM | β | β |
| Monitoring/Alerting | β Built-in | β CloudWatch | β Azure Monitor | β | β |
| Plugin Ecosystem | β Extensible | β | β | β Enterprise | β |
| Open Source | β MIT License | β | β | β Enterprise | β Apache |
- Zero-config secrets: Type-safe secrets access with compile-time validation
- RBAC as code: Define permissions and roles in TypeScript with full type checking
- Audit as infrastructure: Structured audit events with compliance reporting built-in
- IntelliSense everywhere: Full autocomplete for all APIs and configurations
- Type-safe configurations: Catch configuration errors at compile time
- Unified API surface: Single import for all environment operations
- Deployment pipelines: Native CI/CD pipeline management with approvals and rollback
- Change management: Structured change request workflows with review processes
- Multi-region HA: Built-in high availability with automatic failover
- Webhook support: Real-time notifications and external system integration
- Plugin architecture: Extend functionality with custom plugins and extensions
- Multi-provider secrets: Support for Vault, AWS, GCP, Azure, and custom providers
- Structured monitoring: Metrics collection with alerting and dashboards
- Compliance reporting: Automated compliance checks and violation detection
- Backup & recovery: Encrypted backups with integrity verification
npm install @kitiumai/environments
# or
pnpm add @kitiumai/environments
# or
yarn add @kitiumai/environmentsimport { EnvironmentResolver, SecretsBroker } from '@kitiumai/environments';
async function setupEnvironment() {
// Create environment hierarchy
const resolver = new EnvironmentResolver();
const env = await resolver.resolve('production', {
name: 'web-app',
secrets: [
{ provider: 'vault', path: 'kv/prod/database' },
{ provider: 'aws', path: 'secrets/api-keys' }
]
});
// Initialize secrets broker
const broker = new SecretsBroker(env);
const secrets = await broker.fetchAll();
console.log('Environment ready:', env.name);
console.log('Secrets loaded:', Object.keys(secrets));
}import { AuthProvider, RBACAuthProvider } from '@kitiumai/environments';
async function authenticateUser() {
const auth = new RBACAuthProvider();
// Authenticate user
const user = await auth.authenticate('user123:john.doe:admin,developer');
// Check permissions
const canDeploy = await auth.authorize(user, {
resource: 'environments',
action: 'deploy',
conditions: { environment: 'production' }
});
console.log(`User ${user.username} can deploy:`, canDeploy);
}import { AuditLogger, ComplianceReport } from '@kitiumai/environments';
async function auditOperations() {
const audit = new AuditLogger();
// Log an operation
await audit.log({
type: 'environment_update',
userId: 'user123',
resource: 'web-app',
action: 'deploy',
success: true,
details: { version: '1.2.3' }
});
// Generate compliance report
const report = await audit.generateComplianceReport(
new Date('2025-01-01'),
new Date('2025-12-31')
);
console.log('Compliance violations:', report.violations.length);
}import { DeploymentPipelineManager } from '@kitiumai/environments';
async function runDeployment() {
const manager = new DeploymentPipelineManager();
// Create deployment pipeline
const pipelineId = manager.createPipeline({
name: 'web-app-deploy',
description: 'Production deployment pipeline',
environments: ['staging', 'production'],
stages: [
{
name: 'build',
actions: [{ type: 'provision', name: 'build-app' }]
},
{
name: 'test',
actions: [{ type: 'test', name: 'run-tests' }],
requiresApproval: true
},
{
name: 'deploy',
actions: [{ type: 'provision', name: 'deploy-to-prod' }],
rollbackOnFailure: true
}
]
});
// Execute pipeline
const executionId = await manager.executePipeline(
pipelineId,
'production',
'user123'
);
console.log('Deployment started:', executionId);
}import { ChangeManagementSystem } from '@kitiumai/environments';
async function manageChanges() {
const cms = new ChangeManagementSystem();
// Create change request
const changeId = cms.createChangeRequest({
title: 'Update database schema',
description: 'Add new user table for authentication',
environment: 'production',
changes: [
{
type: 'add',
resource: 'database.migrations',
newValue: '001_create_users_table.sql',
description: 'New migration file'
}
],
createdBy: 'developer123'
});
// Submit for review
cms.submitForReview(changeId);
// Approve change
cms.approveChangeRequest(changeId, 'architect456');
// Implement change
cms.implementChangeRequest(changeId);
console.log('Change implemented:', changeId);
}import { IntegrationRegistry, WebhookProvider } from '@kitiumai/environments';
async function setupIntegrations() {
const registry = new IntegrationRegistry();
// Register webhook integration
registry.registerProvider('webhook', new WebhookProvider());
await registry.registerIntegration({
id: 'slack-notifications',
name: 'Slack Notifications',
type: 'webhook',
config: {
url: 'https://hooks.slack.com/services/...',
events: ['deployment_complete', 'security_alert']
}
});
// Execute integration
await registry.executeIntegration('slack-notifications', {
event: 'deployment_complete',
payload: { app: 'web-app', version: '1.2.3' }
});
console.log('Notification sent to Slack');
}Manages multi-environment hierarchies with inheritance.
class EnvironmentResolver {
resolve(name: string, spec: EnvironmentSpec): Promise<EnvironmentSpec>
validate(spec: EnvironmentSpec): ValidationResult
}Unified interface for secrets management across multiple providers.
class SecretsBroker {
constructor(spec: EnvironmentSpec, options?: SecretsOptions)
fetchAll(): Promise<Record<string, string>>
rotateSecrets(): Promise<void>
getProvider(name: string): SecretsProvider | undefined
}Authentication and authorization interface.
interface AuthProvider {
authenticate(token: string): Promise<User>
authorize(user: User, permission: Permission): Promise<boolean>
}Structured audit logging with compliance reporting.
class AuditLogger {
constructor(sink: AuditSink, config?: AuditConfig)
log(event: Omit<AuditEvent, 'id' | 'timestamp'>): Promise<void>
query(filter: AuditQuery): Promise<AuditEvent[]>
generateComplianceReport(start: Date, end: Date): Promise<ComplianceReport>
}Manages deployment pipelines with approvals and rollback.
class DeploymentPipelineManager {
constructor(executor?: DeploymentExecutor)
createPipeline(pipeline: Omit<DeploymentPipeline, 'id' | 'createdAt' | 'updatedAt'>): string
executePipeline(pipelineId: string, environment: string, triggeredBy: string): Promise<string>
getExecution(id: string): DeploymentExecution | undefined
}Structured change request management.
class ChangeManagementSystem {
createChangeRequest(request: Omit<ChangeRequest, 'id' | 'status' | 'createdAt' | 'comments'>): string
submitForReview(id: string): boolean
approveChangeRequest(id: string, reviewedBy: string): boolean
implementChangeRequest(id: string): boolean
}Manages ecosystem integrations (webhooks, APIs, plugins, etc.).
class IntegrationRegistry {
registerProvider(type: IntegrationType, provider: IntegrationProvider): void
registerIntegration(config: Omit<IntegrationConfig, 'createdAt' | 'updatedAt'>): Promise<ValidationResult>
executeIntegration(id: string, context: IntegrationContext): Promise<IntegrationResult>
getIntegrationStats(): IntegrationStats
}Core environment specification with secrets, toolchains, and policies.
type EnvironmentSpec = {
name: string;
description?: string;
secrets?: SecretProvider[];
toolchains?: Toolchain[];
policies?: string[];
checks?: string[];
environments?: EnvironmentHierarchy[];
region?: string;
backup?: BackupConfig;
}Authentication and authorization types.
type User = {
id: string;
username: string;
roles: string[];
tenant?: string;
metadata?: Record<string, unknown>;
}
type Permission = {
resource: string;
action: string;
conditions?: Record<string, unknown>;
}Structured audit event with compliance information.
type AuditEvent = {
id: string;
type: AuditEventType;
timestamp: Date;
userId?: string;
username?: string;
tenant?: string;
resource: string;
action: string;
success: boolean;
details?: Record<string, unknown>;
ipAddress?: string;
userAgent?: string;
correlationId?: string;
}Complete deployment pipeline specification.
type DeploymentPipeline = {
id: string;
name: string;
description?: string;
stages: DeploymentStage[];
environments: string[];
triggers?: DeploymentTrigger[];
createdAt: Date;
updatedAt: Date;
}Change management request with approval workflow.
type ChangeRequest = {
id: string;
title: string;
description: string;
environment: string;
changes: ChangeItem[];
status: 'draft' | 'pending_review' | 'approved' | 'rejected' | 'implemented';
createdBy: string;
createdAt: Date;
reviewedBy?: string;
reviewedAt?: Date;
implementedAt?: Date;
comments?: ChangeComment[];
}Configuration for ecosystem integrations.
type IntegrationConfig = {
id: string;
name: string;
type: IntegrationType;
description?: string;
version: string;
status: IntegrationStatus;
config: Record<string, unknown>;
metadata: IntegrationMetadata;
createdAt: Date;
updatedAt: Date;
lastUsedAt?: Date;
}import { SecretsProvider } from '@kitiumai/environments';
class CustomSecretProvider implements SecretsProvider {
readonly name = 'custom';
async fetchSecret(path: string): Promise<string> {
// Implement custom secret fetching logic
return `secret-for-${path}`;
}
async rotateSecret?(path: string): Promise<void> {
// Implement secret rotation
}
}
// Register custom provider
const broker = new SecretsBroker(spec);
broker.registerProvider(new CustomSecretProvider());import { Plugin } from '@kitiumai/environments';
const myPlugin: Plugin = {
name: 'my-plugin',
version: '1.0.0',
hooks: {
onEnvironmentCreate: async (context) => {
console.log('Environment created:', context.environment.name);
},
onSecretFetch: async (context) => {
console.log('Secret fetched:', context.path);
}
}
};
// Register plugin
import { getPluginManager } from '@kitiumai/environments';
const pluginManager = getPluginManager();
pluginManager.register(myPlugin);import { MonitoringProvider, Metric } from '@kitiumai/environments';
class DataDogProvider implements MonitoringProvider {
async recordMetric(metric: Metric): Promise<void> {
// Send to DataDog
console.log('Metric recorded:', metric.name, metric.value);
}
async queryMetrics(query: MetricQuery): Promise<Metric[]> {
// Query DataDog metrics
return [];
}
}
// Use monitoring
const monitoring = new MonitoringProvider(new DataDogProvider());
await monitoring.recordCounter('deployments', 1, { environment: 'prod' });# Vault Configuration
VAULT_ADDR=https://vault.example.com
VAULT_TOKEN=your-vault-token
# AWS Configuration
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
# Azure Configuration
AZURE_KEYVAULT_URL=https://myvault.vault.azure.net
AZURE_CLIENT_ID=your-client-id
AZURE_CLIENT_SECRET=your-client-secret
AZURE_TENANT_ID=your-tenant-id
# GCP Configuration
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
GCP_PROJECT_ID=your-project-id# envkit.yaml
name: my-application
description: Production environment configuration
secrets:
- provider: vault
path: kv/prod/database
rotationDays: 30
- provider: aws
path: secrets/api-keys
toolchains:
- name: node
version: "20"
- name: python
version: "3.11"
policies:
- policies/security.rego
- policies/compliance.rego
checks:
- node --version
- python --version
backup:
enabled: true
retentionDays: 30
regions: ['us-east-1', 'us-west-2']- SOC 2 Type II: Full audit trails and compliance reporting
- HIPAA: Encrypted secrets with access logging
- PCI DSS: Secure secrets management for payment data
- GDPR: Data minimization and consent management
- Zero Trust: Every operation is authenticated and authorized
- Sub-millisecond: Secrets fetching with caching
- Horizontal scaling: Multi-region deployments with automatic failover
- Async operations: Non-blocking API calls with proper error handling
- Memory efficient: Lazy loading and garbage collection
We welcome contributions! Please see our Contributing Guide for details.
MIT License - see LICENSE file for details.
- π Documentation
- π¬ Discord Community
- π Issue Tracker
- π§ Security Issues