// getItem repository function import dynamodb from '@aws-appsync/utils'; export function request(ctx) return dynamodb.get( key: id: ctx.args.id );
: Utilize AppSync's built-in server-side caching at the resolver level to prevent unnecessary calls to your repository layer for frequently requested data. appsync repo
A clean AppSync repo = fast, secure, and scalable GraphQL APIs. This is the foundational practice
Everything in an AppSync API — the schema, resolvers, data sources, and API keys — should be defined and managed in code. This is the foundational practice. You can mock the database SDK client directly,
Testing VTL or direct AppSync JavaScript resolvers requires complex mocking tools or deploying to AWS for end-to-end integration tests. By abstracting data fetching into a repository module, you can write standard Jest or Mocha unit tests. You can mock the database SDK client directly, achieving high test coverage without touching live AWS infrastructure. 2. Code Reusability