https://github.com/satvikpraveen/task-manager-pro
๐ฏ Task Manager PRO โ A fully modular, object-oriented Python CLI application for managing tasks. Features user login, due-date reminders (with optional email alerts), verbose task reporting, decorators, type hints, unit tests with pytest, and a Docker-ready structure for production-grade deployment.
https://github.com/satvikpraveen/task-manager-pro
argparse cli context-manager cron decorators docker dotenv json-storage modular-architecture mypy object-oriented open-source pip-installable productivity-tool pytest python reminder-app task-manager task-manager-app type-hinting
Last synced: about 1 month ago
JSON representation
๐ฏ Task Manager PRO โ A fully modular, object-oriented Python CLI application for managing tasks. Features user login, due-date reminders (with optional email alerts), verbose task reporting, decorators, type hints, unit tests with pytest, and a Docker-ready structure for production-grade deployment.
- Host: GitHub
- URL: https://github.com/satvikpraveen/task-manager-pro
- Owner: SatvikPraveen
- License: gpl-3.0
- Created: 2025-06-24T20:42:13.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-07-28T01:51:53.000Z (11 months ago)
- Last Synced: 2025-07-28T03:34:17.991Z (11 months ago)
- Topics: argparse, cli, context-manager, cron, decorators, docker, dotenv, json-storage, modular-architecture, mypy, object-oriented, open-source, pip-installable, productivity-tool, pytest, python, reminder-app, task-manager, task-manager-app, type-hinting
- Language: Python
- Homepage:
- Size: 104 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ Task Manager PRO โ Production-Grade Task Management System
[](https://www.gnu.org/licenses/gpl-3.0)
[](https://www.python.org/)
[](https://fastapi.tiangolo.com/)
[](https://www.sqlalchemy.org/)
[](./tests/)
[](https://github.com/features/actions)
[](https://www.docker.com/)
[](#-security-features)
[](http://mypy-lang.org/)
**Task Manager PRO** is a **production-grade distributed task management system** combining a Python CLI tool with a modern REST API.
It demonstrates mastery of full-stack development: SQLAlchemy ORM, FastAPI REST endpoints, JWT authentication, comprehensive testing, and CI/CD automation.
---
## ๐ Major Features
### ๐ REST API (Phase 3)
- **17 Production-Ready Endpoints** across 3 resource types
- JWT Bearer Token Authentication
- Full pagination support (skip/limit)
- Automatic OpenAPI/Swagger documentation
- CORS middleware enabled
### ๐ Security & Authentication (Phase 2)
- bcrypt password hashing (12-round salting)
- JWT token generation and validation
- User isolation (tasks scoped by user)
- Pydantic v2 input validation
- Environment variable credential management
### ๐ Database Layer (Phase 2)
- SQLAlchemy ORM with SQLite/PostgreSQL support
- User and Task models with relationships
- Automatic timestamp tracking
- Query optimization with indexes
- Migration utilities for data portability
### โ
Testing & Quality (Phase 4)
- 15 comprehensive API integration tests
- 4+ unit tests for core functionality
- Full test isolation with database cleanup
- 100% passing test suite (20/20 โ
)
- GitHub Actions CI/CD pipeline
### ๐ป CLI Tool (Original)
- User login system
- Add/Update/Delete/List tasks
- Mark tasks completed
- Task filtering and summaries
- JSON-based storage
- Email reminders via SMTP
- CRON automation support
---
## ๐ ๏ธ Technology Stack
| Layer | Technology |
| ----------------- | ---------------------------------- |
| **API Framework** | FastAPI 0.100+, Uvicorn |
| **Database** | SQLAlchemy 2.0+, SQLite/PostgreSQL |
| **Security** | bcrypt, PyJWT, Pydantic v2 |
| **Testing** | pytest, pytest-cov |
| **DevOps** | GitHub Actions, Docker |
| **CLI** | argparse, python-dotenv |
| **Python** | 3.10, 3.11, 3.12 |
---
## ๐ Quick Start
### Via REST API (Recommended)
```bash
# Install dependencies
pip install -r requirements.txt
# Start the development server
uvicorn task_manager_pro.api.main:app --reload
# Access documentation
# - Interactive Docs: http://localhost:8000/docs
# - ReDoc: http://localhost:8000/redoc
```
### Via CLI
```bash
pip install -e .
task-manager login --username
task-manager add-task --title "My Task" --due 2025-12-31
```
---
## ๐ Documentation
- **[QUICKSTART.md](./QUICKSTART.md)** - Get started with the API in 5 minutes
- **[IMPLEMENTATION_SUMMARY.md](./IMPLEMENTATION_SUMMARY.md)** - Complete project overview
- **[docs/PHASE2_DATABASE_SECURITY.md](./docs/PHASE2_DATABASE_SECURITY.md)** - Database architecture
- **[docs/PHASE3_REST_API.md](./docs/PHASE3_REST_API.md)** - API reference with examples
- **[docs/PHASE4_TESTING_CI_CD.md](./docs/PHASE4_TESTING_CI_CD.md)** - Testing infrastructure
---
## ๐ฆ Project Architecture
```
task_manager_pro/
โโโ api/ # REST API Layer (Phase 3)
โ โโโ main.py # FastAPI app with 17 endpoints
โ โโโ dependencies.py # JWT auth & dependency injection
โ โโโ routes/
โ โโโ auth.py # Authentication endpoints
โ โโโ tasks.py # Task CRUD operations
โ โโโ users.py # User management
โโโ storage/ # Data Persistence (Phase 2)
โ โโโ database.py # SQLAlchemy setup
โ โโโ models.py # ORM entities (User, Task)
โ โโโ sql_storage.py # SQL implementation
โ โโโ json_storage.py # Original JSON storage
โ โโโ interface.py # Storage abstraction
โ โโโ migration.py # Data migration utilities
โโโ schemas/ # Validation (Phase 2)
โ โโโ user.py # User request/response schemas
โ โโโ task.py # Task request/response schemas
โโโ services/ # Business Logic
โ โโโ task_manager.py # Core task operations
โโโ models/ # Domain Models
โ โโโ task.py
โ โโโ user.py
โโโ utils/ # Utilities
โ โโโ security.py # bcrypt, JWT, password hashing
โ โโโ decorators.py
โ โโโ emailer.py # SMTP integration
โ โโโ logger_context.py
โ โโโ session.py
โโโ cli.py # CLI entrypoint (argparse)
โโโ send_reminders.py # Reminder automation
tests/ # Test Suite (Phase 4)
โโโ test_api.py # 15 API integration tests โ
โโโ test_tasks.py # Task unit tests
โโโ test_users.py # User model tests
โโโ test_email.py # Email utility tests
.github/workflows/ # CI/CD Pipeline (Phase 4)
โโโ ci-cd.yml # GitHub Actions workflow
docs/ # Documentation
โโโ PHASE2_DATABASE_SECURITY.md
โโโ PHASE3_REST_API.md
โโโ PHASE4_TESTING_CI_CD.md
.env.template # Environment variables template
dockerfile # Container image
requirements.txt # Dependencies
requirements_dev.txt # Dev dependencies
pyproject.toml # Project config & CLI registration
```
**Key Design Patterns:**
- **Layered Architecture:** Routes โ Validation โ Services โ Storage โ Database
- **Dependency Injection:** FastAPI dependencies for auth and storage
- **Abstract Interfaces:** StorageInterface supports multiple backends
- **Security-First:** JWT tokens, bcrypt hashing, Pydantic validation
---
## ๐ REST API Usage
### Start the Server
```bash
uvicorn task_manager_pro.api.main:app --reload
```
Access interactive docs: http://localhost:8000/docs
### Register & Login
```bash
# Register
curl -X POST http://localhost:8000/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"username": "john_doe",
"email": "john@example.com",
"password": "secure_password_123"
}'
# Login
curl -X POST http://localhost:8000/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"username": "john_doe",
"password": "secure_password_123"
}'
```
### Create & Manage Tasks
```bash
TOKEN="your_jwt_token"
# Create task
curl -X POST http://localhost:8000/api/tasks \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Buy groceries",
"description": "Milk, bread, eggs",
"due_date": "2025-12-31",
"priority": "high"
}'
# List tasks (paginated)
curl -X GET "http://localhost:8000/api/tasks?skip=0&limit=10" \
-H "Authorization: Bearer $TOKEN"
# Update task
curl -X PUT http://localhost:8000/api/tasks/{task_id} \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"completed": true}'
# Delete task
curl -X DELETE http://localhost:8000/api/tasks/{task_id} \
-H "Authorization: Bearer $TOKEN"
```
For complete API examples, see [QUICKSTART.md](./QUICKSTART.md)
---
## ๐ป CLI Tool Usage
### Installation
```bash
pip install -e .
```
### Commands
```bash
# Login
task-manager login --username
# Add task
task-manager add-task --title --desc --due
# List tasks
task-manager list-tasks --filter all --verbose
# Mark completed
task-manager complete-task --id
# Delete task
task-manager delete-task --id
# Toggle email reminders
task-manager toggle-email-reminders
# Logout
task-manager logout
```
---
## ๐งช Testing
Run the comprehensive test suite:
```bash
# All tests (20/20 passing)
pytest tests/ -v
# With coverage report
pytest tests/ --cov=task_manager_pro
# Specific test file
pytest tests/test_api.py -v
# Specific test
pytest tests/test_api.py::test_create_task_authenticated -v
```
**Test Coverage:**
- 15 API integration tests (authentication, CRUD, pagination)
- 4+ unit tests (task models, user models)
- 100% test isolation with fresh database per test
- Full authentication flow testing
- Error case and edge case coverage
---
## ๐ Security Features
### Authentication
- JWT Bearer tokens with HS256 encryption
- 30-minute token expiration (configurable)
- Secure token refresh endpoint
- User isolation on all operations
### Password Security
- bcrypt hashing with 12-round salting
- Never stored in plain text
- Secure comparison to prevent timing attacks
### Input Validation
- Pydantic v2 schema validation on all endpoints
- Email format validation
- Username and password constraints
- Type checking and automatic coercion
### Credential Management
- All secrets use environment variables
- `.env.template` for safe configuration
- `.env` excluded from git via `.gitignore`
- Database passwords in connection strings
### Deployment Security
- Hardened `.gitignore` (databases, keys, secrets excluded)
- No sensitive data in git history
- Docker image security best practices
- GitHub Actions secrets for CI/CD
For detailed security audit, see git commit: `7f49c77`
---
## ๐ง Email Reminders Setup (Optional)
### Gmail Configuration
1. Enable App Passwords: https://myaccount.google.com/apppasswords
2. Create `.env` file:
```env
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password_here
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
```
3. Toggle reminders:
```bash
task-manager toggle-email-reminders
```
### CRON Automation (macOS/Linux)
```bash
crontab -e
# Add this line to run daily at 9:00 AM:
0 9 * * * /bin/bash -c 'source /path/to/venv/bin/activate && python /path/to/task_manager_pro/send_reminders.py'
```
---
## ๐ณ Docker Usage
### Build Image
```bash
docker build -t task-manager-pro:latest .
```
### Run Container
```bash
docker run -p 8000:8000 \
-e DATABASE_URL="sqlite:///./tasks.db" \
-e SECRET_KEY="your-secret-key" \
task-manager-pro:latest
```
### With PostgreSQL
```bash
docker run -p 8000:8000 \
-e DATABASE_URL="postgresql://user:password@postgres:5432/taskdb" \
-e SECRET_KEY="your-secret-key" \
task-manager-pro:latest
```
---
## ๐ Development Roadmap
### Completed โ
- **Phase 1:** Branch consolidation and analysis
- **Phase 2:** Database (SQLAlchemy) & Security (JWT, bcrypt)
- **Phase 3:** REST API with FastAPI (17 endpoints)
- **Phase 4:** Testing (20 tests) & CI/CD (GitHub Actions)
### Upcoming ๐
- **Phase 5:** Advanced features (tags, categories, subtasks, time tracking)
- **Phase 6:** Web UI (React/Vue) & monitoring (logging, APM)
---
## ๐ก Skills Demonstrated
### Backend Development
- **FastAPI & REST APIs** - 17 production endpoints
- **SQLAlchemy ORM** - Relational database modeling
- **JWT Authentication** - Secure token-based auth
- **Pydantic Validation** - Type-safe input/output
- **Python CLI** - argparse command-line tools
### Security & DevOps
- **Password Hashing** - bcrypt with salting
- **Credential Management** - Environment variables
- **Git Security** - Sensitive data exclusion
- **Docker** - Container orchestration
- **GitHub Actions** - CI/CD automation
### Testing & Quality
- **pytest Framework** - Unit and integration tests
- **Test Fixtures** - Database cleanup and isolation
- **API Testing** - Full endpoint coverage
- **Coverage Reports** - Code quality metrics
### Software Engineering
- **Layered Architecture** - Clean separation of concerns
- **Design Patterns** - Dependency injection, factories
- **SOLID Principles** - Single responsibility, interfaces
- **Code Organization** - Modular, scalable structure
---
## ๐ Deployment
### Environment Variables Required
```env
DATABASE_URL=postgresql://user:password@localhost/taskdb
SECRET_KEY=your-secret-key-change-in-production
JWT_ALGORITHM=HS256
JWT_EXPIRATION_HOURS=0.5
DEBUG=False
```
### Production Deployment
1. Set environment variables in hosting platform
2. Use PostgreSQL for production database
3. Set `DEBUG=False` in production
4. Enable HTTPS only
5. Use GitHub Secrets for CI/CD credentials
---
## ๐งฐ Development Notes
- All code includes type hints for IDE support
- Modular architecture enables easy testing and maintenance
- Abstraction via `StorageInterface` supports multiple backends
- Clean OOP design with composition and proper encapsulation
- Fully documented with docstrings and comments
## ๐ Contributing
Feel free to fork, enhance, and submit a pull request.
To suggest features or report bugs, open an issue.
---
## ๐ License
This project is licensed under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0). See the [LICENSE](./LICENSE) file for more details.
---
## ๐ง Author
Built with โค๏ธ by [Satvik Praveen](https://github.com/SatvikPraveen)
---
## โญ๏ธ Star this repo if you found it helpful