feat: Add Employee Directory Demo Plugin (2M Records Performance Showcase)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 18/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- react, sqlite, tailwindcss, typescript, vite
- Lĩnh vực
- api, backend, data, frontend, performance
Hướng nghiên cứu
Start with the monorepo root package.json workspaces and an existing packages/ plugin to copy its layout, then read the local edgecache-demo source the issue points to. The work touches packages/employee-directory-demo/src/schema, src/routes/employees.ts and src/seed/generator.ts, plus the frontend components and demo/wrangler.toml. Done means the package builds, /api/v1/employees returns filtered, paginated results with a source field, and the demo deploys. The scope is large and the thread has been quiet for about eight months, so confirm with maintainers before starting.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Overview
Import the Edge Cache Demo from the standalone repository into the SonicJS monorepo as a dedicated Employee Directory Demo Plugin. This demo showcases SonicJS's exceptional performance handling large datasets (2M+ records with relations) on Cloudflare's edge infrastructure.
Live Demo: https://edgecache-demo.pages.dev/
Source Repository: https://github.com/lane711/edgecache-demo (to be imported from local /Users/lane/Dev/refs/edgecache-demo)
Motivation
- Performance Showcase: Demonstrates SonicJS handling 2 million employee records with department relations at sub-50ms response times
- Edge Computing Benefits: Shows the speed advantage of edge-cached APIs vs traditional origin servers
- Plugin Architecture Example: Serves as a reference implementation for building demo plugins
- Marketing Asset: Provides tangible performance proof for the SonicJS website and documentation
Proposed Implementation
1. Create Demo Plugin Package
Add a new package at packages/employee-directory-demo/ with the following structure:
packages/employee-directory-demo/
├── package.json
├── README.md
├── src/
│ ├── index.ts # Plugin export
│ ├── schema/
│ │ └── employees.ts # Employee + Department schema definitions
│ ├── routes/
│ │ └── employees.ts # API routes for employee listing
│ ├── seed/
│ │ └── generator.ts # Seed data generator for 2M records
│ └── frontend/
│ ├── App.tsx # React demo frontend
│ ├── components/
│ │ ├── Sidebar.tsx
│ │ ├── Persons.tsx
│ │ ├── Stats.tsx
│ │ ├── Pagination.tsx
│ │ └── ...
│ └── index.css
└── demo/
├── wrangler.toml # Cloudflare Pages config
└── index.html
2. Core Features to Include
Backend (Plugin):
- Employee content type with fields: name, email, avatar, department (relation), region, gender
- Department content type
- Efficient API endpoints with filtering:
/api/v1/employees?filters[department][$eq]=Engineering - Support for pagination:
limit,offsetquery params - Performance headers:
sonicjs-source: cache|origin
Frontend (Demo App):
- Employee grid view with avatar cards
- Sidebar filters: Department, Gender, Region (multi-select)
- Real-time performance stats display (response time in ms)
- Toggle between "Edge Cache" and "Origin" modes to compare speed
- Pagination controls
- API URL display for transparency
3. Current Demo Dependencies
The existing demo uses:
- React 18.3
- Tailwind CSS 3.4
- @headlessui/react 2.1 (for filter UI)
- @heroicons/react 2.1 (for icons)
- Vite 5.4 (bundler)
4. Tasks
- Create
packages/employee-directory-demo/package structure - Define Employee and Department schemas using SonicJS content types
- Port existing React components from edgecache-demo repo
- Convert JSX to TypeScript/TSX
- Create seed data generator script for populating demo database
- Add deployment configuration for Cloudflare Pages
- Update monorepo
workspacesin rootpackage.json - Add to www site navigation/demo section
- Document plugin usage and deployment steps
5. API Design
Employee Listing Endpoint:
GET /api/v1/employees
Query params:
- limit (default: 18)
- offset (default: 0)
- filters[department][$eq]=<department_name>
- filters[gender][$eq]=<male|female>
- filters[region][$eq]=<region_name>
Response:
{
"data": [...employees],
"total": 2000000,
"source": "cache" | "origin"
}
6. Benefits of Plugin Architecture
- Isolated codebase: All demo code lives in one package
- Reusable schema: Other apps can extend or reference the employee data model
- Independent deployment: Demo can be deployed separately to showcase performance
- Test fixture: Useful for performance testing and benchmarking
Additional Considerations
- Should support both D1 (SQLite) and Turso database adapters
- Consider pre-generated sample avatars or use a deterministic avatar service
- May want to add OpenAPI documentation for the demo endpoints
References
- Current live demo: https://edgecache-demo.pages.dev/
- SonicJS Docs: https://sonicjs.com/docs
- Cloudflare Workers: https://developers.cloudflare.com/workers/
/cc @lane711
- Ngôn ngữ chính
- TypeScript
- Star
- 1.8k
- Fork
- 219
- Merge trung bình
- 2 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 67
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SonicJs-Org/sonicjs
-
bug(admin/users): server error returns bare alert HTML causing black-shape visual artifactCó thể đã có người làm @lane711 đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
SonicJs-Org/sonicjs#1211 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: api bug priority: P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
SonicJs-Org/sonicjs#1200 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ResendProvider cannot send on Workers: unbound `fetch` stored as an instance property throws "Illegal invocation"Có thể đã có người làm @lane711 đã nhận 23 ngày trước. Đang mởarea: email bug priority: P1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SonicJs-Org/sonicjs#1099 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Email plugin settings are never read: loadDbEmailSettings queries a v2 `plugins` table that does not exist in v3Có thể đã có người làm @lane711 đã nhận 23 ngày trước. Đang mởarea: email bug priority: P1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
SonicJs-Org/sonicjs#1098 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: documentation bug documentation priority: P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SonicJs-Org/sonicjs#1012 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của SonicJs-Org/sonicjs
Issue tương tự
-
awaiting-final-review request-icon
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
homebridge/plugins#1376 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
mindfold-ai/Trellis#672 ·
-
p1 state:active track
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
StellarCanary/ProtocolCanary-Action#698 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
pear-devs/pear-desktop#4839 ·
Maintainer thường phản hồi trong vòng 1 ngày