{"id":13880921,"url":"https://github.com/ryands17/graphql-api-cdk-serverless-postgres","last_synced_at":"2025-07-16T17:31:19.919Z","repository":{"id":38400702,"uuid":"314257477","full_name":"ryands17/graphql-api-cdk-serverless-postgres","owner":"ryands17","description":"A basic example of AppSync + Lambda resolvers with AWS Aurora Serverless and Prisma","archived":false,"fork":true,"pushed_at":"2023-04-04T01:16:30.000Z","size":858,"stargazers_count":72,"open_issues_count":0,"forks_count":15,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-24T09:34:14.575Z","etag":null,"topics":["appsync","cdk","serverless"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"dabit3/graphql-api-cdk-serverless-postgres","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryands17.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}},"created_at":"2020-11-19T13:32:33.000Z","updated_at":"2023-11-30T21:38:22.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ryands17/graphql-api-cdk-serverless-postgres","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ryands17/graphql-api-cdk-serverless-postgres","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryands17%2Fgraphql-api-cdk-serverless-postgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryands17%2Fgraphql-api-cdk-serverless-postgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryands17%2Fgraphql-api-cdk-serverless-postgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryands17%2Fgraphql-api-cdk-serverless-postgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryands17","download_url":"https://codeload.github.com/ryands17/graphql-api-cdk-serverless-postgres/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryands17%2Fgraphql-api-cdk-serverless-postgres/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265527547,"owners_count":23782480,"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":["appsync","cdk","serverless"],"created_at":"2024-08-06T08:03:39.636Z","updated_at":"2025-07-16T17:31:19.453Z","avatar_url":"https://github.com/ryands17.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# CDK API with GraphQL and Aurora Serverless PostgreSQL and Prisma\n\nThis is a fork of a repo which was [livestreamed](https://youtu.be/pXd9BCwpjhA) by [Nader Dabit](https://twitter.com/dabit3) that is modified to use [Prisma](https://www.prisma.io/).\n\n## Warning: The stack is not free\n\nThis stack will not come under the free tier. To delete all resources after you're done, use the following command:\n\n```sh\nyarn cdk destroy --profile profileName\n```\n\nWhere the `profileName` is your AWS profile name. I have used `prisma_demo` here but you can replace that with any profile.\n\nThis CDK stack deploys a real-time GraphQL API built with AWS AppSync, Amazon Aurora Serverless PostgreSQL, AWS Lambda, and [Prisma](https://www.prisma.io/).\n\n![CDK API with GraphQL, Aurora Serverless PostgreSQL, and Prisma](header.png)\n\n## Getting started\n\nTo deploy this project, follow these steps.\n\n**1. Clone the project**\n\n```sh\ngit clone https://github.com/ryands17/graphql-api-cdk-serverless-postgres.git\n```\n\n**2. Change into the new directory and install dependencies**\n\n```sh\ncd graphql-api-cdk-serverless-postgres\nyarn\n```\n\n**3. Change into the _lambda-fns_ directory and install the dependencies for the Lambda function package:**\n\n```sh\ncd lambda-fns\nyarn\ncd ..\n```\n\n**4. Initialize `cdk.context.json` in the root directory with the following values (The account ID should match the one you're deploying to)**\n\n```json\n{\n  \"region\": \"us-east-1\",\n  \"accountID\": \"123456789012\",\n  \"keyName\": \"sshKeyName\"\n}\n```\n\n**5. Deploy the stack**\n\n**_Note_**: I have deployed using an AWS Profile named `default`. To use your own profile, add the `profile` option after the deploy command like this:\n\n```\nyarn deploy --profile profile_name\n```\n\nLearn more about how to create an AWS profile [here](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html).\n\n```sh\nyarn deploy\n```\n\n**6. Create the posts table**\n\nVisit the [RDS dashboard](https://console.aws.amazon.com/rds/home) and click on **Query Editor**. From the dropdown menu, choose the database (it should begin with **appsynccdkrdsstack-aurorablogcluster**).\n\nFor the Database username, choose **Connect with a Secrets Manager ARN**.\n\nTo sign in, you will need the ARN from the secret that was created by CDK. To get this secret, in a new window open [AWS Secrets manager](https://console.aws.amazon.com/secretsmanager/home). Here, click on the secret that was created by CDK (it should start with **AuroraBlogClusterSecret**). Copy the Secret ARN to your clipboard and go back to the RDS Query Editor.\n\nNext, use the **Secret ARN** as the **Secrets Manager ARN** and **BlogDB** as the name of the database. Next, press enter and click on Connect to Database.\n\nOnce signed in, create the **posts** table by executing the following query:\n\n```sql\ncreate table posts (\n id text primary key,\n title text,\n content text\n);\n```\n\n**7. Testing the API**\n\nNext, visit the [AppSync console](https://console.aws.amazon.com/appsync/home) and click on **cdk-blog-appsync-api** to view the dashboard for your API.\n\nNext click on **Queries** in the left hand menu to view the query editor. From here, we can test out the API by running the following queries and mutations:\n\n```graphql\nmutation createPost {\n  createPost(\n    post: { id: \"001\", title: \"My first post!\", content: \"Hello world!\" }\n  ) {\n    id\n    title\n    content\n  }\n}\n\nquery listPosts {\n  listPosts {\n    id\n    title\n    content\n  }\n}\n\nquery getPostById {\n  getPostById(postId: \"001\") {\n    id\n    title\n    content\n  }\n}\n\nmutation updatePost {\n  updatePost(post: { id: \"001\", title: \"My updated post!\" }) {\n    id\n    title\n  }\n}\n\nmutation deletePost {\n  deletePost(postId: \"001\")\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryands17%2Fgraphql-api-cdk-serverless-postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryands17%2Fgraphql-api-cdk-serverless-postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryands17%2Fgraphql-api-cdk-serverless-postgres/lists"}