Skip to content

@venturekit/infra

Terminal window
npm install @venturekit/infra@dev

The main entry point for all VentureKit applications:

import { defineVenture } from '@venturekit/infra';
export default defineVenture({
base,
security,
envs: { dev, prod },
routesDir: 'src/routes',
infrastructure: { /* optional intents */ },
});

This function:

  1. Validates all configuration
  2. Discovers file-based routes from routesDir
  3. Translates infrastructure intents to AWS resources
  4. Creates Lambda functions, API Gateway, VPC, and WebSocket API
  5. Injects intent outputs into Lambda environment variables

Access the resolved configuration for the current environment:

import { getResolvedConfig } from '@venturekit/infra';
const config = getResolvedConfig(base, security, envInput);

Routes are automatically discovered from the file system:

src/routes/health/get.ts → GET /health
src/routes/tasks/post.ts → POST /tasks
src/routes/tasks/[id]/get.ts → GET /tasks/{id}

Intents are translated to provider-specific resources:

IntentAWS Resource
databasesAmazon RDS
storageAmazon S3 + CloudFront
authAmazon Cognito
queuesAmazon SQS
cachesAmazon ElastiCache
schedulesAmazon EventBridge
  • @venturekit/core — required
  • aws-cdk-lib (^2.170.0) — AWS CDK
  • constructs (^10.4.0) — CDK constructs library