json.cf is a dead simple, latency-optimized JSON config service at the edge. Perfect for feature flags, remote configuration, and dynamic settings that need to be accessible with minimal latency worldwide.
- Edge Optimized - Deployed on Cloudflare Workers for sub-50ms global latency
- Private Configs - Secure configurations with secret-based authentication
- Framework Agnostic - Works with any JavaScript framework or vanilla JS
- React Integration - Built-in React hooks with automatic state management
- Real-time Updates - Instantly update configs without deployments
- REST API - Simple HTTP API for any language or platform
import { jsonConfig } from "json.cf";
// Create a config instance
const config = jsonConfig({
id: "your-config-id",
secret: "your-secret", // Optional, for private configs
});
// Get a specific value
const featureFlag = await config.get("featureEnabled");
// Get entire config
const allConfig = await config.getConfig();
import { useJsonConfig } from "json.cf/react";
function MyComponent() {
const { data, loading, error } = useJsonConfig({
id: "your-config-id",
secret: "your-secret", // Optional
});
if (loading) return <div>Loading...</div>;
if (error) return <div>Error: {error}</div>;
return <div>Feature enabled: {data?.featureEnabled}</div>;
}
# Get entire config
curl -X GET "https://api.json.cf/v1/config/your-config-id"
# Get config with secret (for private configs)
curl -X GET "https://api.json.cf/v1/config/your-config-id" \
-H "X-Config-Secret: your-secret"
# Create new config
curl -X POST "https://api.json.cf/v1/config" \
-H "Content-Type: application/json" \
-d '{"featureEnabled": true, "theme": "dark"}'
# Update existing config
curl -X PUT "https://api.json.cf/v1/config/your-config-id" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-secret" \
-d '{"featureEnabled": false, "theme": "light"}'
Manage your configs visually at json.cf.
- Feature Flags - Toggle features on/off without deployments
- A/B Testing - Dynamic configuration for experiments
- Theme Settings - Remote theme and styling configurations
- API Keys - Securely store and rotate API keys
- Environment Variables - Dynamic environment-specific settings
- Content Management - Update copy, messages, and content remotely
npm install json.cf
# or
yarn add json.cf
# or
pnpm add json.cf
# or
bun add json.cf
Creates a new config instance.
interface ConfigOptions {
id: string; // Config ID
secret?: string; // Secret for private configs
baseUrl?: string; // Custom API base URL
}
Get a specific value from the config.
const value = await config.get("myKey");
Get the entire configuration object.
const fullConfig = await config.getConfig();
React hook for accessing config with automatic state management.
const { data, loading, error, refetch } = useJsonConfig({
id: "config-id",
secret: "optional-secret",
});
MIT License.