{"id":21473231,"url":"https://github.com/lz1998/axum-book-management","last_synced_at":"2025-07-15T08:32:14.201Z","repository":{"id":44558470,"uuid":"442851700","full_name":"lz1998/axum-book-management","owner":"lz1998","description":"CRUD system of book-management with ORM and JWT for educational purposes.","archived":false,"fork":false,"pushed_at":"2023-12-01T12:21:20.000Z","size":18,"stargazers_count":47,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2023-12-01T13:59:26.145Z","etag":null,"topics":["axum","crud","demo","example","http","http-server","jwt","mysql","orm","rust","sea-orm","tutorial"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/lz1998.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,"governance":null}},"created_at":"2021-12-29T18:01:18.000Z","updated_at":"2023-12-01T13:59:31.036Z","dependencies_parsed_at":"2023-12-01T13:59:27.667Z","dependency_job_id":null,"html_url":"https://github.com/lz1998/axum-book-management","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/lz1998%2Faxum-book-management","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lz1998%2Faxum-book-management/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lz1998%2Faxum-book-management/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lz1998%2Faxum-book-management/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lz1998","download_url":"https://codeload.github.com/lz1998/axum-book-management/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226027820,"owners_count":17562139,"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":["axum","crud","demo","example","http","http-server","jwt","mysql","orm","rust","sea-orm","tutorial"],"created_at":"2024-11-23T10:15:53.401Z","updated_at":"2024-11-23T10:15:53.990Z","avatar_url":"https://github.com/lz1998.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Book management\n\nEnglish | [中文](README_cn.md)\n\n## Required\n- Rust\n- MySQL 5.7\n\n## Usage\n1. Execute `init.sql` to create tables.\n2. Set environment variable `DATABASE_URL` and `JWT_SECRET` in `.env`.\n3. Execute `run.sh`.\n\n\n## API\n\n### user\n- /user/register\n- /user/login\n\n### book\n\u003e JWT should be provided in header. `Authorization: Bearer \u003cJWT\u003e`\n- /book/create\n- /book/search\n- /book/update\n- /book/delete\n\n## Practice\n### Use Redis as cache\n1. Add [redis](https://github.com/redis-rs/redis-rs) with feature `tokio-comp` to Cargo.toml\n\u003e `async` is necessary, because if you don't use `async`, the **system thread** will block when the command is executing, and it will not handle other tasks.\n2. Add `redis::RedisError` in src/error.rs\n```rust\n    #[error(\"redis_error: {0}\")]\n    Redis(#[from] redis::RedisError),\n```\n\u003e With `#[from]`, [thiserror](https://github.com/dtolnay/thiserror) will generate `impl From\u003credis::RedisError\u003e for CustomError` automatically, and you can return error with `?` or `.map_err(Into::into)?` when the return type is `CustomResult\u003cT\u003e`.   \n\u003e Without `#[from]`, you need to convert error by yourself `.map_err(|e| CustomError::Redis(e))` or `.map_err(CustomError::Redis)`\n3. Read code in [redis/examples](https://github.com/redis-rs/redis-rs/blob/main/redis/examples/async-await.rs).\n4. Write your cache code.\n\n### Global 404 handler\n1. Add [Global-404-handler](https://github.com/tokio-rs/axum/tree/main/examples/global-404-handler) in `src/bin/server.rs`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flz1998%2Faxum-book-management","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flz1998%2Faxum-book-management","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flz1998%2Faxum-book-management/lists"}