📋 Giới thiệu
itasks là hệ thống quản lý task nội bộ cho các team agent của CODE TỐT — nơi agent và con người cùng theo dõi, tạo và cập nhật công việc qua một API thống nhất.
Kiến trúc dữ liệu
Dữ liệu được tổ chức theo 3 tầng: Workspace → Project → Task.
Workspace
Phạm vi cách ly dữ liệu. Mỗi workspace có token riêng và chỉ truy cập được dữ liệu trong chính nó.
Project
Nhóm các task theo dự án. Thuộc về một workspace, có status, priority và due_date riêng.
Task
Đơn vị công việc cụ thể. Gắn vào một project, có title, description, status, priority, deadline, estimation_hours.
Tính năng chính
- Kanban board — quản lý task theo cột status (To Do / In Progress / Done).
- Agent-friendly API — API workspace-scoped để agent tự CRUD project & task bằng Bearer token.
- Status lifecycle tự động — đặt
status: donetự ghicompleted_at. - Đa workspace — mỗi team/agent có workspace riêng, dữ liệu cách ly tuyệt đối.
- Livewire 3 + Alpine.js — UI không cần SPA build step, dễ deploy.
Tech stack
| Layer | Technology |
|---|---|
| Framework | Laravel 13 |
| PHP | 8.3 |
| Database | MariaDB 10.11 (production) |
| Frontend | Livewire 3 + Alpine.js + Tailwind CSS 3 |
| Drag-drop | SortableJS + Livewire Sortable |
| Auth | Laravel Sanctum (SPA session + Bearer token) |
🔌 API Reference
API workspace-scoped cho agent CRUD project & task. Base URL: https://tasks.chuyen.dev.
Authentication
Token được tạo từ Admin → Workspaces → Edit → API Tokens. Token có prefix ws_ và hiển thị một lần duy nhất khi tạo — hãy lưu ngay. Mọi request đều cần 2 header:
Authorization: Bearer ws_xxxxxxxx Content-Type: application/json
Sample — tạo token & gọi API
# 1. Tạo token trong Admin → Workspaces → Edit → API Tokens # → nhận token dạng ws_xxxxxxxx... # 2. Lưu vào biến môi trường (không hardcode trong code) export ITASKS_TOKEN=ws_xxxxxxxx # 3. Dùng trong mọi request curl -H "Authorization: Bearer $ITASKS_TOKEN" \ https://tasks.chuyen.dev/api/workspace/1/projects
Endpoints — Projects
| Method | Endpoint | Mô tả | Success |
|---|---|---|---|
GET | /api/workspace/{id}/projects | Liệt kê tất cả project | 200 |
POST | /api/workspace/{id}/projects | Tạo project mới | 201 |
GET | /api/workspace/{id}/projects/{pid} | Lấy chi tiết project | 200 |
PUT | /api/workspace/{id}/projects/{pid} | Cập nhật project | 200 |
DELETE | /api/workspace/{id}/projects/{pid} | Xóa project | 200 |
Project payload (create / update)
{
"name": "Project Name",
"description": "Optional description",
"status": "open",
"priority": "p1",
"due_date": "2026-08-01"
}
Sample — POST create project
Request:
curl -X POST -H "Authorization: Bearer $ITASKS_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name":"Website Redesign","priority":"p1","due_date":"2026-08-01"}' \ https://tasks.chuyen.dev/api/workspace/1/projects
Response 201 Created:
{
"id": 12,
"name": "Website Redesign",
"slug": "website-redesign",
"description": null,
"status": "open",
"priority": "p1",
"due_date": "2026-08-01",
"created_by": 1,
"created_at": "2026-08-12T03:50:00.000000Z",
"updated_at": "2026-08-12T03:50:00.000000Z",
"deleted_at": null,
"tasks": [],
"creator": { "id": 1, "name": "Khoi Nguyen", "email": "[email protected]" }
}
Sample — GET list projects
Request:
curl -H "Authorization: Bearer $ITASKS_TOKEN" \ https://tasks.chuyen.dev/api/workspace/1/projects
Response 200 OK — mảng các project, mỗi project kèm tasks và creator:
[
{
"id": 12,
"name": "Website Redesign",
"slug": "website-redesign",
"status": "open",
"priority": "p1",
"due_date": "2026-08-01",
"tasks": [
{ "id": 55, "title": "Fix login bug", "status": "open" }
],
"creator": { "id": 1, "name": "Khoi Nguyen" }
}
]
Endpoints — Tasks
| Method | Endpoint | Mô tả | Success |
|---|---|---|---|
GET | /api/workspace/{id}/tasks | Liệt kê tất cả task | 200 |
POST | /api/workspace/{id}/tasks | Tạo task mới | 201 |
GET | /api/workspace/{id}/tasks/{tid} | Lấy chi tiết task | 200 |
PUT | /api/workspace/{id}/tasks/{tid} | Cập nhật task | 200 |
DELETE | /api/workspace/{id}/tasks/{tid} | Xóa task | 200 |
Task payload (create / update)
{
"title": "Task title",
"description": "Optional description",
"project_id": 1,
"status": "open",
"priority": "p1",
"deadline": "2026-08-01",
"estimation_hours": 2.5
}
Sample — POST create task
Request:
curl -X POST -H "Authorization: Bearer $ITASKS_TOKEN" \ -H "Content-Type: application/json" \ -d '{"title":"Fix login bug","project_id":12,"priority":"p1","estimation_hours":2.5}' \ https://tasks.chuyen.dev/api/workspace/1/tasks
Response 201 Created:
{
"id": 55,
"project_id": 12,
"title": "Fix login bug",
"description": null,
"status": "open",
"priority": "p1",
"assignee_id": null,
"deadline": null,
"estimation_hours": "2.5",
"created_by": 1,
"completed_at": null,
"created_at": "2026-08-12T04:00:00.000000Z",
"updated_at": "2026-08-12T04:00:00.000000Z",
"deleted_at": null,
"project": { "id": 12, "name": "Website Redesign", "slug": "website-redesign" },
"assignee": null,
"creator": { "id": 1, "name": "Khoi Nguyen" }
}
Sample — PUT update task status → done
Request:
curl -X PUT -H "Authorization: Bearer $ITASKS_TOKEN" \ -H "Content-Type: application/json" \ -d '{"status":"done"}' \ https://tasks.chuyen.dev/api/workspace/1/tasks/55
Response 200 OK — status: done tự ghi completed_at:
{
"id": 55,
"project_id": 12,
"title": "Fix login bug",
"status": "done",
"priority": "p1",
"completed_at": "2026-08-12T05:12:30.000000Z",
"updated_at": "2026-08-12T05:12:30.000000Z",
"project": { "id": 12, "name": "Website Redesign" },
"assignee": null,
"creator": { "id": 1, "name": "Khoi Nguyen" }
}
Field validation
| Field | Rules |
|---|---|
title | required, string, max 255 |
description | nullable, string, max 2000 |
project_id | required, must exist in projects |
status | optional, one of open|in_progress|done|cancelled|hold |
priority | optional, one of p0|p1|p2 |
deadline | nullable, date |
estimation_hours | nullable, numeric, min 0, max 999 |
Status lifecycle
Khi đặt status: done, hệ thống tự ghi completed_at. Khi chuyển về open/in_progress, completed_at bị xóa.
Error cases (failure)
Mọi lỗi đều trả JSON dạng {"message": "..."}. Lỗi validation trả thêm mảng errors.
401 — Thiếu hoặc sai token
curl -H "Authorization: Bearer ws_wrongtoken" \ https://tasks.chuyen.dev/api/workspace/1/projects
401 Unauthorized { "message": "Invalid token." }
403 — Token không thuộc workspace
403 Forbidden { "message": "Token does not belong to this workspace." }
404 — Project/task không tồn tại trong workspace
404 Not Found { "message": "Project not found in this workspace." }
422 — Validation error
Khi payload thiếu field bắt buộc hoặc sai giá trị:
curl -X POST -H "Authorization: Bearer $ITASKS_TOKEN" \ -H "Content-Type: application/json" \ -d '{}' \ https://tasks.chuyen.dev/api/workspace/1/projects
422 Unprocessable Entity { "message": "The name field is required.", "errors": { "name": [ "The name field is required." ] } }
💻 Usage — Quick Start
Các ví dụ dùng token placeholder ws_xxxxxxxx — thay bằng token thật của workspace bạn (xem tab API để biết chi tiết response).
Setup token
export ITASKS_TOKEN=ws_xxxxxxxx
List projects
curl -H "Authorization: Bearer $ITASKS_TOKEN" \ https://tasks.chuyen.dev/api/workspace/1/projects
Create a project
curl -X POST -H "Authorization: Bearer $ITASKS_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name":"Website Redesign","priority":"p1"}' \ https://tasks.chuyen.dev/api/workspace/1/projects
Create a task
curl -X POST -H "Authorization: Bearer $ITASKS_TOKEN" \ -H "Content-Type: application/json" \ -d '{"title":"Fix login bug","project_id":1,"priority":"p1","estimation_hours":2.5}' \ https://tasks.chuyen.dev/api/workspace/1/tasks
Update task status → done
curl -X PUT -H "Authorization: Bearer $ITASKS_TOKEN" \ -H "Content-Type: application/json" \ -d '{"status":"done"}' \ https://tasks.chuyen.dev/api/workspace/1/tasks/1
Delete a task
curl -X DELETE -H "Authorization: Bearer $ITASKS_TOKEN" \ https://tasks.chuyen.dev/api/workspace/1/tasks/1
Status lifecycle
| Status | Ý nghĩa | completed_at |
|---|---|---|
open | Mở, chưa bắt đầu | — |
in_progress | Đang thực hiện | — |
done | Hoàn thành | Tự ghi timestamp |
cancelled | Hủy bỏ | — |
hold | Tạm hoãn | — |
🔒 Bảo mật
itasks áp dụng token per-workspace và kiểm tra quyền ở nhiều lớp để cách ly dữ liệu giữa các team.
Token per workspace
- Mỗi workspace có token riêng, prefix
ws_. - Token chỉ truy cập được dữ liệu trong workspace của chính nó.
- Token được lưu dạng SHA-256 hash trong database — không lưu plaintext.
Scope giới hạn
Mọi endpoint API đều đi qua middleware workspace-token, kiểm tra token thuộc đúng workspace trước khi xử lý. Project/task thuộc workspace khác sẽ bị chặn.
Error codes
| Status | Trường hợp |
|---|---|
401 | Thiếu hoặc sai token (Missing bearer token / Invalid token) |
403 | Token không thuộc workspace này, hoặc project/task không thuộc workspace |
404 | Project/task không tồn tại trong workspace |
⚠️ Lưu ý
- Không bao giờ ghi token thật vào code, docs, hoặc commit.
- Token trong ví dụ luôn dùng placeholder
ws_xxxxxxxx. - Nếu token bị lộ, revoke ngay từ Admin → Workspaces → API Tokens.
❓ FAQ
Các câu hỏi thường gặp khi dùng itasks.
Làm sao để tạo API token?
Vào Admin → Workspaces → Edit → API Tokens và tạo token mới. Token sẽ hiển thị một lần duy nhất — hãy lưu lại ngay.
Token có thể truy cập dữ liệu của workspace khác không?
Không. Token bị scope cứng vào workspace của nó. Truy cập workspace khác trả về 403.
Đặt task thành done thì điều gì xảy ra?
Hệ thống tự ghi completed_at với timestamp hiện tại. Nếu chuyển về open/in_progress, trường này bị xóa.
Task có bắt buộc thuộc một project không?
Có. project_id là bắt buộc khi tạo task, và project phải thuộc cùng workspace với token.
itasks có phải open source không?
Có. Source nằm trên GitLab (mirror từ GitHub codetot-ai/itasks).