Skip to content

A simple application to learn about Clean Architecture with DDD (Layer Pattern) using Rust

Notifications You must be signed in to change notification settings

loanmatteusz/clean-arch-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clean Arch Rust

This project is a study application created to explore Clean Architecture principles in Rust. It is based on the tutorial provided in this video: Building a Clean Architecture in Rust. The project aims to demonstrate how to structure a Rust application following clean architectural practices, utilizing Actix-web for the web framework and Diesel for ORM with PostgreSQL.

Requirements

Setup

  1. Clone the repository:

    git clone https://github.com/loanmatteusz/clean-arch-rust.git
    cd clean-arch-rust
  2. Set up the database using Docker Compose:

    docker-compose up -d
  3. Configure environment variables:

    Create a .env file in the root of the project with the following content:

    DATABASE_URL=postgres://admin:admin@localhost:5434/user_db
  4. Install project dependencies:

    cargo build
  5. Run database migrations:

    diesel migration run

    Make sure you have Diesel CLI installed:

    cargo install diesel_cli --no-default-features --features postgres

Running the Application

  1. Start the server:

    cargo run
  2. API Endpoints:

    • POST /api/v1/users/: Register a new user.
    • GET /api/v1/users/{email}: Retrieve a user by email.

Testing

Use tools like Insomnia or Postman to test the endpoints.

Example JSON body for registering a new user:

{
    "name": "User Test",
    "email": "usertest@example.com",
    "phone": "1234567890",
    "address": "User's Street"
}

About

A simple application to learn about Clean Architecture with DDD (Layer Pattern) using Rust

Topics

Resources

Stars

Watchers

Forks

Languages