Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/b-palaniappan/axum-sqlx
Rust REST API with Axum and SQLx demo
https://github.com/b-palaniappan/axum-sqlx
Last synced: 8 days ago
JSON representation
Rust REST API with Axum and SQLx demo
- Host: GitHub
- URL: https://github.com/b-palaniappan/axum-sqlx
- Owner: b-palaniappan
- License: mit
- Created: 2024-05-07T01:32:19.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-08-22T01:40:01.000Z (3 months ago)
- Last Synced: 2024-08-22T02:53:48.061Z (3 months ago)
- Language: Rust
- Size: 277 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Axum SQLx
- REST API with Axum, SQLx using PostgreSQL DB.## PostgreSQL in Docker
```bash
docker run --name local-postgres -e POSTGRES_PASSWORD=D0eFU4uh6sav4X64HurgN -p 5432:5432 -d postgres:alpine
```
- User ID and Password: `postgres` and `D0eFU4uh6sav4X64HurgN`
- Run migration using: `sqlx migrate run` to create table in PostgreSQL.## OpenAPI documentation
- Access OpenAPI docs using `/scalar` endpoint.## Features
- [x] Create new user
- [x] Get all users with pagination logic.
- [x] Get one user by user id.
- [x] Patch partial user data by user id.
- [x] Soft Delete user by user id.
- [x] Global exception handling.
- [ ] gRPC in Axum framework.
- [x] Argon2id password hashing algorithm.
- [x] Add openapi / Swagger UI documentation.
- [ ] JWT token based authentication and authorization.
- [ ] Add caching with Redis.
- [ ] Add logging using tracing.
- [ ] Add secret manager to store secrets.
- [ ] Rest api client using reqwest.
- [ ] Unit and Integration testing.
- [ ] Dockerize the application.
- [ ] CI/CD pipeline using GitHub Actions.## Caching
- Use Redis as cache store.
- When use login-in create a JWT token and store the user profile info, permissions and roles in Redis with TTL of 1 day, which is same as JWT token expiry.
- On each JWT token check, validate the token and get the user profile info from Redis to get the permissions and roles.
- On logout, or token expiry, delete the user profile info from Redis.## Roles and Permissions
### Roles
- ADMIN
- USER
- SERVICE### Permissions
- READ
- WRITE