Mend

Mend πŸ“

A comprehensive full-stack productivity application for managing tasks, organizing workspaces, and scheduling your time. Mend helps you stay organized with an intuitive interface for creating todo lists, managing projects across multiple workspaces, and planning your schedule with a timetable system.

🌐 Live Demo: https://mendapp.online


Table of Contents


✨ Features


πŸ“ Project Structure

Mend/
β”œβ”€β”€ frontend/                 # React + Vite frontend application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/      # React components
β”‚   β”‚   β”œβ”€β”€ App.jsx          # Main application component
β”‚   β”‚   β”œβ”€β”€ index.css        # Global styles
β”‚   β”‚   β”œβ”€β”€ login.jsx        # Authentication component
β”‚   β”‚   β”œβ”€β”€ addTask.jsx      # Todo management component
β”‚   β”‚   └── main.jsx         # React entry point
β”‚   β”œβ”€β”€ index.html           # HTML template
β”‚   └── package.json         # Frontend dependencies
β”‚
β”œβ”€β”€ backend/                  # FastAPI backend application
β”‚   β”œβ”€β”€ auth/                # Authentication routes and security
β”‚   β”‚   β”œβ”€β”€ routes.py        # Auth endpoints (login, register)
β”‚   β”‚   └── security.py      # JWT and password utilities
β”‚   β”œβ”€β”€ main.py              # FastAPI app and API endpoints
β”‚   β”œβ”€β”€ database.py          # Database configuration
β”‚   β”œβ”€β”€ models.py            # SQLAlchemy ORM models
β”‚   β”œβ”€β”€ schemas.py           # Pydantic request/response schemas
β”‚   β”œβ”€β”€ requirements.txt      # Python dependencies
β”‚   └── .env                 # Environment variables (local)
β”‚
β”œβ”€β”€ .env                     # Root environment configuration
β”œβ”€β”€ README.md                # This file
└── LICENSE                  # License file

πŸ› οΈ Tech Stack

Frontend (42.1% CSS, 38% JavaScript, 0.3% HTML)

Backend (19.6% Python)


πŸš€ Installation

Prerequisites

Backend Setup

  1. Navigate to the backend directory:
    cd backend
    
  2. Create a Python virtual environment:
    python -m venv venv
    
  3. Activate the virtual environment:
    • Windows:
      venv\Scripts\activate
      
    • macOS/Linux:
      source venv/bin/activate
      
  4. Install dependencies:
    pip install -r requirements.txt
    
  5. Create a .env file in the backend directory:
    DATABASE_URL=postgresql://your_username:your_password@localhost:5432/todo_db
    
  6. Run the backend server:
    uvicorn main:app --reload
    

    The API will be available at http://localhost:8000

Frontend Setup

  1. Navigate to the frontend directory:
    cd frontend
    
  2. Install dependencies:
    npm install
    
  3. Start the development server:
    npm run dev
    

    The application will be available at http://localhost:5173


πŸ”§ Environment Setup

Backend Environment Variables

Create a backend/.env file with:

# PostgreSQL database connection
DATABASE_URL=postgresql://username:password@localhost:5432/todo_db

# Security (if applicable)
# SECRET_KEY=your_secret_key_here
# ALGORITHM=HS256
# ACCESS_TOKEN_EXPIRE_MINUTES=30

Database Setup

  1. Create the PostgreSQL database:
    psql -U postgres
    CREATE DATABASE todo_db;
    
  2. The tables will be automatically created when you first run the FastAPI application (via SQLAlchemy’s Base.metadata.create_all()).

πŸ’» Usage

Starting the Application

  1. Start PostgreSQL server (if not running)

  2. Start the backend:
    cd backend
    source venv/bin/activate  # or venv\Scripts\activate on Windows
    uvicorn main:app --reload
    
  3. Start the frontend (in a new terminal):
    cd frontend
    npm run dev
    
  4. Open your browser and navigate to http://localhost:5173

Typical Workflow

  1. Register/Login - Create an account or sign in
  2. View Workspaces - See default β€œHome” and β€œWork” workspaces
  3. Create Workspaces - Add custom workspaces as needed
  4. Add Todos - Create todo items within workspaces
  5. Manage Schedule - Add timetable items for specific days
  6. Track Progress - Mark todos as complete and monitor your tasks

πŸ“‘ API Documentation

Authentication Endpoints

Register

curl -X POST http://localhost:8000/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "username": "john_doe",
    "password": "secure_password"
  }'

Login

curl -X POST http://localhost:8000/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "username": "john_doe",
    "password": "secure_password"
  }'

Workspace Endpoints

Get All Workspaces

curl -X GET http://localhost:8000/workspaces \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN"

Create Workspace

curl -X POST http://localhost:8000/workspaces \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Projects"}'

Update Workspace

curl -X PATCH http://localhost:8000/workspaces/1 \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Updated Name"}'

Delete Workspace

curl -X DELETE http://localhost:8000/workspaces/1 \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN"

Todo Endpoints

Get Todos

curl -X GET "http://localhost:8000/todos?workspace_id=1&completed=false" \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN"

Create Todo

curl -X POST http://localhost:8000/todos \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Complete project",
    "workspace_id": 1,
    "completed": false,
    "time_left_minutes": 120
  }'

Update Todo

curl -X PATCH http://localhost:8000/todos/1 \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "completed": true,
    "time_left_minutes": 60
  }'

Delete Todo

curl -X DELETE http://localhost:8000/todos/1 \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN"

Timetable Endpoints

Get Timetable Items

curl -X GET "http://localhost:8000/timetable-items?day=monday" \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN"

Create Timetable Item

curl -X POST http://localhost:8000/timetable-items \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Team Meeting",
    "day": "monday",
    "time": "10:00 AM",
    "workspace_id": 1
  }'

Update Timetable Item

curl -X PATCH http://localhost:8000/timetable-items/1 \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"title": "Updated Meeting"}'

Delete Timetable Item

curl -X DELETE http://localhost:8000/timetable-items/1 \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN"

πŸ”¨ Development

Frontend Development

cd frontend

# Install dependencies
npm install

# Start development server
npm run dev

# Build for production
npm build

# Preview production build
npm run preview

Backend Development

cd backend

# Activate virtual environment
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Run development server with auto-reload
uvicorn main:app --reload

# Run with specific host/port
uvicorn main:app --host 0.0.0.0 --port 8000 --reload

Code Quality

Frontend:

Backend:


πŸ“¦ Database Management

PostgreSQL Connection

Use your .env file DATABASE_URL:

postgresql://username:password@localhost:5432/todo_db

Useful PostgreSQL Commands

# Connect to the database
psql -U your_username -d todo_db

# List all tables
\dt

# Backup database
pg_dump -U your_username -d todo_db > backup.sql

# Restore database
psql -U your_username -d todo_db < backup.sql

# Drop database (WARNING: destructive)
DROP DATABASE todo_db;

Database Schema

The application uses SQLAlchemy ORM to manage the following tables:

All tables are automatically created on first run via SQLAlchemy migrations.


πŸ“¦ Dependencies

Frontend (npm)

Backend (pip)

See backend/requirements.txt for the complete list.


πŸ“ˆ Performance Features


🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/YourFeature)
  3. Commit your changes (git commit -m 'Add YourFeature')
  4. Push to the branch (git push origin feature/YourFeature)
  5. Open a Pull Request

Please ensure:


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ“ž Support

For issues, questions, or suggestions, please open an issue on the GitHub repository.


Built with ❀️ using React, FastAPI, and PostgreSQL