{"id":20680731,"url":"https://github.com/nilshartmann/graphql-publy-example","last_synced_at":"2026-04-11T06:43:24.087Z","repository":{"id":139781881,"uuid":"597812632","full_name":"nilshartmann/graphql-publy-example","owner":"nilshartmann","description":"#GraphQL example application","archived":false,"fork":false,"pushed_at":"2023-02-05T19:49:15.000Z","size":3107,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-29T17:24:38.580Z","etag":null,"topics":["graphql","java","react","spring","spring-graphql"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/nilshartmann.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-02-05T18:01:53.000Z","updated_at":"2023-02-05T19:49:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"6ab696f8-23e6-444e-8764-d190119601da","html_url":"https://github.com/nilshartmann/graphql-publy-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nilshartmann/graphql-publy-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilshartmann%2Fgraphql-publy-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilshartmann%2Fgraphql-publy-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilshartmann%2Fgraphql-publy-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilshartmann%2Fgraphql-publy-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nilshartmann","download_url":"https://codeload.github.com/nilshartmann/graphql-publy-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilshartmann%2Fgraphql-publy-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31671629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T17:19:37.612Z","status":"online","status_checked_at":"2026-04-11T02:00:05.776Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["graphql","java","react","spring","spring-graphql"],"created_at":"2024-11-16T21:35:02.217Z","updated_at":"2026-04-11T06:43:24.078Z","avatar_url":"https://github.com/nilshartmann.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Publy - GraphQL example application\n\nThis repository contains my GraphQL example application _publy_ that is built with Spring for GraphQL and React. It demonstrates typical GraphQL use-cases.\n\n## 1. Setup the workspace and run the application\n\n![Screenshot of the example application](./publy-screenshot.png)\n\n**Prerequisites:**\n\n- Java 17\n- Docker\n- yarn](https://yarnpkg.com/) optional, only needed for the React/Apollo frontend\n\n**Step 1: clone the repository**\n\n- Please clone this repository with your Git client first.\n\n**Step 2: Start the database (with Docker)**\n\n\n- `docker-compose -f docker-compose.yml up -d`\n\n**Step 3: Start userservice**\n\nAttention. Port 17081 must not be occupied:\n\n- `./gradlew publy-userservice:bootRun`\n\n**Step 4: Start backend**\n\nAttention. Port 17080 must not be occupied:\n\n- `./gradlew publy-backend:bootRun`\n\nYou can now use `http://localhost:17080` to open the GraphiQL-Explorer\nand execute queries and mutations.\n\n**Step 5: Start frontend (optional)**\n\nAttention. Port 3000 must not be occupied:\n\n```bash\n\ncd publy-frontend\n\nyarn install\n\nyarn start\n```\n\nYou can now open the frontend via `http://localhost:3000` in your browser.\n\n### Open workspace in the IDE\n\nYou can open the root directory in IDEA, then the project will be recognised as a Gradle project and automatically configured correctly by IDEA.\n\nThen you can start the two server processes as Java applications:\n\n- `nh.graphql.publy.userservice.UserserviceApplication`: The user service\n- `nh.publy.backend.PublyApplication`: The (GraphQL-)backend\n\nImportant: In any case, please first start the database with `docker-compose` as described above!\n\n## 2. Try the frontend\n\nIf you want to try out the example frontend, open it in your browser at `http://localhost:3000`.\n\nAs an anonymous visitor of the app, you are allowed to read articles and comments, as well as user (\"member\") information. GraphQL **Queries** are then executed in the background,\nwhich you can inspect with the network console of your browser.\n\nIf you want to add a comment or leave a reaction (both implemented as **Mutations**),\nyou have to log in via the login page. There you will find usernames that you can use.\n\n## 3. Execute queries in GraphiQL\n\nYou can use GraphiQL to execute GraphQL queries with the sample application.\n\nExample 1:\n\n```graphql\nquery {\n    stories(first: 10) {\n        edges {\n            node {\n                id\n                title\n                body\n            }\n        }\n    }\n}\n```\n### Authorization tokens (for mutations)\n\nIf you want to execute **mutations**, the backend expects a user token.\nFor testing, you can use one of the following tokens, which are always valid:\n\n- User: `nils`\n- Role: `ROLE_USER` (may do anything)\n\n```JSON\n{\"Authorization\": \"Bearer eyJhbGciOiJSUzUxMiJ9. eyJzdWIiOiJ7XCJpZFwiOlwiVTFcIixcInVzZXJuYW1lXCI6XCJuaWxzXCIsXCJuYW1lXCI6XCJOaWxzIEhhcnRtYW5uXCIsXCJlbWFpbFwiOlwia29udGFrdEBuaWxzaGFydG1hbm4ubmV0XCIsXCJyb2xlc1wiOltcIlJPTEVfVVNFUlwiLFwiUk9MRV9FRElUT1JcIl0sXCJndWVzdFwiOmZhbHNlfSIsImlhdCI6MTY0MTM2OTg0NywiZXhwIjozMjMyOTg3OTg3fQ. lsLAqfAdMID_2QFL7OimWEHcunaPy18zWVYZUDiEJYVwR9PQG5qf8_gRrNAwkd9w33dwunJC3bswR1W0zMtTID9DyeaXGLws2AtmwF_ZecD6x5TVDEBcFJV1-WrRt2yRWoo-hNywGqDUqR49dJoICoQ-. aoP_7GOgYo5zYIYCRe2Xbn4DbX0xzGLyiRNzJzZhq8l6KE_Hb5Ern0hTZhTZXq4jmrCjf8wztuF37rsRJ-nZ9vozUaQU7vwhl93g1gvAMb3zJWBo_m9ujd3RKSZ5fjMuOVb-kVQI6NP9hLoEYO2mkcDSoHNIXBgJHr3TYNzeGtJ3Nt3bTXp-o_P-bSzXYQ\"}\n```\n\n- User: `murphy`\n- Role: `ROLE_GUEST` (may comment and respond, but may not create stories. Note: Stories can only be created via GraphiQL, not via the frontend).\n\n```json\n{\"Authorization\": \"Bearer eyJhbGciOiJSUzUxMiJ9. eyJzdWIiOiJ7XCJpZFwiOlwiVTdcIixcInVzZXJuYW1lXCI6XCJtdXJwaHlcIixcIm5hbWVcIjpcIkV0aGVseW4gTXVycGh5XCIsXCJlbWFpbFwiOlwiZXRoZWx5bi5tdXJwaHlAZXhhbXBsZS5jb21cIixcInJvbGVzXCI6W1wiUk9MRV9VU0VSXCIsXCJST0xFX0dVRVNUXCJdLFwiZ3Vlc3RcIjp0cnVlfSIsImlhdCI6MTY0MTM2OTg0NywiZXhwIjozMjMyOTg3OTg3fQ. A1SHxkgGCfdo-v-kCGRSFuYngMW6438o1alkg4DAdwWBYuy1E7axYbpzGKghP5gR19b7qoc98Y9gY9-zekFxo35yrzDaEmWMYR0UmprYI27M_eh06OJzct2NJt9voldnUlPdCed8mn4vPs56IXHTxd6zGGwSA7JGYSIfswQh2w-. 3y1d3WCFR3ZPju0f9ZripR_4NQFOltm4NNbHC7CbcWgUtixJx-h5BiAeLfZcJDFoNqUq6obf8jkUzOX_2PEJaeRzxW6WTXd88EbSqjMns5PqmM5BosSJmyuZSjfGGbLaFBqPLrgMLNHHNFwGn6VBtarMvmHsU7zbGYmZXG31XAg\"}\n```\n\nYou can insert the complete Authorization-JSON-String in GraphiQL in the \"**Request Headers**\"-Tab.\nThe header will then be sent with every query/mutation.\n\n![Set Request Header in GraphiQL](graphiql-request-header.png)\n\nYou can then for example query the current logged in user (represented by the token):\n\n```graphql\nquery {\n    me {\n        id\n        user {\n            name\n            email\n        }\n        \n        bio\n        skills\n        currentlyLearning\n    }\n}\n```\n\n# Links\n\n* GraphQL Homepage: https://graphql.org/\n* IntelliJ Plug-in für GraphQL: https://plugins.jetbrains.com/plugin/8097-graphql\n* GraphQL Extension für VS Code: https://marketplace.visualstudio.com/items?itemName=GraphQL.vscode-graphql\n* GraphiQL: https://github.com/graphql/graphiql\n\n# Contact\n\nIf you have questions or comments, please feel free to [contact me](https://nilshartmann.net) or open an issue in this repository. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilshartmann%2Fgraphql-publy-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnilshartmann%2Fgraphql-publy-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilshartmann%2Fgraphql-publy-example/lists"}