backend

Implements a BFF-on-Lambda reference architecture with Hono, middleware, DynamoDB, and OpenAPI contracts.

Updated Jun 4, 2026
One-click install
npx skills add https://github.com/tedeuxx/tadeumendonca-skills --skill backend-tedeuxx
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend
Source: https://github.com/tedeuxx/tadeumendonca-skills/tree/main/skills/backend
Command: npx skills add https://github.com/tedeuxx/tadeumendonca-skills --skill backend-tedeuxx

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Teams building a Backend-for-Frontend on AWS Lambda lack a consistent, opinionated pattern for structuring the app, wiring cross-cutting middleware, and keeping the API contract in sync with code. This Skill preserves a complete BFF-on-Lambda reference architecture so a new project can adopt proven conventions instead of reinventing them. ## Core Features & Use Cases - Hono modular monolith pattern: One OpenAPIHono app on a single Lambda where domain modules register routes, with zod schemas that both validate requests and generate the OpenAPI contract. - Cross-cutting middleware: Standardized error handling (typed AppError classes), Powertools structured logging, EMF metrics, X-Ray tracing, and a DynamoDB audit trail driven by centrally declared action types that also power RBAC and feature toggles. - Supporting patterns: Redis cache-aside, config and Secrets Manager access, Cognito-externalized auth, notifications, and OG-image/bot-rendering guidance. - Use Case: When starting a project that needs an API behind a SPA, apply this Skill to scaffold the BFF module structure, middleware order, and error/audit conventions in one pass. ## Quick Start Ask the agent to implement a new BFF endpoint module following the backend skill's Hono route, middleware, and audit conventions.

Frequently Asked Questions about backend

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a BFF on AWS Lambda with Hono?

Create one OpenAPIHono app in a single Lambda entry point, wire middleware for logging and errors, then register each domain module's routes onto that app. Each module contains routes.ts, handler.ts, repository.ts, and vitest tests rather than its own Lambda.

How does zod-openapi keep the API contract in sync with handlers?

Routes are declared with createRoute and zod schemas, then mounted via app.openapi. The same schema validates incoming requests and generates the OpenAPI 3.1 document, so the contract cannot drift from the handler implementation.

Should authentication code live inside the BFF Lambda?

No. The SPA uses the Cognito SDK to hold the JWT, and an API Gateway Cognito authorizer validates every request before it reaches the BFF. The BFF only reads validated claims like sub and cognito:groups for RBAC and response shaping.

Why use EMF metrics instead of Prometheus on Lambda?

Lambda is ephemeral, so Prometheus pull-based scraping has no stable endpoint. Powertools Metrics writes EMF-formatted log lines that CloudWatch auto-extracts as metrics, requiring no collector and no cloudwatch:PutMetricData IAM permission.

When should a BFF module be split into a microservice?

Start as a modular monolith for fastest delivery. Split a module into a microservice the BFF calls when it grows, keeping the SPA contract stable since the BFF owns the public OpenAPI contract while internal services keep private contracts.

What are the limitations of this BFF reference pattern?

It is a retired reference architecture, not a description of any live deployment, so nothing exercises it to keep it current. It also accepts trade-offs like tokens in the browser, a shared Lambda fault domain, and per-request audit write costs.