npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@danceroutine/tango-config

v1.10.2

Published

Configuration loader with environment profiles for Tango

Readme

@danceroutine/tango-config

@danceroutine/tango-config provides typed, validated application configuration for server-side TypeScript projects.

Tango applications use this package to work with your project's tango.config.ts, which serves a similar function to the Django settings module in Django, giving application runtime code one place to read database and migration settings, and gives the tango CLI the same source of truth when it infers migration defaults.

Install

pnpm add @danceroutine/tango-config

defineConfig() declares and validates the configuration contract. loadConfig() resolves the active environment, loads .env, and merges supported Tango environment overrides into the selected environment. The separation keeps configuration declaration and runtime resolution distinct, which makes startup behavior easier to reason about.

Quick start

import { defineConfig, loadConfig } from '@danceroutine/tango-config';

const config = defineConfig({
    current: 'development',
    environments: {
        development: {
            name: 'development',
            db: { adapter: 'sqlite', filename: 'dev.sqlite' },
            migrations: { dir: 'migrations', online: false },
        },
        test: {
            name: 'test',
            db: { adapter: 'sqlite', filename: ':memory:' },
            migrations: { dir: 'migrations', online: false },
        },
        production: {
            name: 'production',
            db: { adapter: 'postgres', url: process.env.DATABASE_URL },
            migrations: { dir: 'migrations', online: true },
        },
    },
});

const loaded = loadConfig(() => config);

The loaded result is ready for application startup. loadConfig() returns the selected environment as loaded.current, so application code usually reads loaded.current.db and loaded.current.migrations directly when it creates database clients or wires migration commands.

tango.config.ts

The usual place to use this package is a project-root tango.config.ts file:

import { defineConfig } from '@danceroutine/tango-config';

export default defineConfig({
    current: (process.env.NODE_ENV || 'development') as 'development' | 'test' | 'production',
    environments: {
        development: {
            name: 'development',
            db: {
                adapter: 'sqlite',
                filename: './.data/app.sqlite',
                maxConnections: 1,
            },
            migrations: { dir: './migrations', online: false },
        },
        test: {
            name: 'test',
            db: {
                adapter: 'sqlite',
                filename: ':memory:',
                maxConnections: 1,
            },
            migrations: { dir: './migrations', online: false },
        },
        production: {
            name: 'production',
            db: {
                adapter: 'postgres',
                url: process.env.TANGO_DATABASE_URL,
                maxConnections: 20,
            },
            migrations: { dir: './migrations', online: true },
        },
    },
});

Application code can then resolve the active environment like this:

import { loadConfig } from '@danceroutine/tango-config';
import tangoConfig from '../tango.config';

const loadedConfig = loadConfig(() => tangoConfig);
const db = loadedConfig.current.db;

Environment overrides

loadConfig() supports environment-driven overrides for Tango database and migration settings, including values such as:

  • TANGO_DB_ADAPTER
  • TANGO_DATABASE_URL
  • TANGO_DB_HOST, TANGO_DB_PORT, TANGO_DB_NAME, TANGO_DB_USER, TANGO_DB_PASSWORD
  • TANGO_SQLITE_FILENAME
  • TANGO_MIGRATIONS_DIR
  • TANGO_MIGRATIONS_ONLINE

These overrides are useful when the same application configuration needs to run in local development, CI, and production with different infrastructure values.

Public API

The root export includes defineConfig(), loadConfig(), LoadedConfig, the core configuration types, and the Zod schemas for Tango config, environments, databases, and migrations.

The root export is enough for most applications. The schema and loader subpaths are available when you want a narrower import boundary in application code or tooling.

Documentation

Development

pnpm --filter @danceroutine/tango-config build
pnpm --filter @danceroutine/tango-config typecheck
pnpm --filter @danceroutine/tango-config test

For the wider contributor workflow, use:

License

MIT