{"id":13632722,"url":"https://github.com/prisma-labs/graphql-prisma-typescript","last_synced_at":"2025-04-12T22:35:43.541Z","repository":{"id":26911290,"uuid":"111322378","full_name":"prisma-labs/graphql-prisma-typescript","owner":"prisma-labs","description":"🏡  GraphQL server reference implementation (Airbnb clone) in Typescript using Prisma \u0026 graphql-yoga","archived":false,"fork":false,"pushed_at":"2022-12-22T09:46:41.000Z","size":4067,"stargazers_count":750,"open_issues_count":41,"forks_count":107,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-04-04T01:59:26.869Z","etag":null,"topics":["airbnb","graphql","graphql-binding","graphql-database","graphql-server","graphql-yoga","prisma"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prisma-labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-19T18:47:23.000Z","updated_at":"2025-03-03T06:29:59.000Z","dependencies_parsed_at":"2023-01-14T09:00:21.478Z","dependency_job_id":null,"html_url":"https://github.com/prisma-labs/graphql-prisma-typescript","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prisma-labs%2Fgraphql-prisma-typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prisma-labs%2Fgraphql-prisma-typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prisma-labs%2Fgraphql-prisma-typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prisma-labs%2Fgraphql-prisma-typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prisma-labs","download_url":"https://codeload.github.com/prisma-labs/graphql-prisma-typescript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248642503,"owners_count":21138351,"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":["airbnb","graphql","graphql-binding","graphql-database","graphql-server","graphql-yoga","prisma"],"created_at":"2024-08-01T22:03:12.233Z","updated_at":"2025-04-12T22:35:43.521Z","avatar_url":"https://github.com/prisma-labs.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Airbnb Clone - GraphQL Server Example with Prisma\n\nThis project demonstrates how to build a production-ready application with Prisma and [`graphql-yoga`](https://github.com/graphcool/graphql-yoga). The API provided by the GraphQL server is the foundation for an application similar to [AirBnB](https://www.airbnb.com/).\n\n## Get started\n\n\u003e **Note**: `prisma` is listed as a _development dependency_ and _script_ in this project's [`package.json`](./package.json). This means you can invoke the Prisma CLI without having it globally installed on your machine (by prefixing it with `yarn`), e.g. `yarn prisma deploy` or `yarn prisma playground`. If you have the Prisma CLI installed globally (which you can do with `npm install -g prisma`), you can omit the `yarn` prefix.\n\n### 1. Download the example \u0026 install dependencies\n\nClone the repository with the following command:\n\n```sh\ngit clone git@github.com:graphcool/graphql-server-example.git\n```\n\nNext, navigate into the downloaded folder and install the NPM dependencies:\n\n```sh\ncd graphql-server-example\nyarn install\n```\n\n### 2. Deploy the Prisma database service\n\nYou can now [deploy](https://www.prismagraphql.com/docs/reference/cli-command-reference/database-service/prisma-deploy-kee1iedaov) the Prisma service (note that this requires you to have [Docker](https://www.docker.com) installed on your machine - if that's not the case, follow the collapsed instructions below the code block):\n\n```sh\ncd prisma\ndocker-compose up -d\ncd ..\nyarn prisma deploy\n```\n\n\u003cdetails\u003e\n \u003csummary\u003e\u003cstrong\u003eI don't have \u003ca href=\"https://www.docker.com\"\u003eDocker\u003c/a\u003e installed on my machine\u003c/strong\u003e\u003c/summary\u003e\n\nTo deploy your service to a public cluster (rather than locally with Docker), you need to perform the following steps:\n\n1. Remove the `cluster` property from `prisma.yml`.\n1. Run `yarn prisma deploy`.\n1. When prompted by the CLI, select a public cluster (e.g. `prisma-eu1` or `prisma-us1`).\n1. Replace the [`endpoint`](./src/index.js#L23) in `index.ts` with the HTTP endpoint that was printed after the previous command.\n\n\u003c/details\u003e\n\u003cbr\u003e\n\n\u003e Notice that when deploying the Prisma service for the very first time, the CLI will execute the mutations from [`prisma/seed.graphql`](prisma/seed.graphql) to seed some initial data in the database. The CLI is aware of this file because it's listed in [`prisma/prisma.yml`](prisma/prisma.yml#L11) under the `seed` property.\n\n### 3. Start the GraphQL server\n\nThe Prisma database service that's backing your GraphQL server is now available. This means you can now start the server:\n\n```sh\nyarn dev\n```\n\nThe `dev` script starts the server (on `http://localhost:4000`) and opens a GraphQL Playground where you get acces to the API of your GraphQL server (defined in the [application schema](./src/schema.graphql)) as well as the underlying Prisma API (defined in the auto-generated [Prisma database schema](./src/generated/prisma.ts)) directly.\n\nInside the Playground, you can start exploring the available operations by browsing the built-in documentation.\n\n## Testing the API\n\nCheck [`queries/booking.graphql`](queries/booking.graphql) and [`queries/queries.graphql`](queries/queries.graphql) to see several example operations you can send to the API. To get an understanding of the booking flows, check the mutations in [`queries/booking.graphql`](queries/booking.graphql).\n\n## Deployment\n\nA quick and easy way to deploy the GraphQL server from this repository is with [Zeit Now](https://zeit.co/now). After you downloaded the [Now Desktop](https://zeit.co/download) app, you can deploy the server with the following command:\n\n```sh\nnow --dotenv .env.prod\n```\n\n**Notice that you need to create the `.env.prod` file yourself before invoking the command.** It should list the same environment variables as [`.env`](.env) but with different values. In particular, you need to make sure that your Prisma service is deployed to a cluster that accessible over the web.\n\nHere is an example for what `.env.prod` might look like:\n\n```\nPRISMA_STAGE=\"prod\"\nPRISMA_CLUSTER=\"public-tundrapiper-423/prisma-us1\"\nPRISMA_ENDPOINT=\"http://us1.prisma.sh/public-tundrapiper-423/prisma-airbnb-example/dev\"\nPRISMA_SECRET=\"mysecret123\"\nAPP_SECRET=\"appsecret321\"\n```\n\nTo learn more about deploying GraphQL servers with Zeit Now, check out this [tutorial](https://www.prismagraphql.com/docs/tutorials/graphql-server-development/deployment-with-now-ahs1jahkee).\n\n## Troubleshooting\n\n\u003cdetails\u003e\n \u003csummary\u003eI'm getting the error message \u003ccode\u003e[Network error]: FetchError: request to http://localhost:4466/auth-example/dev failed, reason: connect ECONNREFUSED\u003c/code\u003e when trying to send a query or mutation\u003c/summary\u003e\n\nThis is because the endpoint for the Prisma service is hardcoded in [`index.js`](index.js#L23). The service is assumed to be running on the default port for a local cluster: `http://localhost:4466`. Apparently, your local cluster is using a different port.\n\nYou now have two options:\n\n1. Figure out the port of your local cluster and adjust it in `index.js`. You can look it up in `~/.prisma/config.yml`.\n1. Deploy the service to a public cluster. Expand the `I don't have Docker installed on my machine`-section in step 2 for instructions.\n\nEither way, you need to adjust the `endpoint` that's passed to the `Prisma` constructor in `index.js` so it reflects the actual cluster domain and service endpoint.\n\n\u003c/details\u003e\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprisma-labs%2Fgraphql-prisma-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprisma-labs%2Fgraphql-prisma-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprisma-labs%2Fgraphql-prisma-typescript/lists"}