Appsync Unified Repo [hot]

// Inline resolvers (stored as assets) api.createResolver('QueryGetPostJS', typeName: 'Query', fieldName: 'getPost', code: Code.fromAsset(path.join(__dirname, 'resolvers/Query.getPost.js')), runtime: FunctionRuntime.JS_1_0_0, );

A unified repository requires a smart pipeline. You do not want to redeploy the entire GraphQL schema for a change to an unrelated Lambda data source. However, you do want atomicity. Pipeline Strategy (GitHub Actions / GitLab CI) # .github/workflows/deploy.yml on: push: paths: - 'packages/**' - 'apps/cdk/**' jobs: deploy-appsync-api: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install dependencies run: yarn install --frozen-lockfile - name: Type check all packages run: yarn tsc --noEmit - name: Build Lambda bundles run: yarn build:lambdas - name: CDK Deploy run: npx cdk deploy AppSyncUnifiedStack --require-approval never - name: Run integration tests run: yarn test:e2e appsync unified repo

// Attach resolver getPostDs.createResolver('QueryGetPostResolver', typeName: 'Query', fieldName: 'getPost', ); // Inline resolvers (stored as assets) api

const getPostLambda = new NodejsFunction(this, 'GetPostFn', entry: './packages/data-sources/src/getPost.ts', handler: 'handler', ); const getPostDs = api.addLambdaDataSource('getPostDs', getPostLambda); Pipeline Strategy (GitHub Actions / GitLab CI) #

const api = new GraphqlApi(this, 'UnifiedApi', name: 'UnifiedRepoApi', schema: Schema.fromAsset(path.join(__dirname, 'schema.graphql')), authorizationConfig: defaultAuthorization: ... , );

Because the Lambda code is in the same repo, you can use relative paths in CDK. The build process bundles the TypeScript, deploys the Lambda, then updates the resolver—all in one cdk deploy . Your stack file unifies everything: