Typeconf Logo

Typeconf

Adding types for your configuration

npx @typeconf/typeconf build configs
1// Define configuration models with TypeSpec
2model ProjectConfig {
3  name: string;
4  modes: Array<string>;
5  pricingCoeffs: Record<float32>;
6}
1// Generate type-safe configs using Typescript
2import {
3  ProjectConfig,
4} from "~/types/all.js";
5
6let config: ProjectConfig = {
7  name: "my-service",
8  modes: ["current", "new_test"],
9  pricingCoeffs: {
10    "london": 0.99,
11    "nyc": 1.25,
12    "sf": 9000.0,
13  },
14};
15
16export default config;
1{
2  "name": "my-service",
3  "modes": [
4    "current",
5    "new_test"
6  ],
7  "pricingCoeffs": {
8    "london": 0.99,
9    "nyc": 1.25,
10    "sf": 9000
11  }
12}

Configuration is messy. We have many different formats, YAML, JSON, random ini files, not to mention environment variables. It's hard to track changes and easy to break stuff. So we thought let's add types there! Our tool, Typeconf, allows you to define types for your configuration and read it in your code.

Features

Type-Safe Configuration

Write configuration using Typescript and never worry about type issues. Get full IDE support with autocompletion and error checking.

Network Storage

Access your configuration from our distributed storage. Check out the beta here.

Powered by TypeSpec

Define configuration types using TypeSpec format with full VSCode support. Forget YAMLs and JSON Schemas, get a powerful and expressive way to describe your configuration schema.

First-Class Types

Read configs from your code with full type safety. Currently supporting TypeScript with more languages coming.

NPM Integration

Share configs between projects using NPM packages. Version control your configuration like code.

Runtime Performance

Optimized for fast loading and minimal memory footprint. Perfect for serverless environments.

Schema Validation

Validate your configs in runtime with Zod.

Multi-Language Support

Python, Kotlin, and Swift support coming soon. Write once, use everywhere not only on web, but also on mobile.

Use Cases


    model ProductParams {
      deviceType: string;
      coefficient: number;
      isEnabled: boolean;
    }

    model ProductFlags {
      params_by_user_id: Record<ProductParams>;
      params_by_device: Record<ProductParams>;
    }
    

Feature flags and gradual rollouts

With Typeconf you can define product flags based on device type, user id, and whatever else you want.

LLM validation

You can put LLM configuration including prompts in Typeconf configs and quickly iterate over changes while keeping track of historical values.


    model AgentConfig {
        prompt: string;
        model: string;
        temperature: number;
    }
    

    // types
    model Route {
        path: string;
        backend: string;
        rateLimit: int32;
    }

    model APIGatewayConfig {
        routes: Record<Route>;
    }

    // values
    import { APIGatewayConfig } from "~/types/all.js";
    let config: APIGatewayConfig = {
        routes: {
            "/user": {
                path: "/user",
                backend: "user-service",
                rateLimit: 1000,
            },
            "/order": {
                path: "/order",
                backend: "order-service",
                rateLimit: 500,
            },
        },
    };
    export default config;
    

Infrastructure configs

You can replace tons of hard to support YAMLs with simple configuration in Typescript.

Inventory storage

You can define Typeconf configs for your data that changes rarely, like employee portal information, device firmware list.


    model Employee {
        employeeId: string;
        name: string;
        email: string;
        role: string;
    }

    model EmployeeInventory {
        employees: Record<Employee>;
    }
    

Stay Updated

Subscribe to our newsletter for the latest updates and features.

Join Our Community

Want to chat with the team and other developers? Join our Discord server!

Join Discord Server