Serverless TypeScript Project
This folder contains AWS Lambda functions deployed via the Serverless Framework, written in TypeScript.
Setup
This project is configured with TypeScript, ESLint, and Prettier independently from the main project.
Prerequisites
- Node.js 22.x or higher
- npm or yarn
Installation
npm install
Development
Available Scripts
npm run build- Compile TypeScript to JavaScriptnpm run type-check- Run TypeScript type checking without emitting filesnpm run lint- Run ESLint on TypeScript filesnpm run lint:fix- Run ESLint with auto-fixnpm run format- Format code with Prettiernpm run format:check- Check if code is formatted correctly
Project Structure
src/
handlers/ # Lambda function handlers
vehicleType.ts # Vehicle type lookup handler
scrub.ts # Estimate scrubbing handler
emsupload.ts # File upload presigned URL handler
lib/ # Shared library code
vehicleTypes/ # Vehicle type utilities
db.ts # Database utilities
Deployment
The project uses serverless-esbuild for bundling TypeScript code for deployment.
# Deploy to dev stage
sls deploy --stage dev
# Deploy to production
sls deploy --stage prod
Local Development
# Run serverless offline
sls dev
Configuration
- TypeScript: Configured in
tsconfig.json - ESLint: Configured in
eslint.config.mjs(ESM flat config) - Prettier: Configured in
.prettierrc.json - Serverless: Configured in
serverless.yml
Code Quality
This project enforces:
- TypeScript strict mode
- ESLint rules for TypeScript
- Prettier formatting
- No unused variables or parameters (except those prefixed with
_)
Environment Variables
See serverless.yml for environment-specific configuration.