Configuration Management

Configuration Management

Define typed configuration schemas, create isolated environments, and manage values across three tiers: public, secret, and feature flags.

Architecture

The config system is built on three core concepts that work together to provide type-safe, environment-aware configuration.

Schemas

Define the shape and validation rules for your configuration. Each key has a type, default value, and description.

Environments

Isolate configuration by deployment stage (development, staging, production) or any custom environment.

Values

Set values per environment with three tiers: public (client-safe), secret (server-only), and feature flags.

Three-Tier Configuration

Public Config

Safe to expose to clients and browsers. Examples: API base URLs, feature names, UI theme settings.

Secret Config

Server-only values that should never be exposed to clients. Examples: API keys, database credentials, signing secrets.

Feature Flags

Boolean toggles for gradual rollouts and A/B testing. Enable or disable features per environment without redeploying.

API Usage

Create a Config Schema

curl -X POST https://api.smoo.ai/organizations/{org_id}/config-schemas \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "my-app-config",
    "description": "Configuration for my application",
    "schema": {
      "API_URL": { "type": "string", "default": "https://api.example.com" },
      "MAX_RETRIES": { "type": "number", "default": 3 },
      "DEBUG_MODE": { "type": "boolean", "default": false }
    }
  }'

Set Config Values

curl -X PUT https://api.smoo.ai/organizations/{org_id}/config-values \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "schemaId": "schema_id",
    "environmentId": "env_id",
    "values": {
      "API_URL": "https://api.production.example.com",
      "MAX_RETRIES": 5
    }
  }'

SDK Usage

Use the @smooai/config SDK to read configuration values in your application with type safety and local caching.

import { createConfigClient } from "@smooai/config";

const config = createConfigClient({
    serverUrl: "https://api.smoo.ai",
    token: process.env.SMOO_ACCESS_TOKEN!,
    schemaId: "your-schema-id",
    environmentId: "your-env-id",
});

// Type-safe config access
const apiUrl = await config.get("API_URL");
const maxRetries = await config.get("MAX_RETRIES");