Skip to content

bPavan16/TodoApp-fastApi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

FastAPI TODO App

A comprehensive TODO application built with FastAPI, featuring advanced task management, team collaboration.

Features

๐Ÿ” Authentication & Authorization

  • JWT-based authentication with refresh tokens
  • Two-factor authentication (2FA) support
  • Role-based access control (Admin/User)
  • Secure password hashing

๐Ÿ‘ค User Management

  • User registration and profile management
  • User roles and permissions
  • Avatar support
  • Account deactivation

โœ… Task Management

  • Create, read, update, delete tasks
  • Task status tracking (Pending, In Progress, Completed, Archived)
  • Priority levels (Low, Medium, High, Urgent)
  • Due dates and time tracking
  • Task completion and archiving
  • Subtasks and task dependencies

๐Ÿท๏ธ Tags & Projects

  • Create and manage tags with custom colors
  • Project organization
  • Task categorization
  • Filter tasks by tags and projects

๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘ Team Collaboration

  • Create and manage teams
  • Invite users to teams
  • Project-team associations
  • Task assignment to team members

๐Ÿ” Search & Filter

  • Advanced search with multiple filters
  • Search by keywords, tags, status, priority
  • Date range filtering
  • Search suggestions

๐Ÿ“ˆ Analytics & Reporting

  • Task completion statistics
  • Daily productivity metrics
  • Progress tracking
  • Productivity insights

๐Ÿ”” Reminders & Notifications

  • Task reminders with custom messages
  • System notifications for task assignments
  • Due date notifications
  • Team activity notifications

๐Ÿ“Ž File Attachments

  • Upload files to tasks
  • Multiple file format support
  • File size validation
  • Secure file access

Tech Stack

  • Backend: FastAPI
  • Database: SQLite (configurable to MySQL/PostgreSQL)
  • Authentication: JWT with passlib
  • ORM: SQLAlchemy
  • Validation: Pydantic
  • File Upload: FastAPI file handling
  • Documentation: Auto-generated with FastAPI

Installation

  1. Clone the repository

    git clone https://github.com/bPavan16/TodoApp-fastApi.git
    cd fastAPI
  2. Create virtual environment

    python -m venv venv
    
    # Windows
    venv\Scripts\activate
    
    # Linux/Mac
    source venv/bin/activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Environment Configuration

    # Copy example environment file
    cp .env.example .env
    
    # Edit .env file with your configuration
  5. Run the application

    python main.py

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

API Documentation

Once the application is running, you can access:

  • Interactive API docs: http://localhost:8000/docs
  • ReDoc documentation: http://localhost:8000/redoc

Configuration

Environment Variables

Create a .env file based on .env.example:

# Database
DATABASE_URL=sqlite:///./todoapp.db

# Security
SECRET_KEY=your-secret-key-here
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
REFRESH_TOKEN_EXPIRE_DAYS=7

# File Upload
MAX_FILE_SIZE=10485760  # 10MB
UPLOAD_DIR=uploads/

Database Setup

SQLite (Default)

No additional setup required. The database file will be created automatically.

API Endpoints

Authentication

  • POST /auth/register - Register new user
  • POST /auth/login - Login user
  • POST /auth/logout - Logout user
  • GET /auth/me - Get current user profile
  • POST /auth/refresh - Refresh access token
  • POST /auth/2fa/enable - Enable 2FA
  • POST /auth/2fa/verify - Verify 2FA code
  • POST /auth/oauth/github - GitHub OAuth login

Users

  • GET /users/ - List users (admin)
  • GET /users/{id} - Get user by ID
  • PUT /users/{id} - Update user
  • DELETE /users/{id} - Delete user
  • GET /users/{id}/tasks - Get user's tasks

Tasks

  • GET /tasks/ - List tasks with filters
  • POST /tasks/ - Create new task
  • GET /tasks/{id} - Get task by ID
  • PUT /tasks/{id} - Update task
  • DELETE /tasks/{id} - Delete task
  • POST /tasks/{id}/complete - Mark task complete
  • POST /tasks/{id}/archive - Archive task
  • POST /tasks/{id}/assign - Assign task
  • GET /tasks/{id}/subtasks - Get subtasks
  • POST /tasks/{id}/subtasks - Create subtask
  • GET /tasks/{id}/dependencies - Get dependencies
  • POST /tasks/{id}/dependencies - Add dependency

Tags

  • GET /tags/ - List tags
  • POST /tags/ - Create tag
  • GET /tags/{id} - Get tag
  • PUT /tags/{id} - Update tag
  • DELETE /tags/{id} - Delete tag
  • GET /tags/{id}/tasks - Tasks with tag

Projects

  • GET /projects/ - List projects
  • POST /projects/ - Create project
  • GET /projects/{id} - Get project
  • PUT /projects/{id} - Update project
  • DELETE /projects/{id} - Delete project
  • GET /projects/{id}/tasks - Project tasks

Teams

  • GET /teams/ - List user's teams
  • POST /teams/ - Create team
  • GET /teams/{id} - Get team
  • PUT /teams/{id} - Update team
  • DELETE /teams/{id} - Delete team
  • POST /teams/{id}/invite - Invite user
  • GET /teams/{id}/members - Team members

Search

  • GET /search/tasks - Search tasks
  • GET /search/tasks/suggestions - Search suggestions

Analytics

  • GET /analytics/summary - Task summary
  • GET /analytics/daily - Daily statistics
  • GET /analytics/productivity - Productivity metrics

Notifications

  • GET /notifications/ - List notifications
  • POST /notifications/mark-all-read - Mark all read
  • PUT /notifications/{id}/read - Mark as read
  • DELETE /notifications/{id} - Delete notification

Reminders

  • POST /tasks/{id}/reminders - Add reminder
  • GET /reminders/ - List reminders
  • DELETE /reminders/{id} - Delete reminder

Attachments

  • POST /tasks/{id}/attachments - Upload file
  • GET /tasks/{id}/attachments - List attachments
  • GET /attachments/{id}/download - Download file
  • DELETE /attachments/{id} - Delete attachment

Usage Examples

Register a new user

curl -X POST "http://localhost:8000/auth/register" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "username": "testuser",
    "password": "securepassword",
    "full_name": "Test User"
  }'

Login

curl -X POST "http://localhost:8000/auth/login" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "username=testuser&password=securepassword"

Create a task

curl -X POST "http://localhost:8000/tasks/" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Complete project documentation",
    "description": "Write comprehensive documentation for the project",
    "priority": "high",
    "due_date": "2024-12-31T23:59:59"
  }'

Search tasks

curl "http://localhost:8000/search/tasks?q=documentation&priority=high" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Development

Running in Development Mode

python main.py

Running Tests

pytest

Database Migration

The application automatically creates database tables on startup. For production deployments, consider using Alembic for database migrations.

Security Features

  • Password hashing with bcrypt
  • JWT tokens with expiration
  • Refresh token rotation
  • Two-factor authentication
  • Input validation and sanitization
  • File upload security
  • CORS protection
  • SQL injection prevention

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

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

Support

For support and questions, please open an issue on the GitHub repository.

Acknowledgements

  • FastAPI team for creating an amazing framework
  • SQLAlchemy for ORM capabilities

GitHub Stars GitHub Forks GitHub Issues

Made with โค๏ธ by Pavan Bhakta

About

API written for TODO-application while learning fastApi

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages