A modern, full-featured todo list application built with Laravel 12, demonstrating best practices in web development including authentication, authorization, CRUD operations, and pagination with filtering.
- β CRUD Operations - Create, Read, Update, and Delete todos
- π― Status Management - Track todos with three states: Not Started, In Progress, and Completed
- π Filtering - Filter todos by status with query string preservation
- π Pagination - Simple pagination with 9 items per page
- β‘ Quick Complete - Mark todos as completed with a single click
- π User Authentication - Secure login and registration system
- π€ Role-Based Access Control (RBAC) - Custom middleware for role authorization
- π‘οΈ Custom Authentication Middleware -
EnsureUserIsAuthenticatedandEnsureUserHasRole - πͺ Protected Routes - Guest and authenticated route groups
- π Optimized Queries - Eager loading to prevent N+1 problems
- π¨ Modern UI - Built with TailwindCSS 4.0 and Alpine.js
- π§© Blade Components - Reusable UI components
- β Form Validation - Server-side validation with Laravel's validation system
- π§ͺ Testing Ready - Configured with Pest PHP for testing
- π Debug Toolbar - Laravel Debugbar for development
- Laravel 12 - PHP framework
- PHP 8.2+ - Programming language
- SQLite - Database (easily switchable to MySQL/PostgreSQL)
- Eloquent ORM - Database abstraction
- TailwindCSS 4.0 - Utility-first CSS framework
- Alpine.js 3.15 - Lightweight JavaScript framework
- Vite 7.0 - Frontend build tool
- Blade Templates - Laravel's templating engine
- Pest PHP 4.3 - Testing framework
- Laravel Pint - Code style fixer
- Laravel Debugbar - Debugging tool
- Laravel Pail - Log viewer
- Concurrently - Run multiple dev processes
- PHP 8.2 or higher
- Composer
- Node.js 18+ and npm
- SQLite (or MySQL/PostgreSQL if you prefer)
# Clone the repository
git clone <your-repository-url>
cd to-do-list-app
# Install dependencies and setup
composer setup
# This runs:
# - composer install
# - Copies .env.example to .env
# - Generates application key
# - Runs migrations
# - npm install
# - npm run buildIf you prefer to set up manually:
# Install PHP dependencies
composer install
# Copy environment file
cp .env.example .env
# Generate application key
php artisan key:generate
# Create SQLite database file
touch database/database.sqlite
# Run migrations
php artisan migrate
# Seed the database (optional)
php artisan db:seed
# Install Node dependencies
npm install
# Build frontend assets
npm run buildRun all development services with a single command:
composer run devThis runs concurrently:
- Laravel development server (http://localhost:8000)
- Queue listener
- Log viewer (Pail)
- Vite dev server (Hot Module Replacement)
After running the seeder, you can log in with:
- Email: test@example.com
- Password: password
-
Create a Todo
- Click "Add New Todo" button
- Fill in the title, description, and select a status
- Submit the form
-
Filter Todos
- Use the status filter buttons to view todos by status
- URL will reflect the current filter (e.g.,
?status=not_started)
-
Edit a Todo
- Click the "Edit" button on any todo card
- Modify the details and save
-
Complete a Todo
- Click the "Mark Complete" button to instantly set status to Completed
-
Delete a Todo
- Click the "Delete" button and confirm
- Not Started - Todo hasn't been started yet
- In Progress - Currently working on the todo
- Completed - Todo is finished
βββ app/
β βββ Http/
β β βββ Controllers/
β β β βββ Auth/ # Authentication controllers
β β β βββ TodoController.php
β β βββ Middleware/
β β βββ EnsureUserHasRole.php
β β βββ EnsureUserIsAuthenticated.php
β βββ Models/
β βββ Status.php # Status model with constants
β βββ Todo.php # Todo model
β βββ User.php # User model with role support
βββ database/
β βββ factories/ # Model factories
β βββ migrations/ # Database migrations
β βββ seeders/ # Database seeders
βββ resources/
β βββ css/
β βββ js/
β βββ views/
β βββ auth/ # Authentication views
β βββ components/ # Blade components
β βββ layouts/ # Layout templates
β βββ todos/ # Todo views
βββ routes/
βββ auth.php # Authentication routes
βββ web.php # Web routes
Custom authentication implementation with:
- Registration with name, email, and password
- Login/logout functionality
- Protected routes using middleware
- Session-based authentication
Role-based access control with:
hasRole()method on User modelEnsureUserHasRolemiddleware with role parameter- Example:
middleware('role:admin')in routes
// Eager loading to prevent N+1 problems
Todo::with('status')->select(['id', 'title', 'description', 'status_id']);Pagination maintains filter parameters:
$todos->simplePaginate(9)->withQueryString();Edit .env to use MySQL or PostgreSQL:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database
DB_USERNAME=your_username
DB_PASSWORD=your_passwordEdit TodoController.php:
// Change from 9 to your preferred number
$todos = $todos->simplePaginate(9)->withQueryString();Add constants to app/Models/Status.php and create a migration to add the new status to the database.
Pagination doesn't preserve filter query stringsβ FIXED withwithQueryString()
- Deployment with Docker Compose
- User-specific todos (multi-tenancy)
- Due dates and reminders
- Search functionality
- Email notifications
- Export todos (PDF/CSV)
This project follows Laravel conventions and uses:
- PSR-12 coding standard
- Laravel Pint for automatic code formatting
Format code with:
./vendor/bin/pintThis is a learning/portfolio project. Feel free to fork and experiment!
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
composer test) - Format code (
./vendor/bin/pint) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open-sourced software licensed under the MIT license.
Built as a learning project to demonstrate:
- Laravel 12 framework capabilities
- Modern PHP development practices
- Authentication and Authorization (AuthN/AuthZ)
- RESTful resource controllers
- Database optimization techniques
- Frontend integration with TailwindCSS and Alpine.js
Note: This project is designed to be junior developer friendly, showcasing fundamental concepts in web development including authentication (AuthN) and authorization (AuthZ), CRUD operations, and best practices in Laravel development.