Enhanced Todo App
A modern todo application built with vanilla JavaScript (ES6+) following clean architecture principles, featuring IndexedDB persistence and smooth animations.
š® Features
- Clean Architecture - State ā Rules ā Actions ā UI pattern
- IndexedDB Persistence - Todos saved locally and persist across sessions
- Smooth Animations - Create/destroy animations for better UX
- Modern ES6+ - Modules, classes, arrow functions, async/await
- Filter System - View all, active, or completed todos
- Statistics - Track total, active, and completed todos
- Responsive Design - Works on mobile, tablet, and desktop
- Dark Theme - Beautiful dark UI with gradient accents
š Quick Start
- Open
index.html in your browser
- Start adding todos!
- Your todos are automatically saved
š Learning Resources
This project demonstrates modern web development patterns:
šÆ Architecture
State (TodoState)
ā
Rules (TodoLogic) ā Pure functions, no side effects
ā
Actions (add, toggle, delete)
ā
UI (Renderer + EventHandler) ā DOM updates with animations
ā
Storage (IndexedDBService) ā Persistent data
š Project Structure
todo-app/
āāā index.html
āāā src/
ā āāā core/ # Pure logic
ā ā āāā constants.js
ā ā āāā TodoLogic.js
ā ā āāā utils.js
ā āāā services/ # External integrations
ā ā āāā IndexedDBService.js
ā āāā state/ # Orchestration
ā ā āāā TodoState.js
ā āāā ui/ # Rendering & events
ā ā āāā Renderer.js
ā ā āāā EventHandler.js
ā āāā main.js # Entry point
āāā styles/
ā āāā main.css
ā āāā components.css
ā āāā animations.css
āāā docs/ # Tutorials
š What You'll Learn
JavaScript (ES6+)
- ā
Async/await & Promises
- ā
IndexedDB API
- ā
Modules (import/export)
- ā
Classes & static methods
- ā
Array methods (map, filter, sort)
- ā
Spread operator
- ā
Template literals
- ā
Optional chaining
CSS
- ā
CSS Variables
- ā
Flexbox layout
- ā
Keyframe animations
- ā
Transitions
- ā
Responsive design
- ā
Custom scrollbars
Architecture
- ā
Separation of concerns
- ā
Pure functions
- ā
State management
- ā
Event handling
- ā
CRUD operations
- ā
Persistent storage
š® Features
Add Todos
- Type in the input field
- Press Enter or click "Add"
- Todo appears with animation
Manage Todos
- Check/Uncheck - Toggle completion status
- Delete - Click X button (appears on hover)
- Filter - View all, active, or completed
- Clear Completed - Remove all completed todos
Keyboard Shortcuts
Enter - Add new todo
Escape - Clear input (when focused)
š” Key Concepts
1. IndexedDB for Persistence
// Todos automatically saved to browser database
await storage.addTodo(newTodo);
2. Smooth Animations
// CSS animations triggered by JavaScript
element.classList.add('todo-entering');
3. Pure Functions
static createTodo(text) {
return { id, text, status, createdAt };
}
4. Async/Await Pattern
async addTodo(text) {
await this.storage.addTodo(newTodo);
await this.renderer.animateAddTodo(newTodo);
}
š Next Steps
Beginner
- Add todo categories/tags
- Add due dates
- Change color scheme
- Add drag-and-drop reordering
- Add todo editing
- Add priority levels
- Export/import todos
Advanced
- Add cloud sync (Firebase)
- Add collaborative features
- Add recurring todos
- Rebuild in React/Vue/Svelte
š Resources
Built with ā¤ļø using vanilla JavaScript and IndexedDB