A simple production-ready backend server template for Content Management Systems built with Rust using Axum.
!!! Go through the Critical Information 🚨🚨🚨
section below before getting started !!!
- Authors (Authors of posts)
- Posts (The actual content to be managed)
- EditSuggestion (Edits on posts suggested by self or other authors)
- Redis Caching (Discontinued, may be re-implemented in the future)
- WebSocket Draft Saves (Coming Soon, perhaps)
- Google sign-up/sign-in (Coming soon, perhaps)
- Refactored for even quicker development 🚀🚀🚀. Happy coding 💫
- Make sure to set the correct config information in the config file.
- For production, Make sure to comment out
_dev_utils::init_dev().await?
in themain()
function as this is for dev only. - For development, In all
.sql
files, individual database statements should end with;--#
, failure to do this may break dev database initialization - If you have a field with a database enum, I advise avoiding
base
's genericupdate
method. This breaks with postgres at the moment, you would have to manually cast the enum fields to a database enum using sea_query. See theupdate
method at edit.rs for a detailed example.
See here for the code implementation of all the routes
- POST
/signup
: Sign up with name, email, and password - POST
/login
: Login with email and password
- GET
/api/author
: get all authors - GET
/api/author/:id
: Get specific author.
- GET
/api/post
: Get all posts - GET
/api/post/:id
: Get specific post - PATCH
/api/post/:id
: Update specific post - DELETE
/api/post/:id
: Delete specific post
- GET
/api/edit
: List edits by/for an author's posts - GET
/api/edit/incoming
: List all incoming edits - GET
/api/edit/outgoing
: List all outgoing edits - GET
/api/edit/:id
: Get edit - PATCH
/api/edit/:id
: Update edit - DELETE
/api/edit/:id
: Delete edit - POST
/api/edit/accept/:id
Accept edit - POST
/api/edit/reject/:id
Reject edit
You must have cargo-watch installed for these to work
# Run tests
cargo watch -q -c -x "test -- -- nocapture"
# Specific test with filter
cargo watch -q -c -x "test models::author::tests::test_create_ok"
# Run quick_dev exampl while developing
cargo watch -q -c -w examples/ -x "run --example quick_dev"
# Run any example while developing
cargo watch -q -c -w examples/ -x "run --example {FILE_NAME}"` # where `FILE_NAME` is the name of the file containing the test