Skip to main content

Ledgiventa - Backend

This folder contains the AWS CDK app, Lambda functions, and backend infrastructure for Ledgiventa. All infrastructure is defined using AWS CDK (TypeScript), with modular stacks for auth, API, billing, frontend, email, and storage. Lambda functions are written in TypeScript and organized by business domain.

Structure

backend/
├── bin/ledgiventa.ts # CDK app entry point
├── lib/ # CDK stacks (auth, api, billing, frontend, email, etc.)
├── src/lambdas/ # Lambda function code (modular: buildings, ledger, units, statements, etc.)
├── cdk.out/ # Synthesized CloudFormation templates
├── package.json # Backend dependencies and scripts
└── README.md # This file

Key Features

  • Modular Lambda functions for all business logic (TypeScript, NodeJS 20.x)
  • Clerk webhook integration for user lifecycle events
  • Stripe integration for billing
  • Lambda@Edge for secure API scoping by ownerId
  • CDK stacks for all AWS resources, with cdk-nag and cdk-assert for best practices and testing
  • Shared domain models imported from shared/models for consistency
  • SSM parameters for cross-stack resource linking (no CDK outputs)
  • All stacks and constructs follow workspace coding conventions

Setup & Development

Install dependencies

npm install

Build & Deploy

# Build all lambdas
npm run build:lambdas
# Deploy all stacks
npm run deploy

Local Development

# Start backend locally (if supported)
npm run start:local

Testing

npm test

For more details, see Infrastructure Guide and Development Guide.

Scripts

  • build:lambdas: Build all Lambda functions
  • deploy: Deploy all CDK stacks
  • destroy: Destroy all CDK stacks
  • synth: Synthesize CloudFormation templates
  • test: Run backend tests

Dependencies

See package.json for all dependencies. Key packages:

  • aws-cdk-lib, constructs, aws-sdk
  • Clerk, Stripe SDKs
  • Typescript, Jest, ESLint, Prettier

Documentation

See ../docs/infrastructure/README.md for infrastructure details. See ../docs/guides/development.md for development setup.

Notes

  • Ensure AWS credentials are configured before deploying.
  • Breaking changes to CDK stacks may require a full destroy/redeploy.
  • All sensitive information must be managed via environment variables or AWS Secrets Manager.

License

Proprietary - All Rights Reserved