A robust REST API backend for Taskline - a project management focused todo system built with Laravel 12 and Sanctum for token-based authentication.
- Token-Based Authentication - Secure API authentication using Laravel Sanctum
- User Management - Register, login, logout functionality
- Project Management - Create, read, update, delete projects with team collaboration
- Task Management - Full CRUD operations with priorities, status tracking, and due dates
- Dashboard API - Aggregated stats, today's tasks, and project overview
- PHP 8.2+
- Composer
- SQLite/MySQL/PostgreSQL
# Clone the repository
git clone <repository-url>
cd taskline
# Install dependencies
composer install
# Copy environment file
cp .env.example .env
# Generate application key
php artisan key:generate
# Create database (SQLite)
touch database/database.sqlite
# Run migrations
php artisan migrate
# Seed database with demo data
php artisan db:seed
# Start development server
php artisan serveAfter seeding, you can use these credentials:
| Password | Role | |
|---|---|---|
| john@taskline.com | password123 | Main Demo User |
| alice@taskline.com | password123 | Designer |
| bob@taskline.com | password123 | Backend Developer |
| carol@taskline.com | password123 | Manager |
Base URL: http://localhost:8000/api
All protected endpoints require the Authorization: Bearer <token> header.
POST /auth/register
Content-Type: application/json
{
"name": "John Doe",
"email": "john@example.com",
"password": "password123",
"password_confirmation": "password123"
}
Response: { success, message, data: { user, token } }
POST /auth/login
Content-Type: application/json
{
"email": "john@taskline.com",
"password": "password123"
}
Response: { success, message, data: { user, token } }
POST /auth/logout
Authorization: Bearer <token>
Response: { success, message }
GET /auth/user
Authorization: Bearer <token>
Response: { success, data: { id, name, email } }
GET /dashboard
Authorization: Bearer <token>
Response: {
success: true,
data: {
user_name: "John Developer",
total_tasks: 6,
stats: [
{ label: "pending", count: 5 },
{ label: "in_progress", count: 0 },
{ label: "completed", count: 1 }
],
projects: [
{ id, name, description, progress }
],
todays_tasks: [
{ id, title, due_date, done }
]
}
}
GET /projects
Authorization: Bearer <token>
Response: {
success: true,
data: {
total_projects: 3,
projects: [
{
id, title, description,
team: [{ id, name, email }],
owner: { id, name },
progress, status
}
]
}
}
POST /projects
Authorization: Bearer <token>
Content-Type: application/json
{
"title": "New Project",
"description": "Project description",
"team": [2, 3] // Optional user IDs for team members
}
Response: { success, message, data: { project } }
GET /projects/{id}
Authorization: Bearer <token>
Response: { success, data: { project with tasks_count } }
PUT /projects/{id}
Authorization: Bearer <token>
Content-Type: application/json
{
"title": "Updated Title",
"description": "Updated description",
"status": "active|completed|archived",
"team": [2, 3, 4]
}
Response: { success, message, data: { project } }
DELETE /projects/{id}
Authorization: Bearer <token>
Response: { success, message }
GET /tasks
GET /tasks?project_id=1
GET /tasks?status=pending
GET /tasks?priority=high
Authorization: Bearer <token>
Response: {
success: true,
data: {
total_tasks: 12,
tasks: [
{
id, title, description, due_date,
assigned_to: { id, name },
priority, status, is_done,
project: { id, title }
}
]
}
}
POST /tasks
Authorization: Bearer <token>
Content-Type: application/json
{
"title": "New Task",
"description": "Task description",
"project_id": 1,
"due_date": "2026-02-15",
"assigned_to": 1,
"priority": "high|medium|low"
}
Response: { success, message, data: { task } }
GET /tasks/{id}
Authorization: Bearer <token>
Response: {
success: true,
data: {
id, title, description, due_date,
assigned_to: { id, name, email },
created_by: { id, name },
priority, status, is_done,
project: { id, title },
created_at, updated_at
}
}
PUT /tasks/{id}
Authorization: Bearer <token>
Content-Type: application/json
{
"title": "Updated Task",
"description": "Updated description",
"due_date": "2026-02-20",
"assigned_to": 2,
"priority": "medium",
"status": "in_progress",
"is_done": false
}
Response: { success, message, data: { task } }
PATCH /tasks/{id}/toggle-done
Authorization: Bearer <token>
Response: { success, message, data: { id, is_done, status } }
DELETE /tasks/{id}
Authorization: Bearer <token>
Response: { success, message }
- id, name, email, password, email_verified_at, created_at, updated_at
- id, title, description, owner_id, progress (0-100%), status (active/completed/archived), created_at, updated_at
- id, title, description, project_id, assigned_to, created_by, priority (low/medium/high), status (pending/in_progress/completed), due_date, is_done, created_at, updated_at
# Login and get token
TOKEN=$(curl -s -X POST http://localhost:8000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"john@taskline.com","password":"password123"}' | jq -r '.data.token')
# Get dashboard
curl -s http://localhost:8000/api/dashboard \
-H "Authorization: Bearer $TOKEN" | jq .
# Get projects
curl -s http://localhost:8000/api/projects \
-H "Authorization: Bearer $TOKEN" | jq .
# Create task
curl -s -X POST http://localhost:8000/api/tasks \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"title":"New Task","project_id":1,"priority":"high"}' | jq .app/
├── Http/Controllers/Api/
│ ├── AuthController.php # Authentication endpoints
│ ├── DashboardController.php # Dashboard/Home screen data
│ ├── ProjectController.php # Project CRUD operations
│ └── TaskController.php # Task CRUD operations
├── Models/
│ ├── User.php # User model with relationships
│ ├── Project.php # Project model
│ └── Task.php # Task model
database/
├── factories/ # Model factories for testing
├── migrations/ # Database schema
└── seeders/
└── DatabaseSeeder.php # Strategic demo data
routes/
└── api.php # API route definitions
This project is open-sourced software licensed under the MIT license.