Integrations
AWS Lambda
Deploy Silgi as an AWS Lambda function — API Gateway v1 and v2 compatible.
Deploy your Silgi router as a serverless function on AWS Lambda. Works with API Gateway REST (v1) and HTTP (v2) event formats.
Setup
import { } from 'silgi/aws-lambda'
import { } from './router'
export const = (, {
: () => ({
: getDB(),
: .?.?.userId,
: .['x-forwarded-for'],
}),
})API Gateway configuration
Map a catch-all route to your Lambda:
ANY /rpc/{proxy+} → your-lambda-functionThen set the prefix in the adapter:
export const = silgiLambda(appRouter, {
: '/rpc',
: () => ({ : getDB() }),
})Input parsing
- POST/PUT/PATCH — body is parsed as JSON
- GET — input from
?data=query parameter - Base64-encoded bodies (API Gateway binary mode) are decoded automatically
Cold start optimization
Silgi compiles the router once at module load time. The compiled pipeline is reused across Lambda invocations — no per-request compilation overhead.
// Router is compiled once, reused across invocations
import { } from "./router"
export const = silgiLambda(, { ... })For minimal cold starts, keep your Lambda package small. Silgi's single-package design helps — no 35+ scoped packages to load.
What's next?
- Server —
serve()for non-serverless deployments - Integrations — other available integrations