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

tfts

v0.3.8

Published

TypeScript-first infrastructure as code for Terraform

Readme

tfts

A TypeScript SDK for defining Terraform infrastructure as code. Drop-in replacement for CDKTF.

Documentation

Installation

npm install tfts

Quick Start

Create configuration file

Create cdktf.json in your project root:

{
  "language": "typescript",
  "app": "bun run main.ts",
  "terraformProviders": ["hashicorp/google@~>6.0"]
}

Generate provider bindings

npx tfts get

Define your infrastructure

// main.ts
import { App, TerraformStack, TerraformOutput } from "tfts";
import { GoogleProvider } from "./.gen/providers/hashicorp/google/provider.js";
import { ComputeInstance } from "./.gen/providers/hashicorp/google/resources/compute-instance.js";

class MyStack extends TerraformStack {
  constructor(scope: App, id: string) {
    super(scope, id);

    new GoogleProvider(this, "google", {
      project: "my-project",
      region: "us-central1",
    });

    const instance = new ComputeInstance(this, "vm", {
      name: "my-instance",
      machineType: "e2-micro",
      zone: "us-central1-a",
      bootDisk: {
        initializeParams: {
          image: "debian-cloud/debian-11",
        },
      },
      networkInterface: [{ network: "default" }],
    });

    new TerraformOutput(this, "instance-ip", {
      value: instance.networkInterface.get(0).networkIp,
    });
  }
}

const app = new App();
new MyStack(app, "my-stack");
app.synth();

Synthesize and deploy

npx tfts synth
cd cdktf.out/stacks/my-stack
terraform init
terraform apply

CLI Commands

| Command | Description | |---------|-------------| | tfts get | Generate provider bindings from cdktf.json | | tfts synth | Synthesize Terraform JSON configuration | | tfts diff | Show planned changes (terraform plan) | | tfts deploy | Deploy the stack (terraform apply) | | tfts destroy | Destroy the stack (terraform destroy) | | tfts output | Show stack outputs (terraform output) | | tfts list | List all stacks | | tfts force-unlock | Release a stuck state lock |

Core Concepts

App & Stack

const app = new App();
new MyStack(app, "production");
new MyStack(app, "staging");
app.synth();

Variables & Outputs

const region = new TerraformVariable(this, "region", {
  type: "string",
  default: "us-central1",
});

new TerraformOutput(this, "url", {
  value: instance.selfLink,
  sensitive: true,
});

References

Resource attributes automatically create Terraform references:

const bucket = new StorageBucket(this, "bucket", { name: "my-bucket" });
new ComputeInstance(this, "vm", {
  metadata: { bucket: bucket.name }, // Creates ${google_storage_bucket.bucket.name}
});

Functions

import { Fn } from "tfts";

Fn.join("-", ["hello", "world"]);
Fn.lookup(myMap, "key", "default");
Fn.base64encode("hello");

Backends

import { GcsBackend, S3Backend, RemoteBackend } from "tfts";

new GcsBackend(this, { bucket: "my-tf-state", prefix: "prod" });

Migrating from CDKTF

See the Migration Guide for detailed instructions.

Quick start:

# Remove CDKTF, add tfts
npm remove cdktf cdktf-cli @cdktf/provider-aws @cdktf/provider-google
npm install tfts

# Run migration script (rewrites imports)
curl -O https://raw.githubusercontent.com/swen128/terraform-ts/main/scripts/migrate-from-cdktf.ts
bun migrate-from-cdktf.ts .

# Regenerate provider bindings
npx tfts get

License

MIT