This project provides a starter application for building web projects with Rust. It includes the Rocket web framework and MongoDB database integration, as well as several commonly-used libraries and configurations to get you up and running quickly.
With this starter application, you can focus on building the core features of your project, without worrying about setting up the basic infrastructure from scratch.
It provides basic CRUD (Create, Read, Update, and Delete) operations for managing user data. Specifically, it includes the following functionality:
- Update user
- Create user
- Delete user
- List users
It includes a user authentication system that allows users to create an account, log in, and log out. Specifically, it includes the following functionality:
- login
- Sign up
- JWT token encode/decode
- Middleware
The application includes functionality for sending emails with templates, although this feature is currently under development.
The application includes robust error handling to ensure that any errors that occur are handled in a graceful manner. This helps to prevent unexpected errors from causing the application to crash or malfunction.
This app requires the user to create a .env
file in the root directory of the project and add the following environment variables:
MONGODB_URI
- The URI for the MongoDB database, e.g.mongodb://localhost:27017
DB_NAME
- The name of the databaseJWT_SECRET
- A secret key for JWT token generationJWT_ALGORITHM
- The algorithm used for JWT token generation
To run the app, follow these steps:
- Clone the repository or download the source code
- Navigate to the root directory of the project in the terminal
- Create the
.env
file and add the required environment variables as described above - Run
cargo run
in the terminal - The app should now be running on
http://localhost:8000
If there are any errors, make sure that the environment variables are correctly set up and that the MongoDB database is running on the specified URI.