Infrastructure Intents Example
Demonstrates the full range of infrastructure intents in VentureKit.
Source: examples/infrastructure-intents/
Key Concepts Demonstrated
Section titled “Key Concepts Demonstrated”- Databases — PostgreSQL/MySQL with HA, backups, encryption
- Storage — buckets for uploads, assets, backups with CDN
- Auth — Cognito user pools with MFA and password policies
- Queues — standard and FIFO queues with dead-letter queues
- Caches — Redis/Memcached with clustering
- Schedules — rate-based and cron-based scheduled tasks
- Intent outputs — accessing provisioned resources in handlers
- Multi-environment — dev (nano/relaxed) vs prod (medium/strict)
Infrastructure Declaration
Section titled “Infrastructure Declaration”infrastructure: { databases: [ { id: 'main-db', type: 'postgres', size: 'small', name: 'app_main', highAvailability: true, backups: true }, ], storage: [ { id: 'user-uploads', purpose: 'uploads', versioned: true }, { id: 'public-assets', purpose: 'assets', cdn: true, corsOrigins: ['*'] }, ], auth: [ { id: 'user-pool', signInWith: ['email'], allowSignUp: true, mfa: 'optional' }, ], queues: [ { id: 'email-queue', type: 'standard', deadLetterQueue: true, retentionDays: 7 }, ], caches: [ { id: 'session-cache', type: 'redis', size: 'small' }, ], schedules: [ { id: 'cleanup-job', handler: 'src/jobs/cleanup.handler', schedule: { rate: '1 hour' } }, { id: 'daily-report', handler: 'src/jobs/report.handler', schedule: { cron: '0 8 * * ? *' } }, ],}Accessing Outputs
Section titled “Accessing Outputs”const outputs = ctx.intentOutputs as IntentOutputs;
outputs.databases['main-db'].endpointoutputs.storage['user-uploads'].bucketNameoutputs.storage['public-assets'].cdnUrloutputs.queues['email-queue'].queueUrloutputs.caches['session-cache'].endpointoutputs.auth['user-pool'].userPoolIdRun It
Section titled “Run It”cd examples/infrastructure-intentsnpm installvk dev