{"id":26027786,"url":"https://github.com/biluohc/actixweb-sqlx-jwt","last_synced_at":"2025-03-06T16:57:33.526Z","repository":{"id":45141016,"uuid":"269024858","full_name":"biluohc/actixweb-sqlx-jwt","owner":"biluohc","description":"A jwt template project of actix-web and sqlx","archived":false,"fork":false,"pushed_at":"2022-07-17T16:05:20.000Z","size":149,"stargazers_count":80,"open_issues_count":6,"forks_count":19,"subscribers_count":4,"default_branch":"actix-web-4.0","last_synced_at":"2023-10-19T05:21:53.759Z","etag":null,"topics":["actix-web","jwt","sqlx"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/biluohc.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-06-03T07:53:50.000Z","updated_at":"2023-09-21T04:12:15.000Z","dependencies_parsed_at":"2022-07-13T16:45:01.125Z","dependency_job_id":null,"html_url":"https://github.com/biluohc/actixweb-sqlx-jwt","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biluohc%2Factixweb-sqlx-jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biluohc%2Factixweb-sqlx-jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biluohc%2Factixweb-sqlx-jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biluohc%2Factixweb-sqlx-jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/biluohc","download_url":"https://codeload.github.com/biluohc/actixweb-sqlx-jwt/tar.gz/refs/heads/actix-web-4.0","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242250925,"owners_count":20096895,"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","jwt","sqlx"],"created_at":"2025-03-06T16:57:32.986Z","updated_at":"2025-03-06T16:57:33.507Z","avatar_url":"https://github.com/biluohc.png","language":"Rust","readme":"# actixweb-sqlx-jwt\n    A jwt template project of actix-web and sqlx\n\n## sqlx-cli\ncargo install sqlx-cli --git https://github.com/launchbadge/sqlx\n\n## Usage\n\n1. Choose a database(`mysql`, `postgres`, `sqlite`).\n2. Sets the default feature as the database name on Cargo.toml(current is `mysql`).\n3. Configure the databse you can see `sql/user.up.$database.sql`.\n4. Run `cargo run -- -v` after update .env and template.json.\n5. Test current api:\n```sh\ncurl -v --data '{\"name\": \"Bob\", \"email\": \"Bob@google.com\", \"password\": \"Bobpass\"}' -H \"Content-Type: application/json\" -X POST localhost:8080/user/register\n\ncurl -v --data '{\"name\": \"Bob\", \"email\": \"Bob@google.com\", \"password\": \"Bobpass\"}' -H \"Content-Type: application/json\" -X POST localhost:8080/user/login\n\ncurl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJCb2IiLCJleHAiOjE1OTEyNDYwOTR9.O1dbYu3tqiIi6I8OUlixLuj9dp-1tLl4mjmXZ0ve6uo' localhost:8080/user/userInfo\n\ncurl -v -X DELETE -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJCb2IiLCJleHAiOjE1OTEyNDYwOTR9.O1dbYu3tqiIi6I8OUlixLuj9dp-1tLl4mjmXZ0ve6uo' localhost:8080/user/delete/Bob \n\ncurl 'localhost:8080/user/userInfo?access_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJCb2IiLCJleHAiOjE1OTEyNTYxNDd9.zJKlZOozYfq-xMXO89kjUyme6SA8_eziacqt5gvXj2U'\n```\n6. Modify the code and write your own code, enjoy.\n\n## Notice\n1. The sqlx query macros needs to be connected to the database represented by DATABASE_URL in .env, or you can consider using the unchecked version instead.\n\n## Redis: No Redis does not affect the program running now\n1. Use docker to start a Redis quickly\n```bash\ndocker run --name redis-6379 --network host -d redis redis-server --port 6379 --bind 127.0.0.1 --appendonly  no  # --requirepass pw\n\n# pip3 install iredis\n\n# iredis/redis-cli -p 6379 # -a pw\n```\n2. The Redis client crates, current is mobc.\n    1. [redis-rs](https://github.com/mitsuhiko/redis-rs): The most used Redis client.\n    1. [mobc](https://github.com/importcjj/mobc): An asynchronous connection pool.\n    1. [deadpool](https://github.com/bikeshedder/deadpool): An asynchronous connection pool.\n    1. [actix-redis](https://github.com/actix/actix-extras/tree/master/actix-redis): Redis integration for actix framework base on redis-async-rs.\n    1. [bb8](https://crates.io/crates/bb8): An asynchronous connection pool provides the same configuration options as r2d2.\n    2. [r2d2](https://github.com/sfackler/r2d2): A synchronized connection pool, not recommended.\n    3. [redis-async-rs](https://github.com/benashford/redis-async-rs): Another Redis client.\n\n### References\n1. actix-web: https://github.com/actix/actix-web\n2. sqlx: https://github.com/launchbadge/sqlx\n2. actix documentation: https://actix.rs/docs/\n2. actix-web-jwt with mongodb: https://github.com/emreyalvac/actix-web-jwt\n2. actix-examples: https://github.com/actix/examples\n2. an instance: https://github.com/biluohc/KeepStats\n3. ormx: https://github.com/NyxCode/ormx\n3. sea-orm: https://github.com/SeaQL/sea-orm\n3. sea-query: https://github.com/SeaQL/sea-query\n4. Prisma Client Rust: https://github.com/Brendonovich/prisma-client-rust\n5. validator: https://docs.rs/validator\n6. axum: https://github.com/tokio-rs/axum\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiluohc%2Factixweb-sqlx-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiluohc%2Factixweb-sqlx-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiluohc%2Factixweb-sqlx-jwt/lists"}