🔍

Documentation v3.2.0

Complete reference for configuring, deploying, and managing application settings with App Config.json.

Introduction

App Config.json is a developer-first configuration management platform that enables zero-downtime config updates, environment-specific overrides, and real-time synchronization across distributed systems.

â„šī¸

Version Note

This documentation covers v3.x. For legacy v2.x docs, please select the appropriate version in the header dropdown.

Installation

Install the SDK via your preferred package manager:

bash
# npm
npm install @app-config/json-sdk

# yarn
yarn add @app-config/json-sdk

# pnpm
pnpm add @app-config/json-sdk

Quick Start

Initialize the client with your project API key and fetch the latest configuration:

javascript
import { AppConfig } from '@app-config/json-sdk';

const config = new AppConfig({
  apiKey: process.env.CONFIG_API_KEY,
  environment: 'production',
  autoRefresh: true,
  refreshInterval: 30000 // 30s});

await config.init();
const features = config.get('features');
console.log(`Dark mode enabled: ${features.dark_mode}`);

Configuration Schema

Every configuration file follows a strict JSON schema. The root object contains metadata, environment-specific overrides, and feature definitions.

json
{
  "meta": {
    "version": "3.2.0",
    "updated_at": "2024-12-01T10:00:00Z"
  },
  "defaults": {
    "api_endpoint": "https://api.example.com",
    "retry_count": 3,
    "timeout_ms": 5000
  },
  "environments": {
    "staging": { "api_endpoint": "https://staging.api.example.com" },
    "production": { "timeout_ms": 8000 }
  },
  "features": {
    "dark_mode": true,
    "beta_dashboard": false
  }
}

Environment Management

App Config.json automatically merges environment-specific overrides with default values. The resolution order is:

  1. Default values
  2. Environment overrides
  3. Runtime overrides (via API)
💡

Tip

Use the CLI to preview merged configs before deployment: appconfig merge --env production

Feature Flags

Define granular feature toggles with rollouts, targeting rules, and audit trails. Flags support JSON types and can be evaluated client-side or server-side.

Property Type Description
enabled boolean Master toggle for the feature
rollout number (0-100) Percentage of users to target
targeting object[] Rule-based user segmentation
fallback any Default value if evaluation fails

JavaScript SDK

The JavaScript SDK supports Node.js, Deno, and browser environments. It includes automatic reconnection, retry logic, and type-safe getters.

typescript
import { AppConfig, z } from '@app-config/json-sdk';

// Define runtime schema validation
const schema = z.object({
  api_endpoint: z.string().url(),
  retry_count: z.number().min(1).max(10),
  features: z.record(z.string(), z.boolean())
});

const config = new AppConfig({
  schema,
  onChange: (newConfig) => {
    console.log('Config updated', newConfig);
    emit('config:update', newConfig);
  }
});

REST API Overview

Manage configurations programmatically via our REST API. All requests require authentication and must be sent over HTTPS.

Method Endpoint Description
GET /v3/config Fetch current configuration
POST /v3/config Update configuration
GET /v3/flags List feature flags
PUT /v3/flags/:id Toggle feature flag
GET /v3/audit Retrieve audit logs
âš ī¸

Deprecation Notice

v2 endpoints will be sunset on June 30, 2025. Please migrate to v3 as soon as possible.

Authentication

Authenticate requests using Bearer tokens in the Authorization header. Tokens can be generated in your dashboard under Settings > API Keys.

http
GET /v3/config HTTP/1.1
Host: api.appconfig.json
Authorization: Bearer sk_live_4eC39HqLyjWDarjtT1zdp7dc
X-Environment: production
Accept: application/json

Security Best Practices

  • Never commit API keys to version control
  • Use environment variables for secrets
  • Enable rate limiting in dashboard settings
  • Rotate keys every 90 days
  • Audit access logs monthly