A gamified productivity app that helps you earn your gaming time by completing tasks first.
"You don't block fun. You earn it."
Features โข Installation โข Contributing โข License
Focus-Lock is a Windows desktop application that enforces productivity by restricting access to games and selected applications until you complete predefined tasks. It gamifies your productivity with XP, levels, and achievements.
src/
โโโ main/ # Electron main process / backend
โ โโโ services/ # Business logic services
โ โ โโโ task-service.ts # Task management business logic
โ โโโ database/ # Database operations
โ โ โโโ database.ts # SQLite database manager
โ โ โโโ schema.ts # Database schema definitions
โ โโโ utils/ # Utility functions
โโโ renderer/ # Frontend UI (React)
โ โโโ components/ # React components
โ โ โโโ TaskList.tsx # Task list display
โ โ โโโ TaskForm.tsx # Task creation/editing form
โ โโโ hooks/ # Custom React hooks
โ โ โโโ useTasks.ts # Task state management
โ โโโ stores/ # State management (Zustand)
โ โโโ styles/ # Global styles
โโโ shared/ # Shared types and constants
โ โโโ types.ts # TypeScript type definitions
โโโ tests/ # Unit tests
โโโ task-service.test.ts # Task service tests
- Framework: Electron (desktop) + React (UI)
- Language: TypeScript (strict mode)
- Database: SQLite3
- Styling: TailwindCSS
- Icons: Lucide React
- State Management: Zustand
- Testing: Jest + Testing Library
npm install# Start development servers (main + renderer)
npm run dev
# Build for production
npm run build
# Run tests
npm run test
# Run tests in watch mode
npm run test:watch- Data Model: Task interface with status, difficulty, timestamps
- Database Schema: SQLite schema with proper indexing
- CRUD Operations: Create, read, update, delete tasks
- Business Logic: TaskService with validation and error handling
- UI Components: TaskList and TaskForm components
- Custom Hooks: useTasks hook for state management
- Unit Tests: Comprehensive test suite for TaskService
- Styling: TailwindCSS configuration with design tokens
interface Task {
id: string;
title: string;
description: string;
status: TaskStatus;
difficulty: TaskDifficulty;
createdAt: number;
completedAt: number | null;
dueDate?: number;
}- Atomic transactions for data consistency
- Indexed queries for performance
- WAL mode for concurrent access
- Automatic schema versioning
- Input validation (title, description, dates)
- Error handling with descriptive messages
- Business logic separation from database
- Helper methods (completion percentage, all completed check)
- TaskList: Displays tasks with status indicators, edit/delete buttons
- TaskForm: Create/edit tasks with validation feedback
- Accessibility features (keyboard navigation, ARIA labels)
- Responsive design with TailwindCSS
- Unit tests for all service methods
- Mock database for isolation
- Edge case coverage (empty inputs, past dates, etc.)
- 80%+ code coverage target
- โ TypeScript strict mode enabled
- โ Input validation on all user inputs
- โ Error handling with try-catch blocks
- โ Descriptive comments on all functions
- โ No hardcoded sensitive values
- โ Secure defaults (WAL mode, foreign keys)
- Phase 1.2: Sticky Notes System
- Phase 1.3: Focus Mode Core
- Phase 1.4: Application Restriction Engine
- Phase 1.5: Unlock Logic
- Security requirements
- Code style standards
- UI/UX rules
- Backend architecture principles
- Testing requirements
- Anti-cheat measures
We welcome contributions from the community! Please read our Contributing Guidelines before submitting a PR.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'feat: add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
See CONTRIBUTING.md for detailed guidelines.
This project follows the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.
For security concerns, please see our Security Policy.
This project is licensed under the MIT License - see the LICENSE file for details.
- All our amazing contributors
- The open-source community for inspiration and tools
Made with โค๏ธ by the Focus-Lock Community
โญ Star us on GitHub โ it motivates us a lot!