Name:
interface
Value:
Extend your Amplify Gen 2 app with AWS Blocks — self-contained backend capabilities you compose into your existing backend.
Gen1 DocsLegacy

Page updated Jul 2, 2026

Connect your frontend

AWS Blocks generates a typed client from your backend so your frontend calls methods directly — there is no code to write for the transport. How you generate and authenticate the client depends on your platform.

AWS Blocks provides native clients for Swift, Kotlin, and Dart/Flutter. These are build-time code generators that produce a type-safe client from your backend's Blocks spec (blocks.spec.json), paired with a runtime library that calls your backend over JSON-RPC.

The Amplify auto-integration scaffolds a JavaScript client and Cognito middleware automatically. For native clients, you generate the client from the Blocks spec and attach the Amplify session token yourself, as shown below. See the AWS Blocks Developer Guide for the per-platform setup.

Generate the native client

Each native client generates type-safe code from your backend's blocks.spec.json:

  • Dart/Flutter — generates a typed Dart client from your Blocks spec.

Find the Blocks API URL under custom.blocks_api_url in the amplify_outputs.json produced by your deployment, and point the generated client at it.

Authenticate with your Amplify session

Protected Blocks operations expect the Cognito token Amplify issues. Use the Amplify Auth library for your platform to fetch the current session's ID token and attach it as a Bearer token on requests the native client sends. On the backend, CognitoVerifier validates that token against the same user pool — no separate sign-in is required.

Next steps