- Home
- Skills
- Gilbertopsantosjr
- Fullstacknextjs
- Gs Sst Infra
gs-sst-infra_skill
1
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill gilbertopsantosjr/fullstacknextjs --skill gs-sst-infra- SKILL.md5.7 KB
Overview
This skill is a practical guide for building AWS serverless infrastructure with SST v3. It covers a production-ready structure: DynamoDB configuration, Next.js deployment with OpenNext streaming, Lambda handlers using a thin adapter Clean Architecture pattern, and CI/CD via GitHub Actions. The content focuses on clear patterns, environment stages, and local development tips.
How this skill works
The guide defines stacks for DynamoDB, Next.js, and API routes in SST configuration, exposing outputs like site URL and table name. Lambda handlers are implemented as thin adapters that initialize a DI container on cold start, resolve use cases, and map domain exceptions to HTTP responses. Next.js is deployed with streaming Lambda wrappers, and CI/CD uses a GitHub Actions workflow that assumes an AWS role and runs npx sst deploy.
When to use it
- Building a serverless web app with Next.js and AWS Lambda streaming
- Needing a single DynamoDB table with primary and global secondary indexes
- Implementing Clean Architecture with DI and thin Lambda adapters
- Setting up stage-aware domains and environment-specific protection
- Automating deployments with GitHub Actions and SST
Best practices
- Use a single DynamoDB table with thoughtfully designed PK/GSI keys to minimize costs and simplify queries
- Keep Lambda handlers thin: resolve use case from DI, execute, and map errors to responses
- Initialize dependency injection once per cold start to reduce runtime overhead
- Set billingMode to PAY_PER_REQUEST for bursty serverless workloads
- Protect and retain prod resources while allowing dev/test stages to be removed
Example use cases
- Public Next.js storefront with server-side rendering and streamed responses using Lambda streaming
- CRUD APIs backed by a single DynamoDB table and organized by clean use-case modules
- Multi-stage deployments (dev/test/prod) with stage-specific domains and resource protection
- Local development using DynamoDB Local and environment flags for faster iteration
- CI-driven deployments that assume an AWS role and run SST deploy in GitHub Actions
FAQ
The Next.js stack sets the domain dynamically based on stage, prefixing non-prod stages and resolving DNS through a provided zone.
How do Lambdas handle domain errors and domain exceptions?
Handlers catch DomainException instances and return 400 responses with a code; other errors log and return a 500 Internal Server Error.