A clean, modular task management application built with vanilla JavaScript, featuring localStorage persistence and a beautiful UI.
- ✅ Add, edit, delete, and toggle tasks
- 🔍 Filter tasks (All, Active, Completed)
- 💾 Automatic persistence to localStorage
- ✏️ Double-click to edit tasks
- 📱 Responsive design
- 🎨 Modern, gradient UI
- 🔒 XSS protection with HTML escaping
task-manager/
├── index.html # Main HTML file
├── styles.css # Application styles
├── src/
│ ├── app.js # Main application controller
│ ├── Task.js # Task entity class
│ ├── store.js # LocalStorage persistence
│ ├── view.js # Rendering logic
│ └── utils.js # Utility functions
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose setup
└── .dockerignore # Docker ignore file
Simply open index.html in a modern browser. The app uses ES6 modules but doesn't require a build step.
- Docker installed
- Docker Compose installed (comes with Docker Desktop)
-
Clone or download the project
cd task-manager -
Build the Docker image
docker build -t task-manager . -
Run the container
docker run -d -p 8080:80 --name task-manager-app task-manager
-
Open in browser
http://localhost:8080
-
Start the application
docker-compose up -d
-
View logs
docker-compose logs -f
-
Stop the application
docker-compose down
-
Rebuild after changes
docker-compose up -d --build
# List running containers
docker ps
# List all containers
docker ps -a
# Stop container
docker stop task-manager-app
# Start container
docker start task-manager-app
# Remove container
docker rm task-manager-app
# View logs
docker logs task-manager-app
# Execute command in container
docker exec -it task-manager-app sh# List images
docker images
# Remove image
docker rmi task-manager
# Build with no cache
docker build --no-cache -t task-manager .# Start services
docker-compose up -d
# Stop services
docker-compose down
# View logs
docker-compose logs
# Rebuild and start
docker-compose up -d --build
# Scale services (if needed)
docker-compose up -d --scale task-manager=3-
Initialize Git repository
git init
-
Add all files
git add . -
Create .gitignore (optional)
# OS files .DS_Store Thumbs.db # IDE .vscode/ .idea/ -
Commit changes
git commit -m "Initial commit: Modular task manager" -
Create repository on GitHub
- Go to https://github.com/new
- Name it
task-manager - Don't initialize with README
-
Push to GitHub
git remote add origin https://github.com/npm-DevPatel/task-manager.git git branch -M main git push -u origin main
The application follows a modular architecture with clear separation of concerns:
-
Task.js - Entity layer
- Defines Task class with validation
- Enforces invariants (non-empty title)
- Provides serialization methods
-
store.js - Persistence layer
- Handles localStorage read/write
- Converts between Task objects and JSON
-
view.js - Presentation layer
- Renders HTML safely (XSS protection)
- Updates UI counts and filters
- No direct state manipulation
-
app.js - Controller layer
- Coordinates between modules
- Handles user events
- Manages application state
-
utils.js - Utility layer
- Provides helper functions
- HTML escaping for security
- Unique ID generation
User Action → app.js → Task methods → store.js → view.js → DOM
-
Add Task Editing
- Already implemented! Double-click any task to edit
-
Add TimedTask
class TimedTask extends Task { constructor(title, dueDate, id, done) { super(title, id, done); this.dueDate = new Date(dueDate); } isOverdue() { return this.dueDate < new Date() && !this.done; } }
-
Add Search Filter
- Add search input in HTML
- Filter tasks by title in view.js
- Show match count
-
Add Categories/Tags
- Extend Task class with tags array
- Add tag filter UI
- Color-code by category
- Open the app in a browser
- Add several tasks
- Toggle completion status
- Filter by Active/Completed
- Double-click to edit a task
- Delete some tasks
- Clear completed tasks
- Refresh the page - tasks should persist!