Appsync Unified Repo -
my-appsync-monorepo/ ├── packages/ │ ├── api/ # AppSync backend definition (CDK or Terraform) │ │ ├── graphql/ │ │ │ ├── schema.graphql │ │ │ └── resolvers/ │ │ │ ├── getPost.js # JS resolvers (AppSync JS runtime) │ │ │ └── listPosts.vtl # or legacy VTL │ │ ├── lib/ │ │ │ └── datasources.ts # DynamoDB, Lambda, HTTP │ │ └── bin/ deploy.ts # CDK stack │ ├── web/ # React/Vue frontend │ │ ├── src/ │ │ └── codegen.yml # GraphQL Code Generator config │ ├── mobile/ # React Native / iOS │ └── shared/ # Common types & validation logic └── scripts/ └── codegen-all.sh # Trigger codegen for all clients Use the AWS Cloud Development Kit (CDK) or Amplify (with CDK under the hood) to define your AppSync API inside packages/api .
Start with a simple two-package structure ( api + one client), then expand. The tooling (CDK, GraphQL Codegen, npm workspaces) is mature enough for production today. appsync unified repo
Because everything lives in packages/api , any frontend change that expects a new field forces you to update the resolver in the same PR . The magic of the monorepo happens in package.json scripts. After every schema change, regenerate all clients automatically. Because everything lives in packages/api , any frontend
Taming the GraphQL Beast: Managing AWS AppSync in a Unified Repository Taming the GraphQL Beast: Managing AWS AppSync in
// DynamoDB datasource const postTable = new dynamodb.Table(...); const postDS = api.addDynamoDbDataSource('PostDS', postTable);
If you have ever worked on a project with multiple frontends (React, iOS, Android) talking to a single GraphQL API, you know the pain: Schema drift, duplicated resolver logic, and the "it works on my machine" syndrome for GraphQL transformations.
// packages/api/lib/appsync-stack.ts import * as appsync from 'aws-cdk-lib/aws-appsync'; import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; const api = new appsync.GraphqlApi(this, 'MyUnifiedApi', { name: 'UnifiedBlogApi', schema: appsync.Schema.fromAsset('graphql/schema.graphql'), // single source of truth });