This project is the backend for a Netflix clone built with Rust, using Actix-web for the web server and MongoDB for the database. It handles user authentication, movie listings, user profiles, and more.
- User authentication (login and registration)
- CRUD operations for movies and lists
- User profile management
- Secure handling of JWTs for session management
Before you begin, ensure you have met the following requirements:
- Rust 1.80 or higher
- Docker and Docker Compose
- MongoDB account and database
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
-
Clone the repository:
git clone https://github.com/abdulwaarith0/netflix_backend_rust.git cd netflix_backend_rust -
Set up your
.envfile based on the.env.exampleprovided in the repository. Make sure to replace the placeholders with your actual MongoDB URL and secret key.
To run the application using Docker, follow these steps:
-
Build the Docker images:
make build
-
Start the application:
make up
-
To stop the application:
make down
-
For a complete cleanup (removing all containers, networks, and volumes):
make clean
If you prefer to run the application without Docker:
- Install MongoDB locally or set up a remote MongoDB instance.
- Install the required Rust dependencies:
cargo build
- Run the application:
cargo run
Below are the available RESTful endpoints grouped by resource.
| Method | Endpoint | Description | Requires Auth |
|---|---|---|---|
| POST | /api/auth/login |
Logs in a user | No |
| POST | /api/auth/register |
Registers a new user | No |
| Method | Endpoint | Description | Requires Auth |
|---|---|---|---|
| GET | /api/movies |
Retrieves all movies | Yes |
| POST | /api/movies |
Adds a new movie | Yes |
| GET | /api/movies/{id} |
Retrieves a movie by ID | Yes |
| GET | /api/movies/random |
Retrieves a random movie | No |
| Method | Endpoint | Description | Requires Auth |
|---|---|---|---|
| GET | /api/users |
Fetches all users | Yes |
| GET | /api/users/{id} |
Fetches a specific user | Yes |
| Method | Endpoint | Description | Requires Auth |
|---|---|---|---|
| GET | /api/health |
Checks service health | No |