AWS Blocks is an open-source TypeScript framework enabling AI agents to construct backends by bundling application code, local development, and AWS infrastructure. It emphasizes a "local-first" development model and uses built-in steering files to guide AI agents toward correct architectural patterns, abstracting away the complexities of infrastructure tools like AWS CDK while retaining an escape hatch for custom configurations.
Read original on InfoQ ArchitectureAWS Blocks is a new open-source TypeScript framework from AWS designed to streamline backend development, particularly with a focus on AI agent integration. Each "Block" encapsulates application logic, local development tooling, and the necessary AWS infrastructure, simplifying deployment from local development to production on services like Lambda, DynamoDB, Aurora, API Gateway, and Bedrock. The core innovation lies in its ability to guide AI agents to produce architecturally sound code by design, minimizing the need for developers to manage underlying infrastructure details directly.
A key design premise of Blocks is the assumption that AI agents will increasingly write code. The framework ships with "steering files" that enforce architectural best practices, ensuring that code generated by AI agents adheres to correct patterns from the outset. This approach aims to reduce both human learning curves and potential errors introduced by AI, pushing towards a future where robust backend architectures are produced systematically.
Blocks adopts a local-first development model, allowing developers to run a full-stack application (with Postgres, authentication, real-time messaging, file storage) on their local machine without an AWS account. It leverages Node.js conditional exports to swap between local in-memory implementations (e.g., for KVStore) and actual AWS services (DynamoDB, Aurora) at deployment time, ensuring consistency. The framework generates AWS infrastructure using best practices, effectively providing an infrastructure-from-code experience.
const kvStore = new KVStore(scope, 'todos');
// During local dev, 'kvStore' is an in-memory store.
// At deployment, it becomes a DynamoDB table.
// In Lambda runtime, it's an SDK call to DynamoDB.Despite its opinionated nature, Blocks offers an "escape hatch" via AWS CDK. Blocks applications are fundamentally CDK applications, allowing developers to integrate any CDK construct or embed Blocks into existing CDK stacks. This prevents a "walled garden" scenario and provides flexibility for custom use cases not covered by pre-built Blocks. It also provides type safety from data schemas to various frontend frameworks and native clients, eliminating separate code generation steps.
Blocks vs. Amplify Gen 2
While both Blocks and Amplify Gen 2 define backends code-first in TypeScript on top of CDK, AWS positions them as complementary. Amplify offers hosting, CI/CD, and a managed backend, while Blocks focuses on type-safe infrastructure-from-code and local-first development, with a distinct emphasis on AI agent-driven development.