Skip to content

Commit fc902d3

Browse files
committed
Doc: Wrote README for the project
1 parent 01efbb6 commit fc902d3

File tree

2 files changed

+74
-2
lines changed

2 files changed

+74
-2
lines changed

README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Robust Rust - Backend API Project
2+
3+
![Rust Logo](https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png)
4+
5+
**Table of Contents**
6+
- [Robust Rust - Backend API Project](#robust-rust---backend-api-project)
7+
- [Introduction](#introduction)
8+
- [Purpose](#purpose)
9+
- [Features](#features)
10+
- [Getting Started](#getting-started)
11+
- [Technologies Used](#technologies-used)
12+
- [Project Structure](#project-structure)
13+
- [How to Contribute](#how-to-contribute)
14+
- [Acknowledgments](#acknowledgments)
15+
16+
### Introduction
17+
This project was born out of my enthusiasm for learning Rust and exploring its potential as a backend language for building APIs. Rust is a modern, safe, and performance-oriented programming language that excels in systems programming, but it is also well-suited for web development, making it an excellent choice for building backend APIs.
18+
19+
### Purpose
20+
The primary purpose of this project is to serve as a learning experience for both myself and anyone else interested in Rust and API development. By creating a robust backend API in Rust, I aim to demonstrate best practices, design patterns, and idiomatic Rust code that ensures both functionality and maintainability.
21+
22+
### Features
23+
The project aims to showcase various features commonly found in a backend API. Some of the planned features include:
24+
- RESTful API endpoints for CRUD operations on resources
25+
- Authentication and user management
26+
- Database integration (e.g., PostgreSQL, MySQL, or Redis)
27+
- Input validation and error handling
28+
- Pagination and filtering of data
29+
- Continous Integration and Development
30+
31+
### Getting Started
32+
To run the project locally or contribute to its development, follow these steps:
33+
1. Clone the repository: `git clone https://github.com/utilitycoder/robust-rust.git`
34+
2. Install Rust and Cargo (the Rust package manager) if you haven't already.
35+
3. Navigate to the project directory: `cd robust-rust`
36+
4. Install project dependencies: `cargo build`
37+
5. Configure the environment variables and database connection settings. Customize the .env file and run both PostgreSQL and Redis through docker images. Run the files in the `scripts` folder.
38+
6. Run the project: `cargo run`
39+
7. The API should now be accessible at `http://localhost:8000`.
40+
41+
### Technologies Used
42+
The project utilizes the following technologies:
43+
- **Rust:** The core programming language used for backend development.
44+
- **Actix-web** A web framework for Rust that provides routing, request handling, and middleware support.
45+
- **Serde:** A serialization/deserialization library for Rust, used to work with JSON or other data formats.
46+
- **SQLX:** Rust library that provides a safe and convenient way to work with SQL databases. .
47+
- **Tokio:** A runtime for writing asynchronous applications in Rust.
48+
- A host of other crates.
49+
50+
### Project Structure
51+
The project follows a modular structure to keep the code organized and maintainable. The main components include:
52+
- `src/`: Contains the source code for the backend API.
53+
- `src/routes/`: Defines the API endpoints and request handlers.
54+
- `src/domain/`: Contains the data structure and cleanup of subscriber details.
55+
- `src/authentication/`: Contains business logic and data processing related to user authentication.
56+
- `src/idempotency/`: Includes code related to idempotency functionality.
57+
- `src/*.rs`: Other Rust source files that do not fall under specific folders.
58+
- `configuration/`: Deployment environment configuration files for the project.
59+
- `migrations/`: Database schema migration scripts.
60+
- `scripts/`: Scripts for building, initializing both PostgreSQL and Redis database.
61+
- `tests/`: Contains integration tests for the project.
62+
63+
### How to Contribute
64+
Contributions to this project are welcome! Whether you want to fix a bug, add a new feature, or improve documentation, follow these steps:
65+
1. Fork the repository.
66+
2. Create a new branch for your feature: `git checkout -b feature-name`
67+
3. Make your changes and commit them with descriptive messages: `git commit -m "Add feature-name"`
68+
4. Push your changes to your forked repository: `git push origin feature-name`
69+
5. Create a pull request, detailing your changes and the problem they solve.
70+
71+
72+
### Acknowledgments
73+
I would like to thank Luca Palmieri for the amazing work he did with zero2prod book. His book exposed me to the world of building robust backend API with Rust.

src/authentication/middleware.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use crate::session_state::TypedSession;
2-
use crate::utils::{e500, see_other};
1+
use crate::{session_state::TypedSession, utils::{e500, see_other}};
32
use actix_web::body::MessageBody;
43
use actix_web::dev::{ServiceRequest, ServiceResponse};
54
use actix_web::error::InternalError;

0 commit comments

Comments
 (0)