Thanks to visit codestin.com
Credit goes to github.com

Skip to content

rubete is short for "Rust backend template". It is a boilerplate backend API built with Rust and the Ntex web framework. It provides a solid foundation for building RESTful APIs with features like user authentication, database integration, and more.

Notifications You must be signed in to change notification settings

sonyarianto/rubete

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rubete

Hi! rubete is short for "Rust backend template". It is a boilerplate backend API built with Rust and the Ntex web framework. It provides a solid foundation for building RESTful APIs.

Features

  • User authentication and management.
  • Connection to MySQL database. Using SeaORM as the ORM layer.
  • Easy to understand and extend, as long as you follow the existing structure and understand Rust and Ntex basics. Everything starts from main.rs. The src directory contains the core application logic, organized into subdirectories for different modules and functionalities.
  • Environment configuration using .env file.

Goals

  • Provide a robust and scalable backend for any web application.
  • Ensure security and efficiency in handling user data and requests.
  • Facilitate easy integration with frontend applications and other services.
  • Maintain clean and maintainable codebase for future development.
  • Follow best practices in Rust programming and web development.
  • Support OpenAPI/Swagger documentation for easy API exploration and testing.
  • Implement comprehensive error handling and logging.
  • Use middleware for tasks like logging, CORS, and authentication.
  • Enable hot reloading during development for faster iteration.
  • Support deployment in various environments, including local, staging, and production.
  • Unit and integration testing to ensure code quality and reliability.

Getting started

To get started with the rubete API, follow these steps:

  1. Clone the repository:

    git clone https://github.com/sonyarianto/rubete.git
  2. Navigate to the project directory:

    cd rubete
  3. Install the required dependencies:

    cargo build
  4. Set up your environment variables: Copy the .env.example file to .env and fill in the required values.

  5. Run the application:

cargo run

6. The API will be available at `http://localhost:9000` (or the port you specified in the `.env` file).

## Hot reload during development
For development, you can use `cargo-watch` for hot reloading. Install it using:
```bash
cargo install cargo-watch

Then run:

cargo watch -x run

SeaORM entity generation

To generate SeaORM entities from your existing database schema, you can use the sea-orm-cli tool. Install it using:

cargo install sea-orm-cli

Then run the following command to generate entities:

sea-orm-cli generate entity -u mysql://username:password@localhost/database_name -o src/entity

Git hooks

This project using lefthook for Git hooks. Follow the instructions at lefthook installation guide.

Run the following command to install the Git hooks defined in this project:

lefthook install

This will set up the pre-commit hook to run commands before each commit. See on lefthook.yml for more details.

Some planned features and TODOs

  • Add unit and integration tests.
  • Implement more advanced features like role-based access control.
  • Audit logging and monitoring.
  • Better documentation and examples.
  • Docker support for easier deployment.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

Author

About

rubete is short for "Rust backend template". It is a boilerplate backend API built with Rust and the Ntex web framework. It provides a solid foundation for building RESTful APIs with features like user authentication, database integration, and more.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages