{"id":18631170,"url":"https://github.com/catalinmiron/uzual-backend","last_synced_at":"2026-03-06T01:34:35.233Z","repository":{"id":46064391,"uuid":"181913748","full_name":"catalinmiron/uzual-backend","owner":"catalinmiron","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-22T11:22:30.000Z","size":1922,"stargazers_count":8,"open_issues_count":8,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-28T07:36:54.139Z","etag":null,"topics":["docker","docker-compose","graphql","letsencrypt","nexus","nginx","nginx-proxy","prisma","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/catalinmiron.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":"2019-04-17T14:56:06.000Z","updated_at":"2024-06-04T10:51:04.000Z","dependencies_parsed_at":"2023-01-30T07:30:38.842Z","dependency_job_id":null,"html_url":"https://github.com/catalinmiron/uzual-backend","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/catalinmiron/uzual-backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catalinmiron%2Fuzual-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catalinmiron%2Fuzual-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catalinmiron%2Fuzual-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catalinmiron%2Fuzual-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/catalinmiron","download_url":"https://codeload.github.com/catalinmiron/uzual-backend/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catalinmiron%2Fuzual-backend/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30157846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T22:39:40.138Z","status":"ssl_error","status_checked_at":"2026-03-05T22:39:24.771Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["docker","docker-compose","graphql","letsencrypt","nexus","nginx","nginx-proxy","prisma","typescript"],"created_at":"2024-11-07T05:05:52.058Z","updated_at":"2026-03-06T01:34:35.211Z","avatar_url":"https://github.com/catalinmiron.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/catalinmiron"],"categories":[],"sub_categories":[],"readme":"### Would you like to support me?\n\n\u003ca href=\"https://www.buymeacoffee.com/catalinmiron\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png\" alt=\"Buy Me A Coffee\" style=\"height: auto !important;width: auto !important;\" \u003e\u003c/a\u003e\n\n----\n\n# GraphQL Server with Authentication \u0026 Permissions\n\nThis example shows how to implement a **GraphQL server with an email-password-based authentication workflow and authentication rules**, based on Prisma, [graphql-yoga](https://github.com/prisma/graphql-yoga), [graphql-shield](https://github.com/maticzav/graphql-shield) \u0026 [GraphQL Nexus](https://graphql-nexus.com/).\n\n## How to use\n\n### 1. Download example \u0026 install dependencies\n\nClone the repository:\n\n```\ngit clone git@github.com:prisma/prisma-examples.git\n```\n\nInstall Node dependencies:\n\n```\ncd prisma-examples/typescript/graphql-auth\nnpm install\n```\n\n### 2. Install the Prisma CLI\n\nTo run the example, you need the Prisma CLI. Please install it via NPM or [using another method](https://www.prisma.io/docs/prisma-cli-and-configuration/using-the-prisma-cli-alx4/#installation):\n\n```\nnpm install -g prisma\n```\n\n### 3. Set up database \u0026 deploy Prisma datamodel\n\nFor this example, you'll use a free _demo database_ (AWS Aurora) hosted in Prisma Cloud. To set up your database, run:\n\n```\nprisma deploy\n```\n\nThen, follow these steps in the interactive CLI wizard:\n\n1. Select **Demo server**\n1. **Authenticate** with Prisma Cloud in your browser (if necessary)\n1. Back in your terminal, **confirm all suggested values**\n\n\u003cdetails\u003e\n \u003csummary\u003eAlternative: Run Prisma locally via Docker\u003c/summary\u003e\n\n1. Ensure you have Docker installed on your machine. If not, you can get it from [here](https://store.docker.com/search?offering=community\u0026type=edition).\n1. Create `docker-compose.yml` for MySQL (see [here](https://www.prisma.io/docs/prisma-server/database-connector-POSTGRES-jgfr/) for Postgres):\n    ```yml\n    version: '3'\n    services:\n      prisma:\n        image: prismagraphql/prisma:1.31\n        restart: always\n        ports:\n        - \"4466:4466\"\n        environment:\n          PRISMA_CONFIG: |\n            port: 4466\n            databases:\n              default:\n                connector: mysql\n                host: mysql\n                port: 3306\n                user: root\n                password: prisma\n                migrations: true\n      mysql:\n        image: mysql:5.7\n        restart: always\n        environment:\n          MYSQL_ROOT_PASSWORD: prisma\n        volumes:\n          - mysql:/var/lib/mysql\n    volumes:\n      mysql:\n    ```\n1. Run `docker-compose up -d`\n1. Set the `endpoint` in `prisma.yml` to `http://localhost:4466`\n1. Run `prisma deploy`\n\n\u003c/details\u003e\n\nYou can now use [Prisma Admin](https://www.prisma.io/docs/prisma-admin/overview-el3e/) to view and edit your data by appending `/_admin` to your Prisma endpoint.\n\n### 4. Start the GraphQL server\n\nLaunch your GraphQL server with this command:\n\n```\nnpm run start\n```\n\nNavigate to [http://localhost:4000](http://localhost:4000) in your browser to explore the API of your GraphQL server in a [GraphQL Playground](https://github.com/prisma/graphql-playground).\n\n### 5. Using the GraphQL API\n\nThe schema that specifies the API operations of your GraphQL server is defined in [`./src/schema.graphql`](./src/schema.graphql). Below are a number of operations that you can send to the API using the GraphQL Playground.\n\nFeel free to adjust any operation by adding or removing fields. The GraphQL Playground helps you with its auto-completion and query validation features.\n\n#### Retrieve all published posts and their authors\n\n```graphql\nquery {\n  feed {\n    id\n    title\n    content\n    published\n    author {\n      id\n      name\n      email\n    }\n  }\n}\n```\n\n\u003cDetails\u003e\u003cSummary\u003e\u003cstrong\u003eSee more API operations\u003c/strong\u003e\u003c/Summary\u003e\n\n#### Register a new user\n\nYou can send the following mutation in the Playground to sign up a new user and retrieve an authentication token for them:\n\n```graphql\nmutation {\n  signup(name: \"Alice\", email: \"alice@prisma.io\", password: \"graphql\") {\n    token\n  }\n}\n```\n\n#### Log in an existing user\n\nThis mutation will log in an existing user by requesting a new authentication token for them:\n\n```graphql\nmutation {\n  login(email: \"alice@prisma.io\", password: \"graphql\") {\n    token\n  }\n}\n```\n\n#### Check whether a user is currently logged in with the `me` query\n\nFor this query, you need to make sure a valid authentication token is sent along with the `Bearer`-prefix in the `Authorization` header of the request:\n\n```json\n{\n  \"Authorization\": \"Bearer __YOUR_TOKEN__\"\n}\n```\n\nWith a real token, this looks similar to this:\n\n```json\n{\n  \"Authorization\": \"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjanAydHJyczFmczE1MGEwM3kxaWl6c285IiwiaWF0IjoxNTQzNTA5NjY1fQ.Vx6ad6DuXA0FSQVyaIngOHYVzjKwbwq45flQslnqX04\"\n}\n```\n\nInside the Playground, you can set HTTP headers in the bottom-left corner:\n\n![](https://imgur.com/ToRcCTj.png)\n\nOnce you've set the header, you can send the following query to check whether the token is valid:\n\n```graphql\n{\n  me {\n    id\n    name\n    email\n  }\n}\n```\n\n#### Create a new draft\n\nYou need to be logged in for this query to work, i.e. an authentication token that was retrieved through a `signup` or `login` mutation needs to be added to the `Authorization` header in the GraphQL Playground.\n\n```graphql\nmutation {\n  createDraft(\n    title: \"Join the Prisma Slack\"\n    content: \"https://slack.prisma.io\"\n  ) {\n    id\n    published\n  }\n}\n```\n\n#### Publish an existing draft\n\nYou need to be logged in for this query to work, i.e. an authentication token that was retrieved through a `signup` or `login` mutation needs to be added to the `Authorization` header in the GraphQL Playground. The authentication token must belong to the user who created the post.\n\n```graphql\nmutation {\n  publish(id: \"__POST_ID__\") {\n    id\n    published\n  }\n}\n```\n\n\u003e **Note**: You need to replace the `__POST_ID__`-placeholder with an actual `id` from a `Post` item. You can find one e.g. using the `filterPosts`-query.\n\n#### Search for posts with a specific title or content\n\nYou need to be logged in for this query to work, i.e. an authentication token that was retrieved through a `signup` or `login` mutation needs to be added to the `Authorization` header in the GraphQL Playground. \n\n```graphql\n{\n  filterPosts(searchString: \"graphql\") {\n    id\n    title\n    content\n    published \n    author {\n      id\n      name\n      email\n    }\n  }\n}\n```\n\n#### Retrieve a single post\n\nYou need to be logged in for this query to work, i.e. an authentication token that was retrieved through a `signup` or `login` mutation needs to be added to the `Authorization` header in the GraphQL Playground. \n\n```graphql\n{\n  post(id: \"__POST_ID__\") {\n    id\n    title\n    content\n    published\n    author {\n      id\n      name\n      email\n    }\n  }\n}\n```\n\n\u003e **Note**: You need to replace the `__POST_ID__`-placeholder with an actual `id` from a `Post` item. You can find one e.g. using the `filterPosts`-query.\n\n#### Delete a post\n\nYou need to be logged in for this query to work, i.e. an authentication token that was retrieved through a `signup` or `login` mutation needs to be added to the `Authorization` header in the GraphQL Playground. The authentication token must belong to the user who created the post.\n\n```graphql\nmutation {\n  deletePost(id: \"__POST_ID__\") {\n    id\n  }\n}\n```\n\n\u003e **Note**: You need to replace the `__POST_ID__`-placeholder with an actual `id` from a `Post` item. You can find one e.g. using the `filterPosts`-query.\n\n\u003c/Details\u003e\n\n### 6. Changing the GraphQL schema\n\nTo make changes to the GraphQL schema, you need to manipulate the [`Query`](./src/resolvers/Query.ts) and [`Mutation`](./src/resolvers/Mutation.ts) types. \n\nNote that the [`start`](./package.json#L6) script also starts a development server that automatically updates your schema every time you save a file. This way, the auto-generated [GraphQL schema](./src/generated/schema.graphql) updates whenever you make changes in to the `Query` or `Mutation` types inside your TypeScript code.\n\n## Next steps\n\n- [Use Prisma with an existing database](https://www.prisma.io/docs/-t003/)\n- [Explore the Prisma client API](https://www.prisma.io/client/client-typescript)\n- [Learn more about the GraphQL schema](https://www.prisma.io/blog/graphql-server-basics-the-schema-ac5e2950214e/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatalinmiron%2Fuzual-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatalinmiron%2Fuzual-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatalinmiron%2Fuzual-backend/lists"}