Skip to content

behrouz-rfa/rust-ddd

Repository files navigation

Rust Domain Driven Design Example

rust-ddd

Rust Domain-Driven-Design (DDD)

Summery

This repository is used to present how I find implementing DDD in Rust projects works out

Framework

Running

  1. Clone the repository locally
https://github.com/behrouz-rfa/rust-ddd.git
  1. Execute the bin/dotenv script to create a .env file or copy the contents of the .env.sample file into a new file with the name .env

  2. Run the Docker

docker compose up -d
  1. Install dependencies and execute the server
cargo run

Examples

  1. For insert or registration
curl --location --request POST 'localhost:8082/api/users/insert' \
--header 'Content-Type: application/json' \
--data-raw '{
"username":"behrouz.r.fa",
"email":"behrouz.r.fa@gmail.com'\''",
"password":"pass@123"
}'
  1. for login
curl --location --request POST 'localhost:8082/api/users/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"email":"behrouz.r.fa@gmail.com'\''",
"password":"pass@123"
}'
  1. update user
curl --location --request PUT 'localhost:8082/api/user' \
--header 'Authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzMzMTY3OTUsImlkIjoyOCwidXNlcm5hbWUiOiJ0ZXN0MTEyMjIifQ._N82DPNiw27gVdBFuEPv2Tps_TbUH6wXgq-wBIxUQfc' \
--header 'Content-Type: application/json' \
--data-raw '{
"email":"master@gmail.com'\''",
"username":"master@123",
"bio": "this test for bio"
}'

TODO

  • integration test
  • fix db pool
  • unit test
  • Better error handling

About

A Domain Driven Design example application in Rust.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors