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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@gcp-tools/cdktf

v1.20.10

Published

GCP Tools | project | infrastructure

Readme

gcp-tools/cdktf

Reusable CDKTF Stack and Construct Patterns for GCP Applications

Note

While you can use this library as is, it has been designed to be used with gcp-tools-core; an AI-enabled platform to scaffold, build and deploy robust GCP applications.

Overview

gcp-tools-cdktf is a TypeScript library providing a comprehensive set of Cloud Development Kit for Terraform (CDKTF) stack and construct patterns for Google Cloud Platform (GCP). It enables you to rapidly compose, configure, and deploy production-grade GCP infrastructure as code.

What's Included

  • Stacks (src/stacks/):

    • Infrastructure Stacks: VPC networking, IAM, Cloud SQL, Firestore (with optional composite indexes), and UI hosting.
    • Project Stacks: Patterns for host, data, and app project separation.
    • App Stacks: Application-level service composition.
    • Ingress Stacks: Patterns for API gateways and load balancers.
    • Base Stacks: Extendable base classes for custom stacks.
  • Constructs (src/constructs/):

    • Cloud Run: Easily deploy and manage Cloud Run services.
    • Cloud Functions: HTTP, CloudEvent, and scheduled functions, plus Pub/Sub subscriptions.
    • API Gateway: Securely expose APIs for your services.
    • Load Balancer: L7 load balancer for web and API traffic.
    • Pub/Sub Topics: Event-driven messaging constructs.
    • Base Constructs: Foundation for building custom application and ingress resources.
  • Utilities (src/utils/):

    • Environment Management: Centralized environment and region configuration.

Key Features

  • Composable: Mix and match constructs and stacks to fit your application's needs.
  • Best Practices: Enforces GCP security, networking, and project organization standards.
  • Least-Privilege IAM: Patterns and constructs for least-permission service account scoping and secure role assignment.
  • Strict TypeScript: All constructs and stacks are fully typed for safety and IDE support.
  • Production-Ready: Designed for real-world, multi-environment GCP deployments.

Example Project Structure

iac/
├── projects/   # Project management stacks (host, data, app projects)
├── infra/      # Core infrastructure (networking, IAM, databases, etc.)
├── app/        # Application-level services and stacks
├── ingress/    # Load balancers, API gateways, and ingress resources

Example Usage

For a full example project structure, see gcp-tools-example-app.

import { cloudrun } from '@gcp-tools/cdktf/constructs'
import { AppStack } from '@gcp-tools/cdktf/stacks/app'
import { envConfig } from '@gcp-tools/cdktf/utils'
import { type App, TerraformOutput } from 'cdktf'

export class JobsStack extends AppStack {
  public readonly apiService: cloudrun.CloudRunServiceConstruct

  constructor(scope: App) {
    super(scope, 'jobs', {
      databases: ['firestore'],
    })

    this.apiService = new cloudrun.CloudRunServiceConstruct(
      this,
      'api',
      {
        region: envConfig.regions[0],
        buildConfig: {},
        serviceConfig: {
          environmentVariables: {
            FIRESTORE_PROJECT_ID: this.firestoreDatabaseProjectId,
            NODE_ENV: 'production',
          },
        },
      },
    )
  }
}

Firestore Infra Stack with Composite Indexes

import { FirestoreInfraStack } from '@gcp-tools/cdktf/stacks/infrastructure'
import { App } from 'cdktf'

const app = new App()

new FirestoreInfraStack(app, {
  indexes: [
    {
      id: 'users-by-tenant-email',
      collection: 'users',
      fields: [
        { fieldPath: 'tenantId', order: 'ASCENDING' },
        { fieldPath: 'email', order: 'ASCENDING' },
      ],
    },
  ],
})