{"id":22196931,"url":"https://github.com/serverless-appsync/multiple-apis","last_synced_at":"2026-02-06T12:16:36.039Z","repository":{"id":115611330,"uuid":"499888501","full_name":"serverless-appsync/multiple-apis","owner":"serverless-appsync","description":"An example on how to use Serverless Framework Compose to deploy several AppSync APIs that share resources","archived":false,"fork":false,"pushed_at":"2022-06-04T17:08:24.000Z","size":88,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-24T22:41:48.877Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serverless-appsync.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-04T17:07:12.000Z","updated_at":"2024-03-06T20:08:35.000Z","dependencies_parsed_at":"2023-03-08T17:00:53.199Z","dependency_job_id":null,"html_url":"https://github.com/serverless-appsync/multiple-apis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/serverless-appsync/multiple-apis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-appsync%2Fmultiple-apis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-appsync%2Fmultiple-apis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-appsync%2Fmultiple-apis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-appsync%2Fmultiple-apis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serverless-appsync","download_url":"https://codeload.github.com/serverless-appsync/multiple-apis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-appsync%2Fmultiple-apis/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266189677,"owners_count":23890065,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-02T14:17:46.770Z","updated_at":"2026-02-06T12:16:35.639Z","avatar_url":"https://github.com/serverless-appsync.png","language":null,"readme":"[serverless-appsync-plugin](https://github.com/sid88in/serverless-appsync-plugin/) dropped [support for several APIs](https://github.com/sid88in/serverless-appsync-plugin/blob/alpha/doc/upgrading-from-v1.md#single-api-only) in the same stack starting from v2.\nThis repository shows an example of how you can still deploy several APIs, even if they have shared schemas and resources by leveraging [Serverless Framework Compose](https://www.serverless.com/framework/docs/guides/compose). This is the new reommended way to achieve this.\n\nA common use case is to be able to build a public and private APIs that share some parts of the schema, dataSources and resolvers.\n\n# Shared resources\n\nWhen working on a project with several APIs, they may share some resources. For example, they might need to access the same DynamoDB table. Thanks to [Serverless Framework Compose](https://www.serverless.com/framework/docs/guides/compose), you can deploy those in a first \"common\" stack and then pass down the references as input parameters to the underlying services.\n\nexample:\n\n```yaml\nservices:\n  common:\n    path: common\n\n  private:\n      path: private\n      dependsOn: common\n      params:\n        usersTableName: ${common.usersTableName}\n\n    public:\n      path: public\n      dependsOn: common\n      params:\n        usersTableName: ${common.usersTableName}\n```\n\nFor more information, refer to the [official documentation](https://www.serverless.com/framework/docs/guides/compose)\n\n# Shared and extended types\n\nserverless-appsync-plugin supports defining your schema in several files.\nThis allows you to place common parts of the schema in a file that will be shared by several APIs.\n\n```yaml\nschema:\n  - ../assets/schemas/*.graphql\n  - schema.graphql\n```\n\nAll the schema files will be merged together\n\nYou might also want to extend some types. For example, the admin API might need to expose a `isAdmin` field on the `User` type that you want to keep secret (unexposed) in the public API. You can do so thanks to [schema extension](https://spec.graphql.org/October2021/#sec-Schema-Extension). In your private schema, extend the `User` type:\n\n```graphql\nextend type User {\n  isAdmin: Boolean!\n}\n```\n\nfor more details and examples, check the [common](assets/schemas//schema.graphql), [public](public/schema.graphql) and [private](private/schema.graphql) schema files.\n\n# Shared data sources and resolvers\n\nWhen several APIs share some Queries and Mutations, you don't want to have to duplicate the `dataSources` and `resolvers` definitions, or your mapping templates.\nTo avoid that, you can place them in [separate files](https://www.serverless.com/framework/docs/providers/aws/guide/variables#multiple-configuration-files) and reference them in your API definitions.\n\n```yaml\ndataSources:\n  # common dataSources\n  - ${file(../assets/templates/dataSources.yml)}\n\nresolvers:\n  # common resolvers\n  - ${file(../assets/templates/usersResolvers.yml)}\n\n  # public only resolvers\n  - Query.getMe: users\n    Mutation.updateMe: users\n```\n\nSee [private/serverless.yml](private/serverless.yml) and [public/serverless.yml](public/serverless.yml)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverless-appsync%2Fmultiple-apis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserverless-appsync%2Fmultiple-apis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverless-appsync%2Fmultiple-apis/lists"}