Skip to content

What is tsops?

tsops is a TypeScript-first toolkit for planning, building, and deploying containerized applications. It replaces YAML configurations with type-safe TypeScript code, giving you the power of a programming language while maintaining the simplicity of declarative configuration.

The Problem

Deploying containerized applications traditionally involves:

  • ❌ Writing repetitive YAML files
  • ❌ Copying and pasting configurations
  • ❌ Hardcoding service names, domains, and DNS
  • ❌ Managing secrets separately from deployment
  • ❌ No type safety or validation until runtime
  • ❌ Difficult to maintain across environments

The tsops Solution

tsops provides:

  • Type-safe configuration - Catch errors at compile time
  • Context helpers - secret(), configMap(), env()
  • Single source of truth - Define once, use everywhere
  • Secret validation - Automatic checks before deployment
  • Built-in Docker - Build and push images
  • Multi-environment - Easy dev/staging/prod management

How It Works

typescript
// tsops.config.ts
import { defineConfig } from 'tsops'

export default defineConfig({
  project: 'my-app',
  domain: { prod: 'example.com' },
  
  apps: {
    api: {
      ingress: ({ domain }) => ({ domain: `api.${domain}` }),
      env: () => ({
        // ✅ In your app: config.url('postgres', 'service')
      })
    }
  }
})
bash
# Deploy
$ pnpm tsops deploy --namespace production

That's it! tsops:

  1. Resolves your configuration
  2. Builds Docker images (if needed)
  3. Generates deployment manifests
  4. Applies them to your cluster

Key Features

🎯 Type Safety

Write configuration in TypeScript with full IntelliSense support. Get instant feedback on typos and type errors.

✨ Context Helpers

Built-in helpers for common patterns:

typescript
{
  // ✅ Use runtime config in your app code:
  import config from './tsops.config'
  const POSTGRES_URL = config.url('postgres', 'service')
  // → 'http://postgres' or 'http://my-app-postgres.production.svc.cluster.local'
  
  // Use namespace variables for domain
  ingress: ({ domain }) => ({ domain: `api.${domain}` })
  // → 'api.example.com'
  
  secret('api-secrets')
  // → envFrom: secretRef
}

🔒 Secret Validation

Automatic validation before deployment:

typescript
secrets: {
  'api-secrets': () => ({
    JWT_SECRET: process.env.PROD_JWT ?? ''  // ← Validated!
  })
}

If PROD_JWT is missing, tsops:

  1. Checks if secret exists in cluster
  2. Uses cluster secret if available
  3. Shows helpful error if not

🚀 Single Source of Truth

Use the same config for deployment AND runtime:

typescript
// Deployment
env: ({ secret }) => secret('api-secrets')

// Runtime (in your app)
import config from './tsops.config'
process.env.TSOPS_NAMESPACE = 'production'
const nodeEnv = config.env('api', 'NODE_ENV')

Comparison

FeatureYAMLHelmtsops
Type Safety
IntelliSense
FunctionsLimited
ValidationRuntimeRuntimeCompile-time
Secret Validation
Context Helpers
Learning CurveLowHighMedium

Who is tsops for?

tsops is perfect for:

  • TypeScript teams - You already know the language
  • Platform engineers - Managing multiple apps and environments
  • Startups - Need to move fast with confidence
  • Teams tired of YAML - Want type safety and better DX

Next Steps

🚀 Get Started

Install tsops and deploy your first app

📖 Context Helpers

Learn about configuration helpers and runtime utilities

💡 Examples

See real-world use cases

Released under the MIT License.