https://github.com/elalfymohamed/to-do-list-backend
To-Do List Backend - To-Do List application, built using Python, FastAPI, and MongoDB. It provides endpoints for user authentication, task management, profile management, and more.
https://github.com/elalfymohamed/to-do-list-backend
fastapi mongodb python
Last synced: over 1 year ago
JSON representation
To-Do List Backend - To-Do List application, built using Python, FastAPI, and MongoDB. It provides endpoints for user authentication, task management, profile management, and more.
- Host: GitHub
- URL: https://github.com/elalfymohamed/to-do-list-backend
- Owner: elalfymohamed
- Created: 2024-11-08T20:26:02.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-09T22:38:15.000Z (over 1 year ago)
- Last Synced: 2025-01-23T13:33:57.732Z (over 1 year ago)
- Topics: fastapi, mongodb, python
- Language: Python
- Homepage:
- Size: 37.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# To-Do List Backend
This is the backend for a To-Do List application, built using Python, FastAPI, and MongoDB. It provides endpoints for user authentication, task management, profile management, and more.
---
## Features
### 1. **Authentication**
- **Signup:** Create a new user account.
- **Login:** Authenticate users with email and password.
- **Forgot Password:** Request a password reset email.
- **New Password:** Set a new password after receiving the reset link.
### 2. **To-Do List**
- **Create:** Add a new task.
- **All:** Retrieve all tasks.
- **Get by ID:** Fetch a specific task using its ID.
- **Soft Delete:** Mark a task as deleted without removing it permanently.
- **Update:** Modify task details.
- **Delete:** Permanently remove a task.
- **Get Recently Deleted:** List tasks that were recently soft-deleted.
- **Patch Recently Deleted:** Restore or permanently delete recently soft-deleted tasks.
### 3. **Profile**
- **Get Information** Get user profile information.
- **Reset Password:** Change the password for an authenticated user.
- **Update Profile:** Edit user profile information.
---
## Project Structure
```bash
| __src
| |__core # .env Config
| |__db # Database Config
| |__middleware # Middleware
| |__models # Database models and schemas
| |__routes # API endpoints
| |__schemas
| |__services # Core business logic
| |__utils
|
|___main.py # Entry point of the application
|__.dockerignore
|__.env
|__.env.example
|__docker-compose.yml
|__Dockerfile
|__requirements.tex # Python dependencies
|__README.md # Project documentation
|
```
## Installation and Setup
### Prerequisites
- Python 3.12 or higher
- MongoDB instance (local or cloud-based)
### Steps
```bash
python -m venv venv
source venv/bin/activate # On Windows: .venv\scripts\activate.ps1
pip install -r requirements.txt
```
### Run the application
```bash
uvicorn main:app --reload
```
### Access the API documentation
- Swagger UI: `http://127.0.0.1:8000/docs`
- ReDoc: `http://127.0.0.1:8000/redoc`
## Environment Variables
> .env
To run this project, you will need to add the following environment variables to your .env file
```bash
DB_URL=
DB_NAME=
SECRET_KEY=
ALGORITHM=
MAIL_PASSWORD=
MAIL_SERVER=
MAIL_PORT=
MAIL_USERNAME=
```
## API Endpoints Overview
### Authentication
| Endpoint | Method | Description |
| :-------- | :------- | :------------------------- |
| `/auth/signup` | `POST` | Register a new user |
| `/auth/signup` | `POST` | Authenticate a user |
| `/auth/forgot-password` | `POST` | Request password reset email |
| `/auth/new-password` | `POST` | Set a new password |
### To-Do List
| Endpoint | Method | Description |
| :-------- | :------- | :------------------------- |
| `/todo/create` | `POST` | Create a new task |
| `/todo/all` | `GET` | Get all tasks |
| `/todo/get/{id}` | `GET` | Get a task by ID |
| `/todo/soft-delete/{id}` | `PATCH` | Soft-delete a task |
| `/todo/update/{id}` | `PUT` | Update a task |
| `/todo/delete` | `DELETE` | Permanently delete a task |
| `/todo/recently-deleted` | `GET` | Get recently deleted tasks |
| `/todo/recently-deleted` | `PATCH` | Restore or delete recently deleted tasks |
### Profile
| Endpoint | Method | Description |
| :-------- | :------- | :------------------------- |
| `/profile` | `GET` | profile information |
| `/profile/reset-password` | `PATCH` | Reset the password |
| `/profile/update` | `PUT` | Update user profile |
## License
This project is licensed under the MIT License. See the LICENSE file for details.