This is a simple, experimental authentication service built in Rust. It includes functionalities such as user registration and viewing all users. More functionality to follow.
- Rust (latest stable version)
- PostgreSQL
You need to set the following environment variables for database configuration:
DATABASE_URL
: The connection string of your PostgreSQL database in the formatpostgres://username:password@localhost/database_name
.ROCKET_SECRET_KEY
: The secret key Rocket will use to encrypt cookies. You can useopenssl rand -base64 32
to generate a new key.
You can set this variables in your environment or in a .env
file at the root of your project.
-
Make sure you have created your database instance locally and set the DATABASE_URL environment variable correctly. Then run your Diesel migrations to set up the database schema.
diesel migration run
-
Use Cargo to build and run the project:
cargo run --bin authrust
This will start the server. The port and host would depend on how you have configured your Rocket application.
Note: As this project is experimental, it may have issues or lack certain features. It is not recommended for use in production environments without further development and testing.
The project has been structured in a modular fashion with separate files for database operations, schema definitions, and business logic. If you're new to Rust, it may take some time to familiarize yourself with the ownership, borrowing and lifetime concepts which are heavily used in this project.
Feel free to explore the project and open issues or pull requests if you have any questions, comments, or improvements.
Happy coding!