@content-workers/plugin-demo-tasks
v1.0.1
Published
Demo plugin for Content Workers - Task management with backend API and admin UI
Maintainers
Readme
Demo Tasks Plugin
A demonstration plugin for Content Workers that showcases how to create plugins with both backend API endpoints and admin UI extensions.
Features
Backend API
- Task Management: Full CRUD operations for tasks
- Filtering & Pagination: Query tasks by status, priority, assignee
- Statistics: Get task statistics and analytics
- RESTful API: Clean REST endpoints following Content Workers conventions
Admin UI Extensions
- Sidebar Navigation: Adds "Tasks" section to admin sidebar
- Task List View: Browse and manage tasks in the admin panel
- Create/Edit Forms: User-friendly forms for task management
- Settings Panel: Plugin configuration in admin settings
API Endpoints
All endpoints are prefixed with /api/v1/plugins/demo-tasks:
GET /tasks- List tasks with filtering and paginationGET /tasks/:id- Get specific taskPOST /tasks- Create new taskPUT /tasks/:id- Update taskDELETE /tasks/:id- Delete taskGET /stats- Get task statistics
Installation
- Install the plugin package:
npm install @content-workers/plugin-demo-tasks- Add to your Content Workers configuration:
import DemoTasksPlugin from "@content-workers/plugin-demo-tasks";
export default defineConfig((env) => ({
// ... other config
plugins: [
DemoTasksPlugin({
enableNotifications: true,
defaultPriority: "medium",
maxTasksPerUser: 100
}),
// ... other plugins
],
}));Configuration Options
interface PluginOptions {
enableNotifications?: boolean; // Enable task notifications
defaultPriority?: TaskPriority; // Default priority for new tasks
maxTasksPerUser?: number; // Maximum tasks per user
}Task Schema
interface Task {
id: string;
title: string;
description?: string;
priority: "low" | "medium" | "high" | "urgent";
status: "pending" | "in_progress" | "completed" | "cancelled";
dueDate?: string;
assignedTo?: string;
tags: string[];
createdAt: string;
updatedAt: string;
}Usage Examples
Create a Task
curl -X POST http://localhost:6543/api/v1/plugins/demo-tasks/tasks \
-H "Content-Type: application/json" \
-d '{
"title": "Implement new feature",
"description": "Add user authentication",
"priority": "high",
"status": "pending",
"assignedTo": "developer",
"tags": ["feature", "auth"]
}'Get Tasks with Filtering
curl "http://localhost:6543/api/v1/plugins/demo-tasks/tasks?status=pending&priority=high&page=1&limit=10"Get Task Statistics
curl http://localhost:6543/api/v1/plugins/demo-tasks/statsDevelopment
This plugin demonstrates:
- Plugin SDK Usage: Using the new plugin builder API
- Backend Routes: Adding custom API endpoints
- Admin Integration: Extending the admin panel with custom UI
- Type Safety: Full TypeScript support with Zod validation
- Service Architecture: Clean separation of concerns
Plugin Architecture
src/
├── constants.ts # Plugin constants and enums
├── types.ts # TypeScript types and Zod schemas
├── services/ # Business logic services
│ └── task-service.ts
├── routes/ # API route handlers
│ └── task-routes.ts
├── plugin.ts # Main plugin definition
└── index.ts # Export entry pointLicense
MIT
