{"id":20499293,"url":"https://github.com/zzy/actix-web-async-graphql-rbatis","last_synced_at":"2025-04-13T18:51:17.068Z","repository":{"id":38326488,"uuid":"357424354","full_name":"zzy/actix-web-async-graphql-rbatis","owner":"zzy","description":"Clean boilerplate for graphql services using actix-web, rhai, async-graphql, surf, rbatis, graphql-client, handlebars-rust, jsonwebtoken, and mysql / postgresql.","archived":false,"fork":false,"pushed_at":"2022-06-07T01:22:31.000Z","size":114,"stargazers_count":28,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T09:40:35.019Z","etag":null,"topics":["actix-web","async-graphql","embbeded-scripting-rust","graphql-client","graphql-server","handlebars","jsonwebtoken","jwt-authentication","mysql","postgresql","rbatis","rhai","rust","surf"],"latest_commit_sha":null,"homepage":"https://blog.budshome.com/topics/graphql","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zzy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-13T04:33:00.000Z","updated_at":"2024-03-28T07:36:51.000Z","dependencies_parsed_at":"2022-08-25T03:02:26.870Z","dependency_job_id":null,"html_url":"https://github.com/zzy/actix-web-async-graphql-rbatis","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzy%2Factix-web-async-graphql-rbatis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzy%2Factix-web-async-graphql-rbatis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzy%2Factix-web-async-graphql-rbatis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzy%2Factix-web-async-graphql-rbatis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zzy","download_url":"https://codeload.github.com/zzy/actix-web-async-graphql-rbatis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248765982,"owners_count":21158296,"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":["actix-web","async-graphql","embbeded-scripting-rust","graphql-client","graphql-server","handlebars","jsonwebtoken","jwt-authentication","mysql","postgresql","rbatis","rhai","rust","surf"],"created_at":"2024-11-15T18:17:01.627Z","updated_at":"2025-04-13T18:51:17.034Z","avatar_url":"https://github.com/zzy.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# actix-web-async-graphql-rbatis\n\nClean boilerplate for graphql services using actix-web, rhai, async-graphql, surf, rbatis, graphql-client, handlebars-rust, jsonwebtoken, and mysql / postgresql. \n\nSee also: [tide-async-graphql-mongodb](https://github.com/zzy/tide-async-graphql-mongodb)\n\n## Features\n\n- Graphql Services\n  - [x] User register\n  - [x] Salt and hash a password with PBKDF2 - 使用 PBKDF2 对密码进行加密（salt）和散列（hash）运算\n  - [x] Sign in\n  - [x] JSON web token authentication - JWT 鉴权整合\n  - [x] Change password\n  - [x] Profile Update\n  - [x] User: query \u0026 mutation\n  - [x] Project: query \u0026 mutation\n- Web Application\n  - [x] Client request, bring \u0026 parse GraphQL data\n  - [x] Render data to template engine\n  - [x] Define custom helper with Rhai scripting language\n\n## Stacks\n\n- [Rust](https://www.rust-lang.org) - [中文资料集萃](https://budshome.com)\n- [actix-web](https://crates.io/crates/actix-web) - [中文文档](https://actix-web.budshome.com)\n- [rhai](https://crates.io/crates/rhai) - Embedded Scripting for Rust\n- [async-graphql](https://crates.io/crates/async-graphql) - [中文文档](https://async-graphql.budshome.com)\n- [rbatis](https://crates.io/crates/rbatis)\n- [Surf](https://crates.io/crates/surf)\n- [graphql_client](https://crates.io/crates/graphql_client)\n- [handlebars-rust](https://crates.io/crates/handlebars)\n- [jsonwebtoken](https://crates.io/crates/jsonwebtoken)\n- [cookie-rs](https://crates.io/crates/cookie)\n\n## How to run?\n\n``` Bash\ngit clone https://github.com/zzy/actix-web-async-graphql.git\ncd actix-web-async-graphql\ncargo build\n```\n\n### Frontend - actix-web server\n\n``` Bash\ncd frontend-handlebars\n```\n\nRename file `.env.example` to `.env`, or put the environment variables into a `.env` file:\n\n```\nADDRESS=127.0.0.1\nPORT=3000\n\nGRAPHQL_PORT=8080\nGRAPHQL_PATH=graphql\nGRAPHIQL_PATH=graphiql\n```\n\nBuild \u0026 Run:\n\n``` Bash\ncargo run\n```\nThen connect to http://127.0.0.1:3000 with browser.\n\n![Client Image](./screenshot/client.jpg)\n\n### Backend - Graphql Server\n\n``` Bash\ncd backend\n```\n\nRename file `.env.example` to `.env`, or put the environment variables into a `.env` file:\n\n```\nADDRESS=127.0.0.1\nPORT=8080\n\nGRAPHQL_PATH=graphql\nGRAPHIQL_PATH=graphiql\n\nMYSQL_URI=mysql://root:mysql@localhost:3306/budshome\nPOSTGRES_URI=postgres://root:mysql@localhost:5432/budshome\n\nSITE_KEY=0F4EHz+1/hqVvZjuB8EcooQs1K6QKBvLUxqTHt4tpxE=\nCLAIM_EXP=10000000000\n```\n\nBuild \u0026 Run:\n\n``` Bash\ncargo run\n```\n\nGraphiQL: connect to http://127.0.0.1:8080/graphiql with browser.\n\n![Graphql Image](./screenshot/graphql.jpg)\n\n## Queries\n\n- getUserByEmail(...): User!\n- getUserByUsername(...): User!\n- userSignIn(...): SignInfo!\n- allUsers(...): [User!]!\n- allProjects: [Project!]!\n- allProjectsByUser(...): [Project!]!\n\n## MUTATIONS\n\n- userRegister(...): User!\n- userChangePassword(...): User!\n- userUpdateProfile(...): User!\n- addProject(...): Project!\n\n## Sample Usage\n\nSample mutation for user register:\n```\nmutation {\n  userRegister(\n    newUser: { \n      email: \"example@budshome.com\", \n      username: \"我是谁\", \n      password: \"wo#$shi^$shui\" \n    }\n  ) {\n    id\n    email\n    username\n  }\n}\n```\n\nSample query for user sign in:\n```\n{\n  userSignIn(\n    userAccount: {\n      email: \"example@budshome.com\"\n      username: \"\"\n      password: \"wo#$shi^$shui\"\n    }\n  ) {\n    email\n    username\n    token\n  }\n}\n```\n\nWhen submit method `userSignIn`, a token would be generated, use this token for query all users and every user's projects:\n```\n{\n  allUsers(\n    token: \"fyJ0eXAiOiJKV1Q...\"\n  ) {\n    id\n    email\n    username\n\n    projects {\n      id\n      userId\n      subject\n      website\n    }\n  }\n}\n```\n\nSample query and mutation for projects was similar to users.\n\n## Contributing\n\nYou are welcome in contributing to this project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzzy%2Factix-web-async-graphql-rbatis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzzy%2Factix-web-async-graphql-rbatis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzzy%2Factix-web-async-graphql-rbatis/lists"}