@cloudgrid-io/mcp 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/corpus/capability-map.md +82 -2
- package/src/corpus/examples/crm/index.md +273 -0
- package/src/corpus/examples/kanban/index.md +256 -0
- package/src/corpus/templates/_cloudgrid.yaml.reference +228 -0
- package/src/corpus/templates/admin-dashboard/README.md +75 -0
- package/src/corpus/templates/admin-dashboard/cloudgrid.yaml +233 -0
- package/src/corpus/templates/admin-dashboard/index.md +81 -0
- package/src/corpus/templates/admin-dashboard/services/web/app/api/orders/route.js +64 -0
- package/src/corpus/templates/admin-dashboard/services/web/app/api/users/route.js +63 -0
- package/src/corpus/templates/admin-dashboard/services/web/app/layout.js +39 -0
- package/src/corpus/templates/admin-dashboard/services/web/app/page.js +73 -0
- package/src/corpus/templates/admin-dashboard/services/web/app/resource-table.js +94 -0
- package/src/corpus/templates/admin-dashboard/services/web/lib/db.js +32 -0
- package/src/corpus/templates/admin-dashboard/services/web/package.json +16 -0
- package/src/corpus/templates/ai-app/cloudgrid.yaml +225 -11
- package/src/corpus/templates/ai-app/index.md +3 -11
- package/src/corpus/templates/ai-knowledge-base/AGENTS.md +254 -0
- package/src/corpus/templates/ai-knowledge-base/README.md +28 -0
- package/src/corpus/templates/ai-knowledge-base/cloudgrid.yaml +238 -0
- package/src/corpus/templates/ai-knowledge-base/index.md +81 -0
- package/src/corpus/templates/analytics-dashboard/README.md +85 -0
- package/src/corpus/templates/analytics-dashboard/cloudgrid.yaml +232 -0
- package/src/corpus/templates/analytics-dashboard/index.md +316 -0
- package/src/corpus/templates/analytics-dashboard/services/web/app/api/events/route.js +60 -0
- package/src/corpus/templates/analytics-dashboard/services/web/app/event-form.js +100 -0
- package/src/corpus/templates/analytics-dashboard/services/web/app/layout.js +41 -0
- package/src/corpus/templates/analytics-dashboard/services/web/app/page.js +54 -0
- package/src/corpus/templates/analytics-dashboard/services/web/lib/db.js +32 -0
- package/src/corpus/templates/analytics-dashboard/services/web/package.json +16 -0
- package/src/corpus/templates/api-dashboard/README.md +84 -0
- package/src/corpus/templates/api-dashboard/cloudgrid.yaml +233 -0
- package/src/corpus/templates/api-dashboard/index.md +310 -0
- package/src/corpus/templates/api-dashboard/services/web/app/api/requests/route.js +62 -0
- package/src/corpus/templates/api-dashboard/services/web/app/dashboard.js +156 -0
- package/src/corpus/templates/api-dashboard/services/web/app/layout.js +42 -0
- package/src/corpus/templates/api-dashboard/services/web/app/page.js +39 -0
- package/src/corpus/templates/api-dashboard/services/web/lib/db.js +32 -0
- package/src/corpus/templates/api-dashboard/services/web/package.json +16 -0
- package/src/corpus/templates/api-docs/README.md +28 -0
- package/src/corpus/templates/api-docs/cloudgrid.yaml +228 -0
- package/src/corpus/templates/api-docs/index.html +136 -0
- package/src/corpus/templates/api-docs/index.md +28 -0
- package/src/corpus/templates/api-service/cloudgrid.yaml +224 -9
- package/src/corpus/templates/api-service/index.md +3 -11
- package/src/corpus/templates/app-with-data/cloudgrid.yaml +226 -8
- package/src/corpus/templates/app-with-data/index.md +3 -8
- package/src/corpus/templates/appointment-booking/AGENTS.md +223 -0
- package/src/corpus/templates/appointment-booking/README.md +16 -0
- package/src/corpus/templates/appointment-booking/cloudgrid.yaml +250 -0
- package/src/corpus/templates/appointment-booking/index.md +72 -0
- package/src/corpus/templates/approval-workflow/AGENTS.md +170 -0
- package/src/corpus/templates/approval-workflow/README.md +12 -0
- package/src/corpus/templates/approval-workflow/cloudgrid.yaml +237 -0
- package/src/corpus/templates/approval-workflow/index.md +58 -0
- package/src/corpus/templates/billing-dashboard/AGENTS.md +199 -0
- package/src/corpus/templates/billing-dashboard/README.md +18 -0
- package/src/corpus/templates/billing-dashboard/cloudgrid.yaml +235 -0
- package/src/corpus/templates/billing-dashboard/index.md +87 -0
- package/src/corpus/templates/blog-cms/README.md +94 -0
- package/src/corpus/templates/blog-cms/cloudgrid.yaml +233 -0
- package/src/corpus/templates/blog-cms/index.md +358 -0
- package/src/corpus/templates/blog-cms/services/web/app/admin/admin-editor.js +133 -0
- package/src/corpus/templates/blog-cms/services/web/app/admin/page.js +33 -0
- package/src/corpus/templates/blog-cms/services/web/app/api/posts/route.js +84 -0
- package/src/corpus/templates/blog-cms/services/web/app/layout.js +47 -0
- package/src/corpus/templates/blog-cms/services/web/app/page.js +56 -0
- package/src/corpus/templates/blog-cms/services/web/app/posts/[slug]/page.js +45 -0
- package/src/corpus/templates/blog-cms/services/web/lib/db.js +32 -0
- package/src/corpus/templates/blog-cms/services/web/package.json +16 -0
- package/src/corpus/templates/booking-system/AGENTS.md +189 -0
- package/src/corpus/templates/booking-system/README.md +17 -0
- package/src/corpus/templates/booking-system/cloudgrid.yaml +248 -0
- package/src/corpus/templates/booking-system/index.md +86 -0
- package/src/corpus/templates/calendar-scheduler/AGENTS.md +226 -0
- package/src/corpus/templates/calendar-scheduler/README.md +25 -0
- package/src/corpus/templates/calendar-scheduler/cloudgrid.yaml +259 -0
- package/src/corpus/templates/calendar-scheduler/index.md +85 -0
- package/src/corpus/templates/changelog/README.md +27 -0
- package/src/corpus/templates/changelog/cloudgrid.yaml +228 -0
- package/src/corpus/templates/changelog/index.html +80 -0
- package/src/corpus/templates/changelog/index.md +28 -0
- package/src/corpus/templates/company-website/README.md +54 -0
- package/src/corpus/templates/company-website/cloudgrid.yaml +233 -0
- package/src/corpus/templates/company-website/index.html +309 -0
- package/src/corpus/templates/company-website/index.md +29 -0
- package/src/corpus/templates/course-platform/AGENTS.md +161 -0
- package/src/corpus/templates/course-platform/README.md +26 -0
- package/src/corpus/templates/course-platform/cloudgrid.yaml +237 -0
- package/src/corpus/templates/course-platform/index.md +70 -0
- package/src/corpus/templates/crm/README.md +72 -0
- package/src/corpus/templates/crm/cloudgrid.yaml +233 -0
- package/src/corpus/templates/crm/index.md +71 -0
- package/src/corpus/templates/crm/services/web/app/api/contacts/route.js +80 -0
- package/src/corpus/templates/crm/services/web/app/contact-manager.js +102 -0
- package/src/corpus/templates/crm/services/web/app/layout.js +35 -0
- package/src/corpus/templates/crm/services/web/app/page.js +34 -0
- package/src/corpus/templates/crm/services/web/lib/db.js +32 -0
- package/src/corpus/templates/crm/services/web/package.json +16 -0
- package/src/corpus/templates/dashboard/cloudgrid.yaml +228 -4
- package/src/corpus/templates/dashboard/index.md +3 -5
- package/src/corpus/templates/deck/cloudgrid.yaml +228 -4
- package/src/corpus/templates/deck/index.md +3 -5
- package/src/corpus/templates/directory/README.md +75 -0
- package/src/corpus/templates/directory/cloudgrid.yaml +233 -0
- package/src/corpus/templates/directory/index.md +334 -0
- package/src/corpus/templates/directory/services/web/app/api/entries/route.js +63 -0
- package/src/corpus/templates/directory/services/web/app/directory-list.js +146 -0
- package/src/corpus/templates/directory/services/web/app/layout.js +44 -0
- package/src/corpus/templates/directory/services/web/app/page.js +38 -0
- package/src/corpus/templates/directory/services/web/lib/db.js +32 -0
- package/src/corpus/templates/directory/services/web/package.json +16 -0
- package/src/corpus/templates/docs-site/README.md +28 -0
- package/src/corpus/templates/docs-site/cloudgrid.yaml +228 -0
- package/src/corpus/templates/docs-site/index.html +122 -0
- package/src/corpus/templates/docs-site/index.md +28 -0
- package/src/corpus/templates/erp/AGENTS.md +116 -0
- package/src/corpus/templates/erp/README.md +17 -0
- package/src/corpus/templates/erp/cloudgrid.yaml +235 -0
- package/src/corpus/templates/erp/index.md +81 -0
- package/src/corpus/templates/event-board/README.md +74 -0
- package/src/corpus/templates/event-board/cloudgrid.yaml +233 -0
- package/src/corpus/templates/event-board/index.md +299 -0
- package/src/corpus/templates/event-board/services/web/app/api/events/route.js +61 -0
- package/src/corpus/templates/event-board/services/web/app/event-form.js +118 -0
- package/src/corpus/templates/event-board/services/web/app/layout.js +39 -0
- package/src/corpus/templates/event-board/services/web/app/page.js +34 -0
- package/src/corpus/templates/event-board/services/web/lib/db.js +32 -0
- package/src/corpus/templates/event-board/services/web/package.json +16 -0
- package/src/corpus/templates/expense-tracker/README.md +76 -0
- package/src/corpus/templates/expense-tracker/cloudgrid.yaml +233 -0
- package/src/corpus/templates/expense-tracker/index.md +305 -0
- package/src/corpus/templates/expense-tracker/services/web/app/api/expenses/route.js +61 -0
- package/src/corpus/templates/expense-tracker/services/web/app/expense-form.js +145 -0
- package/src/corpus/templates/expense-tracker/services/web/app/layout.js +42 -0
- package/src/corpus/templates/expense-tracker/services/web/app/page.js +34 -0
- package/src/corpus/templates/expense-tracker/services/web/lib/db.js +32 -0
- package/src/corpus/templates/expense-tracker/services/web/package.json +16 -0
- package/src/corpus/templates/feature-request-board/README.md +87 -0
- package/src/corpus/templates/feature-request-board/cloudgrid.yaml +233 -0
- package/src/corpus/templates/feature-request-board/index.md +317 -0
- package/src/corpus/templates/feature-request-board/services/web/app/api/requests/route.js +92 -0
- package/src/corpus/templates/feature-request-board/services/web/app/board.js +91 -0
- package/src/corpus/templates/feature-request-board/services/web/app/layout.js +43 -0
- package/src/corpus/templates/feature-request-board/services/web/app/page.js +35 -0
- package/src/corpus/templates/feature-request-board/services/web/lib/db.js +32 -0
- package/src/corpus/templates/feature-request-board/services/web/package.json +16 -0
- package/src/corpus/templates/financial-dashboard/README.md +80 -0
- package/src/corpus/templates/financial-dashboard/cloudgrid.yaml +233 -0
- package/src/corpus/templates/financial-dashboard/index.md +326 -0
- package/src/corpus/templates/financial-dashboard/services/web/app/api/entries/route.js +63 -0
- package/src/corpus/templates/financial-dashboard/services/web/app/entry-board.js +130 -0
- package/src/corpus/templates/financial-dashboard/services/web/app/layout.js +46 -0
- package/src/corpus/templates/financial-dashboard/services/web/app/page.js +31 -0
- package/src/corpus/templates/financial-dashboard/services/web/lib/db.js +32 -0
- package/src/corpus/templates/financial-dashboard/services/web/package.json +16 -0
- package/src/corpus/templates/forum/AGENTS.md +196 -0
- package/src/corpus/templates/forum/README.md +12 -0
- package/src/corpus/templates/forum/cloudgrid.yaml +237 -0
- package/src/corpus/templates/forum/index.md +66 -0
- package/src/corpus/templates/hr-portal/AGENTS.md +174 -0
- package/src/corpus/templates/hr-portal/README.md +14 -0
- package/src/corpus/templates/hr-portal/cloudgrid.yaml +237 -0
- package/src/corpus/templates/hr-portal/index.md +56 -0
- package/src/corpus/templates/internal-tools-portal/AGENTS.md +201 -0
- package/src/corpus/templates/internal-tools-portal/README.md +17 -0
- package/src/corpus/templates/internal-tools-portal/cloudgrid.yaml +237 -0
- package/src/corpus/templates/internal-tools-portal/index.md +62 -0
- package/src/corpus/templates/inventory/README.md +71 -0
- package/src/corpus/templates/inventory/cloudgrid.yaml +233 -0
- package/src/corpus/templates/inventory/index.md +68 -0
- package/src/corpus/templates/inventory/services/web/app/api/items/route.js +88 -0
- package/src/corpus/templates/inventory/services/web/app/inventory-manager.js +101 -0
- package/src/corpus/templates/inventory/services/web/app/layout.js +36 -0
- package/src/corpus/templates/inventory/services/web/app/page.js +37 -0
- package/src/corpus/templates/inventory/services/web/lib/db.js +32 -0
- package/src/corpus/templates/inventory/services/web/package.json +16 -0
- package/src/corpus/templates/invoice/README.md +71 -0
- package/src/corpus/templates/invoice/cloudgrid.yaml +233 -0
- package/src/corpus/templates/invoice/index.md +68 -0
- package/src/corpus/templates/invoice/services/web/app/api/invoices/route.js +82 -0
- package/src/corpus/templates/invoice/services/web/app/invoice-manager.js +101 -0
- package/src/corpus/templates/invoice/services/web/app/layout.js +35 -0
- package/src/corpus/templates/invoice/services/web/app/page.js +34 -0
- package/src/corpus/templates/invoice/services/web/lib/db.js +32 -0
- package/src/corpus/templates/invoice/services/web/package.json +16 -0
- package/src/corpus/templates/job-board/README.md +71 -0
- package/src/corpus/templates/job-board/cloudgrid.yaml +233 -0
- package/src/corpus/templates/job-board/index.md +68 -0
- package/src/corpus/templates/job-board/services/web/app/api/jobs/route.js +66 -0
- package/src/corpus/templates/job-board/services/web/app/job-board.js +73 -0
- package/src/corpus/templates/job-board/services/web/app/layout.js +35 -0
- package/src/corpus/templates/job-board/services/web/app/page.js +32 -0
- package/src/corpus/templates/job-board/services/web/lib/db.js +32 -0
- package/src/corpus/templates/job-board/services/web/package.json +16 -0
- package/src/corpus/templates/kanban/README.md +72 -0
- package/src/corpus/templates/kanban/cloudgrid.yaml +233 -0
- package/src/corpus/templates/kanban/index.md +71 -0
- package/src/corpus/templates/kanban/services/web/app/api/cards/route.js +70 -0
- package/src/corpus/templates/kanban/services/web/app/board.js +93 -0
- package/src/corpus/templates/kanban/services/web/app/layout.js +37 -0
- package/src/corpus/templates/kanban/services/web/app/page.js +32 -0
- package/src/corpus/templates/kanban/services/web/lib/db.js +32 -0
- package/src/corpus/templates/kanban/services/web/package.json +16 -0
- package/src/corpus/templates/landing-page/cloudgrid.yaml +228 -4
- package/src/corpus/templates/landing-page/index.md +3 -5
- package/src/corpus/templates/lms/AGENTS.md +193 -0
- package/src/corpus/templates/lms/README.md +27 -0
- package/src/corpus/templates/lms/cloudgrid.yaml +237 -0
- package/src/corpus/templates/lms/index.md +79 -0
- package/src/corpus/templates/marketplace/AGENTS.md +208 -0
- package/src/corpus/templates/marketplace/README.md +22 -0
- package/src/corpus/templates/marketplace/cloudgrid.yaml +233 -0
- package/src/corpus/templates/marketplace/index.md +76 -0
- package/src/corpus/templates/membership-site/AGENTS.md +160 -0
- package/src/corpus/templates/membership-site/README.md +18 -0
- package/src/corpus/templates/membership-site/cloudgrid.yaml +236 -0
- package/src/corpus/templates/membership-site/index.md +66 -0
- package/src/corpus/templates/monitoring-dashboard/README.md +84 -0
- package/src/corpus/templates/monitoring-dashboard/cloudgrid.yaml +233 -0
- package/src/corpus/templates/monitoring-dashboard/index.md +328 -0
- package/src/corpus/templates/monitoring-dashboard/services/web/app/api/checks/route.js +76 -0
- package/src/corpus/templates/monitoring-dashboard/services/web/app/check-form.js +124 -0
- package/src/corpus/templates/monitoring-dashboard/services/web/app/layout.js +44 -0
- package/src/corpus/templates/monitoring-dashboard/services/web/app/page.js +49 -0
- package/src/corpus/templates/monitoring-dashboard/services/web/lib/db.js +32 -0
- package/src/corpus/templates/monitoring-dashboard/services/web/package.json +16 -0
- package/src/corpus/templates/online-store/AGENTS.md +153 -0
- package/src/corpus/templates/online-store/README.md +16 -0
- package/src/corpus/templates/online-store/cloudgrid.yaml +234 -0
- package/src/corpus/templates/online-store/index.md +81 -0
- package/src/corpus/templates/portfolio/README.md +29 -0
- package/src/corpus/templates/portfolio/cloudgrid.yaml +228 -0
- package/src/corpus/templates/portfolio/index.html +126 -0
- package/src/corpus/templates/portfolio/index.md +28 -0
- package/src/corpus/templates/product-catalog/README.md +74 -0
- package/src/corpus/templates/product-catalog/cloudgrid.yaml +232 -0
- package/src/corpus/templates/product-catalog/index.md +330 -0
- package/src/corpus/templates/product-catalog/services/web/app/api/products/route.js +69 -0
- package/src/corpus/templates/product-catalog/services/web/app/catalog.js +153 -0
- package/src/corpus/templates/product-catalog/services/web/app/layout.js +49 -0
- package/src/corpus/templates/product-catalog/services/web/app/page.js +36 -0
- package/src/corpus/templates/product-catalog/services/web/lib/db.js +32 -0
- package/src/corpus/templates/product-catalog/services/web/package.json +16 -0
- package/src/corpus/templates/product-launch/README.md +46 -0
- package/src/corpus/templates/product-launch/cloudgrid.yaml +234 -0
- package/src/corpus/templates/product-launch/index.html +320 -0
- package/src/corpus/templates/product-launch/index.md +34 -0
- package/src/corpus/templates/project-management/README.md +83 -0
- package/src/corpus/templates/project-management/cloudgrid.yaml +233 -0
- package/src/corpus/templates/project-management/index.md +346 -0
- package/src/corpus/templates/project-management/services/web/app/api/projects/route.js +48 -0
- package/src/corpus/templates/project-management/services/web/app/api/tasks/route.js +85 -0
- package/src/corpus/templates/project-management/services/web/app/board.js +182 -0
- package/src/corpus/templates/project-management/services/web/app/layout.js +45 -0
- package/src/corpus/templates/project-management/services/web/app/page.js +49 -0
- package/src/corpus/templates/project-management/services/web/lib/db.js +32 -0
- package/src/corpus/templates/project-management/services/web/package.json +16 -0
- package/src/corpus/templates/property-listings/README.md +76 -0
- package/src/corpus/templates/property-listings/cloudgrid.yaml +233 -0
- package/src/corpus/templates/property-listings/index.md +335 -0
- package/src/corpus/templates/property-listings/services/web/app/api/properties/route.js +73 -0
- package/src/corpus/templates/property-listings/services/web/app/layout.js +45 -0
- package/src/corpus/templates/property-listings/services/web/app/listings.js +152 -0
- package/src/corpus/templates/property-listings/services/web/app/page.js +53 -0
- package/src/corpus/templates/property-listings/services/web/lib/db.js +32 -0
- package/src/corpus/templates/property-listings/services/web/package.json +16 -0
- package/src/corpus/templates/quiz-platform/README.md +84 -0
- package/src/corpus/templates/quiz-platform/cloudgrid.yaml +233 -0
- package/src/corpus/templates/quiz-platform/index.md +313 -0
- package/src/corpus/templates/quiz-platform/services/web/app/api/questions/route.js +69 -0
- package/src/corpus/templates/quiz-platform/services/web/app/layout.js +47 -0
- package/src/corpus/templates/quiz-platform/services/web/app/page.js +37 -0
- package/src/corpus/templates/quiz-platform/services/web/app/quiz.js +188 -0
- package/src/corpus/templates/quiz-platform/services/web/lib/db.js +32 -0
- package/src/corpus/templates/quiz-platform/services/web/package.json +16 -0
- package/src/corpus/templates/report/cloudgrid.yaml +228 -4
- package/src/corpus/templates/report/index.md +3 -5
- package/src/corpus/templates/restaurant-reservations/AGENTS.md +258 -0
- package/src/corpus/templates/restaurant-reservations/README.md +17 -0
- package/src/corpus/templates/restaurant-reservations/cloudgrid.yaml +258 -0
- package/src/corpus/templates/restaurant-reservations/index.md +62 -0
- package/src/corpus/templates/revenue-dashboard/README.md +75 -0
- package/src/corpus/templates/revenue-dashboard/cloudgrid.yaml +233 -0
- package/src/corpus/templates/revenue-dashboard/index.md +307 -0
- package/src/corpus/templates/revenue-dashboard/services/web/app/api/sales/route.js +60 -0
- package/src/corpus/templates/revenue-dashboard/services/web/app/layout.js +40 -0
- package/src/corpus/templates/revenue-dashboard/services/web/app/page.js +87 -0
- package/src/corpus/templates/revenue-dashboard/services/web/app/sale-form.js +63 -0
- package/src/corpus/templates/revenue-dashboard/services/web/lib/db.js +32 -0
- package/src/corpus/templates/revenue-dashboard/services/web/package.json +16 -0
- package/src/corpus/templates/saas-marketing/README.md +30 -0
- package/src/corpus/templates/saas-marketing/cloudgrid.yaml +228 -0
- package/src/corpus/templates/saas-marketing/index.html +212 -0
- package/src/corpus/templates/saas-marketing/index.md +28 -0
- package/src/corpus/templates/status-page/README.md +28 -0
- package/src/corpus/templates/status-page/cloudgrid.yaml +228 -0
- package/src/corpus/templates/status-page/index.html +117 -0
- package/src/corpus/templates/status-page/index.md +28 -0
- package/src/corpus/templates/subscription-management/AGENTS.md +191 -0
- package/src/corpus/templates/subscription-management/README.md +21 -0
- package/src/corpus/templates/subscription-management/cloudgrid.yaml +236 -0
- package/src/corpus/templates/subscription-management/index.md +73 -0
- package/src/corpus/templates/task-manager/README.md +72 -0
- package/src/corpus/templates/task-manager/cloudgrid.yaml +233 -0
- package/src/corpus/templates/task-manager/index.md +71 -0
- package/src/corpus/templates/task-manager/services/web/app/api/tasks/route.js +77 -0
- package/src/corpus/templates/task-manager/services/web/app/layout.js +39 -0
- package/src/corpus/templates/task-manager/services/web/app/page.js +33 -0
- package/src/corpus/templates/task-manager/services/web/app/task-list.js +110 -0
- package/src/corpus/templates/task-manager/services/web/lib/db.js +32 -0
- package/src/corpus/templates/task-manager/services/web/package.json +16 -0
- package/src/corpus/templates/ticket-system/README.md +71 -0
- package/src/corpus/templates/ticket-system/cloudgrid.yaml +233 -0
- package/src/corpus/templates/ticket-system/index.md +68 -0
- package/src/corpus/templates/ticket-system/services/web/app/api/tickets/route.js +81 -0
- package/src/corpus/templates/ticket-system/services/web/app/layout.js +36 -0
- package/src/corpus/templates/ticket-system/services/web/app/page.js +35 -0
- package/src/corpus/templates/ticket-system/services/web/app/ticket-queue.js +112 -0
- package/src/corpus/templates/ticket-system/services/web/lib/db.js +32 -0
- package/src/corpus/templates/ticket-system/services/web/package.json +16 -0
- package/src/corpus/templates/time-tracking/README.md +81 -0
- package/src/corpus/templates/time-tracking/cloudgrid.yaml +233 -0
- package/src/corpus/templates/time-tracking/index.md +298 -0
- package/src/corpus/templates/time-tracking/services/web/app/api/entries/route.js +66 -0
- package/src/corpus/templates/time-tracking/services/web/app/entry-form.js +106 -0
- package/src/corpus/templates/time-tracking/services/web/app/layout.js +39 -0
- package/src/corpus/templates/time-tracking/services/web/app/page.js +30 -0
- package/src/corpus/templates/time-tracking/services/web/lib/db.js +32 -0
- package/src/corpus/templates/time-tracking/services/web/package.json +16 -0
- package/src/corpus/templates/travel-booking/AGENTS.md +207 -0
- package/src/corpus/templates/travel-booking/README.md +17 -0
- package/src/corpus/templates/travel-booking/cloudgrid.yaml +249 -0
- package/src/corpus/templates/travel-booking/index.md +88 -0
- package/src/corpus/templates/waitlist/README.md +38 -0
- package/src/corpus/templates/waitlist/cloudgrid.yaml +228 -0
- package/src/corpus/templates/waitlist/index.html +69 -0
- package/src/corpus/templates/waitlist/index.md +39 -0
- package/src/corpus/templates/web-app/cloudgrid.yaml +228 -4
- package/src/corpus/templates/web-app/index.md +3 -5
- package/src/corpus/workflows/admin-dashboard.md +102 -0
- package/src/corpus/workflows/ai-knowledge-base.md +137 -0
- package/src/corpus/workflows/analytics-dashboard.md +104 -0
- package/src/corpus/workflows/api-dashboard.md +102 -0
- package/src/corpus/workflows/api-docs.md +36 -0
- package/src/corpus/workflows/appointment-booking.md +143 -0
- package/src/corpus/workflows/approval-workflow.md +124 -0
- package/src/corpus/workflows/billing-dashboard.md +120 -0
- package/src/corpus/workflows/blog-cms.md +104 -0
- package/src/corpus/workflows/booking-system.md +116 -0
- package/src/corpus/workflows/calendar-scheduler.md +134 -0
- package/src/corpus/workflows/changelog.md +33 -0
- package/src/corpus/workflows/company-website.md +46 -0
- package/src/corpus/workflows/course-platform.md +126 -0
- package/src/corpus/workflows/crm.md +101 -0
- package/src/corpus/workflows/directory.md +101 -0
- package/src/corpus/workflows/docs-site.md +35 -0
- package/src/corpus/workflows/erp.md +125 -0
- package/src/corpus/workflows/event-board.md +102 -0
- package/src/corpus/workflows/expense-tracker.md +102 -0
- package/src/corpus/workflows/feature-request-board.md +105 -0
- package/src/corpus/workflows/financial-dashboard.md +103 -0
- package/src/corpus/workflows/forum.md +128 -0
- package/src/corpus/workflows/hr-portal.md +115 -0
- package/src/corpus/workflows/internal-tools-portal.md +125 -0
- package/src/corpus/workflows/inventory.md +101 -0
- package/src/corpus/workflows/invoice.md +101 -0
- package/src/corpus/workflows/job-board.md +101 -0
- package/src/corpus/workflows/kanban.md +102 -0
- package/src/corpus/workflows/lms.md +113 -0
- package/src/corpus/workflows/marketplace.md +123 -0
- package/src/corpus/workflows/membership-site.md +128 -0
- package/src/corpus/workflows/monitoring-dashboard.md +104 -0
- package/src/corpus/workflows/online-store.md +114 -0
- package/src/corpus/workflows/portfolio.md +35 -0
- package/src/corpus/workflows/product-catalog.md +105 -0
- package/src/corpus/workflows/product-launch.md +43 -0
- package/src/corpus/workflows/project-management.md +106 -0
- package/src/corpus/workflows/property-listings.md +101 -0
- package/src/corpus/workflows/quiz-platform.md +105 -0
- package/src/corpus/workflows/restaurant-reservations.md +123 -0
- package/src/corpus/workflows/revenue-dashboard.md +102 -0
- package/src/corpus/workflows/saas-marketing.md +37 -0
- package/src/corpus/workflows/status-page.md +35 -0
- package/src/corpus/workflows/subscription-management.md +141 -0
- package/src/corpus/workflows/task-manager.md +101 -0
- package/src/corpus/workflows/ticket-system.md +101 -0
- package/src/corpus/workflows/time-tracking.md +104 -0
- package/src/corpus/workflows/travel-booking.md +115 -0
- package/src/corpus/workflows/waitlist.md +42 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
# Template: project-management (team project & task board, Next.js + Mongo)
|
|
2
|
+
|
|
3
|
+
A minimal but real, deployable project management app: **projects** plus a
|
|
4
|
+
per-project **task board** with three status columns (to do / doing / done) and an
|
|
5
|
+
optional assignee per task. Data lives in the grid-shared MongoDB, so it survives
|
|
6
|
+
refresh and is shared across sessions — unlike a static page.
|
|
7
|
+
|
|
8
|
+
Domain:
|
|
9
|
+
|
|
10
|
+
- **projects** — `{ name }`
|
|
11
|
+
- **tasks** — `{ projectId, title, status: todo | doing | done, assignee }`
|
|
12
|
+
|
|
13
|
+
**Key rules (all proven by a real end-to-end deploy):**
|
|
14
|
+
|
|
15
|
+
1. **Service code MUST live under `services/<name>/`, not the repo/template
|
|
16
|
+
root.** `path:` in `cloudgrid.yaml` is the URL mount, NOT the filesystem path.
|
|
17
|
+
The service named `web` → the CLI looks for `services/web/`. App files at the
|
|
18
|
+
root fail with `Error: Service directory not found: …/services/web`.
|
|
19
|
+
2. **Read the DB connection string LAZILY (inside the getter), never at module
|
|
20
|
+
top level.** The grid injects it as the `DATABASE_MONGODB_URL` environment
|
|
21
|
+
variable (plus the legacy `MONGODB_URL` alias) at dev-time and runtime; the
|
|
22
|
+
app reads `process.env.DATABASE_MONGODB_URL || process.env.MONGODB_URL` inside
|
|
23
|
+
`getDb`. A top-level read fails `next build` (the module is imported for route
|
|
24
|
+
analysis before the grid injects the var). Never hardcode a connection string;
|
|
25
|
+
never commit a secret.
|
|
26
|
+
3. **Declare the datastore with `needs: { database: true }`.** This is the
|
|
27
|
+
canonical shape — the deployer provisions Mongo and injects
|
|
28
|
+
`DATABASE_MONGODB_URL` (plus the legacy `MONGODB_URL` alias). `requires:` is
|
|
29
|
+
the deprecated v1 alias; don't author new yaml with it, and never set `needs:`
|
|
30
|
+
and `requires:` together (the validator rejects the combination).
|
|
31
|
+
|
|
32
|
+
Write these files into the scaffolded app folder — the app code goes under
|
|
33
|
+
`services/web/` — adapt the collections/fields to the user's app, then `grid dev`
|
|
34
|
+
(local) / `grid plug` (deploy, async — poll to a live URL).
|
|
35
|
+
|
|
36
|
+
## File tree
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
cloudgrid.yaml # name + services.web (nextjs) + needs: { database: true }
|
|
40
|
+
services/web/package.json # next, react, react-dom, mongodb driver only
|
|
41
|
+
services/web/lib/db.js # lazy Mongo client from DATABASE_MONGODB_URL (legacy MONGODB_URL fallback)
|
|
42
|
+
services/web/app/layout.js # root layout + inline CSS
|
|
43
|
+
services/web/app/page.js # server component: reads projects + tasks from Mongo
|
|
44
|
+
services/web/app/board.js # client component: project list + task board (POST/PATCH/DELETE)
|
|
45
|
+
services/web/app/api/projects/route.js # GET (list) / POST (add) / DELETE (remove + cascade tasks)
|
|
46
|
+
services/web/app/api/tasks/route.js # GET (list by project) / POST (add) / PATCH (move status) / DELETE
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## cloudgrid.yaml
|
|
50
|
+
|
|
51
|
+
```yaml
|
|
52
|
+
# On disk this file is the full-annotated reference (templates/_cloudgrid.yaml.reference) with EVERY
|
|
53
|
+
# field present as a comment; only the fields below are uncommented, so it
|
|
54
|
+
# deploys to exactly these active fields.
|
|
55
|
+
name: my-project-board
|
|
56
|
+
services:
|
|
57
|
+
web:
|
|
58
|
+
type: nextjs
|
|
59
|
+
path: /
|
|
60
|
+
needs:
|
|
61
|
+
database: true
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
> **Capability:** this template's need is `database: true`. The deployer
|
|
65
|
+
> provisions Mongo and injects `DATABASE_MONGODB_URL` (plus the legacy
|
|
66
|
+
> `MONGODB_URL` alias), so an app reading either var works. `requires:` is the
|
|
67
|
+
> deprecated v1 alias — don't mix it with `needs:` (the validator rejects the
|
|
68
|
+
> combination). See the capability-map for the full injection table.
|
|
69
|
+
|
|
70
|
+
## services/web/package.json
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"name": "my-app",
|
|
75
|
+
"version": "0.1.0",
|
|
76
|
+
"private": true,
|
|
77
|
+
"scripts": {
|
|
78
|
+
"dev": "next dev",
|
|
79
|
+
"build": "next build",
|
|
80
|
+
"start": "next start"
|
|
81
|
+
},
|
|
82
|
+
"dependencies": {
|
|
83
|
+
"next": "^15.1.0",
|
|
84
|
+
"react": "^19.0.0",
|
|
85
|
+
"react-dom": "^19.0.0",
|
|
86
|
+
"mongodb": "^6.12.0"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## services/web/lib/db.js
|
|
92
|
+
|
|
93
|
+
```js
|
|
94
|
+
// Cached MongoDB client. The grid injects DATABASE_MONGODB_URL (legacy MONGODB_URL
|
|
95
|
+
// alias) at dev-time and runtime. Read it LAZILY inside getDb — a top-level read
|
|
96
|
+
// fails `next build`. Never hardcode a connection string; never commit a secret.
|
|
97
|
+
import { MongoClient } from "mongodb";
|
|
98
|
+
|
|
99
|
+
function clientPromise() {
|
|
100
|
+
const uri = process.env.DATABASE_MONGODB_URL || process.env.MONGODB_URL;
|
|
101
|
+
if (!uri) {
|
|
102
|
+
throw new Error(
|
|
103
|
+
"DATABASE_MONGODB_URL is not set. The grid injects it automatically — run " +
|
|
104
|
+
"this app with `grid dev` locally, or deploy it with `grid plug`.",
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
if (!globalThis.__mongoClientPromise) {
|
|
108
|
+
globalThis.__mongoClientPromise = new MongoClient(uri).connect();
|
|
109
|
+
}
|
|
110
|
+
return globalThis.__mongoClientPromise;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export async function getDb() {
|
|
114
|
+
const client = await clientPromise();
|
|
115
|
+
return client.db();
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## services/web/app/layout.js
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
export const metadata = {
|
|
123
|
+
title: "Projects",
|
|
124
|
+
description: "A team project & task board on CloudGrid, backed by grid-shared Mongo.",
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const css = `
|
|
128
|
+
:root { color-scheme: light dark; }
|
|
129
|
+
body { margin: 0; font-family: system-ui, sans-serif; }
|
|
130
|
+
main { max-width: 60rem; margin: 3rem auto; padding: 0 1.25rem; }
|
|
131
|
+
.row { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
|
|
132
|
+
input, select { padding: .5rem .75rem; border: 1px solid #8886; border-radius: .5rem; }
|
|
133
|
+
button { padding: .5rem .9rem; border: 1px solid #8886; border-radius: .5rem; cursor: pointer; }
|
|
134
|
+
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
|
|
135
|
+
.col { border: 1px solid #8883; border-radius: .75rem; padding: .75rem; }
|
|
136
|
+
.card { border: 1px solid #8884; border-radius: .5rem; padding: .5rem .6rem; margin-bottom: .5rem; }
|
|
137
|
+
`;
|
|
138
|
+
|
|
139
|
+
export default function RootLayout({ children }) {
|
|
140
|
+
return (
|
|
141
|
+
<html lang="en">
|
|
142
|
+
<head><style dangerouslySetInnerHTML={{ __html: css }} /></head>
|
|
143
|
+
<body>{children}</body>
|
|
144
|
+
</html>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## services/web/app/page.js
|
|
150
|
+
|
|
151
|
+
```js
|
|
152
|
+
import { getDb } from "../lib/db.js";
|
|
153
|
+
import Board from "./board.js";
|
|
154
|
+
|
|
155
|
+
export const dynamic = "force-dynamic";
|
|
156
|
+
|
|
157
|
+
async function listProjects() {
|
|
158
|
+
const db = await getDb();
|
|
159
|
+
const items = await db.collection("projects").find({}).sort({ createdAt: -1 }).toArray();
|
|
160
|
+
return items.map((p) => ({ id: p._id.toString(), name: p.name }));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
async function listTasks(projectId) {
|
|
164
|
+
const db = await getDb();
|
|
165
|
+
const items = await db.collection("tasks").find({ projectId }).sort({ createdAt: -1 }).toArray();
|
|
166
|
+
return items.map((t) => ({
|
|
167
|
+
id: t._id.toString(), projectId: t.projectId, title: t.title,
|
|
168
|
+
status: t.status, assignee: t.assignee || "",
|
|
169
|
+
}));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export default async function Page({ searchParams }) {
|
|
173
|
+
const projects = await listProjects();
|
|
174
|
+
const sp = await searchParams;
|
|
175
|
+
const selectedId =
|
|
176
|
+
(sp && sp.project && projects.some((p) => p.id === sp.project) && sp.project) ||
|
|
177
|
+
(projects[0] && projects[0].id) || null;
|
|
178
|
+
const tasks = selectedId ? await listTasks(selectedId) : [];
|
|
179
|
+
return (
|
|
180
|
+
<main>
|
|
181
|
+
<h1>Projects</h1>
|
|
182
|
+
<Board initialProjects={projects} initialSelectedId={selectedId} initialTasks={tasks} />
|
|
183
|
+
</main>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## services/web/app/board.js
|
|
189
|
+
|
|
190
|
+
```js
|
|
191
|
+
"use client";
|
|
192
|
+
import { useState } from "react";
|
|
193
|
+
|
|
194
|
+
const STATUSES = ["todo", "doing", "done"];
|
|
195
|
+
const LABELS = { todo: "To do", doing: "Doing", done: "Done" };
|
|
196
|
+
|
|
197
|
+
export default function Board({ initialProjects, initialSelectedId, initialTasks }) {
|
|
198
|
+
const [projects, setProjects] = useState(initialProjects);
|
|
199
|
+
const [selectedId, setSelectedId] = useState(initialSelectedId);
|
|
200
|
+
const [tasks, setTasks] = useState(initialTasks);
|
|
201
|
+
const [projectName, setProjectName] = useState("");
|
|
202
|
+
const [taskTitle, setTaskTitle] = useState("");
|
|
203
|
+
const [taskAssignee, setTaskAssignee] = useState("");
|
|
204
|
+
|
|
205
|
+
async function loadTasks(projectId) {
|
|
206
|
+
const res = await fetch(`/api/tasks?projectId=${encodeURIComponent(projectId)}`);
|
|
207
|
+
setTasks(res.ok ? await res.json() : []);
|
|
208
|
+
}
|
|
209
|
+
async function selectProject(id) { setSelectedId(id); await loadTasks(id); }
|
|
210
|
+
|
|
211
|
+
async function addProject(e) {
|
|
212
|
+
e.preventDefault();
|
|
213
|
+
const name = projectName.trim();
|
|
214
|
+
if (!name) return;
|
|
215
|
+
const res = await fetch("/api/projects", {
|
|
216
|
+
method: "POST", headers: { "content-type": "application/json" },
|
|
217
|
+
body: JSON.stringify({ name }),
|
|
218
|
+
});
|
|
219
|
+
if (res.ok) {
|
|
220
|
+
const p = await res.json();
|
|
221
|
+
setProjects((prev) => [p, ...prev]); setProjectName(""); setSelectedId(p.id); setTasks([]);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
async function addTask(e) {
|
|
225
|
+
e.preventDefault();
|
|
226
|
+
const title = taskTitle.trim();
|
|
227
|
+
if (!title || !selectedId) return;
|
|
228
|
+
const res = await fetch("/api/tasks", {
|
|
229
|
+
method: "POST", headers: { "content-type": "application/json" },
|
|
230
|
+
body: JSON.stringify({ projectId: selectedId, title, assignee: taskAssignee.trim() }),
|
|
231
|
+
});
|
|
232
|
+
if (res.ok) { setTasks((prev) => [await res.json(), ...prev]); setTaskTitle(""); setTaskAssignee(""); }
|
|
233
|
+
}
|
|
234
|
+
async function moveTask(id, status) {
|
|
235
|
+
const res = await fetch(`/api/tasks?id=${encodeURIComponent(id)}`, {
|
|
236
|
+
method: "PATCH", headers: { "content-type": "application/json" },
|
|
237
|
+
body: JSON.stringify({ status }),
|
|
238
|
+
});
|
|
239
|
+
if (res.ok) setTasks((prev) => prev.map((t) => (t.id === id ? { ...t, status } : t)));
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// ...render project list + three status columns, each card offering
|
|
243
|
+
// move-to-other-status and delete. Full source in services/web/app/board.js.
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## services/web/app/api/projects/route.js
|
|
248
|
+
|
|
249
|
+
```js
|
|
250
|
+
import { NextResponse } from "next/server";
|
|
251
|
+
import { ObjectId } from "mongodb";
|
|
252
|
+
import { getDb } from "../../../lib/db.js";
|
|
253
|
+
|
|
254
|
+
export const dynamic = "force-dynamic";
|
|
255
|
+
|
|
256
|
+
async function projects() { const db = await getDb(); return db.collection("projects"); }
|
|
257
|
+
|
|
258
|
+
export async function GET() {
|
|
259
|
+
const col = await projects();
|
|
260
|
+
const items = await col.find({}).sort({ createdAt: -1 }).toArray();
|
|
261
|
+
return NextResponse.json(items.map((p) => ({ id: p._id.toString(), name: p.name })));
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export async function POST(request) {
|
|
265
|
+
const body = await request.json().catch(() => ({}));
|
|
266
|
+
const name = typeof body.name === "string" ? body.name.trim() : "";
|
|
267
|
+
if (!name) return NextResponse.json({ error: "name is required" }, { status: 400 });
|
|
268
|
+
const col = await projects();
|
|
269
|
+
const res = await col.insertOne({ name, createdAt: new Date() });
|
|
270
|
+
return NextResponse.json({ id: res.insertedId.toString(), name }, { status: 201 });
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export async function DELETE(request) {
|
|
274
|
+
const id = new URL(request.url).searchParams.get("id");
|
|
275
|
+
if (!id || !ObjectId.isValid(id)) return NextResponse.json({ error: "valid id is required" }, { status: 400 });
|
|
276
|
+
const db = await getDb();
|
|
277
|
+
await db.collection("projects").deleteOne({ _id: new ObjectId(id) });
|
|
278
|
+
await db.collection("tasks").deleteMany({ projectId: id }); // cascade
|
|
279
|
+
return NextResponse.json({ ok: true });
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## services/web/app/api/tasks/route.js
|
|
284
|
+
|
|
285
|
+
```js
|
|
286
|
+
import { NextResponse } from "next/server";
|
|
287
|
+
import { ObjectId } from "mongodb";
|
|
288
|
+
import { getDb } from "../../../lib/db.js";
|
|
289
|
+
|
|
290
|
+
export const dynamic = "force-dynamic";
|
|
291
|
+
const STATUSES = ["todo", "doing", "done"];
|
|
292
|
+
|
|
293
|
+
async function tasks() { const db = await getDb(); return db.collection("tasks"); }
|
|
294
|
+
const shape = (t) => ({
|
|
295
|
+
id: t._id.toString(), projectId: t.projectId, title: t.title,
|
|
296
|
+
status: t.status, assignee: t.assignee || "",
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
export async function GET(request) {
|
|
300
|
+
const projectId = new URL(request.url).searchParams.get("projectId");
|
|
301
|
+
if (!projectId) return NextResponse.json({ error: "projectId is required" }, { status: 400 });
|
|
302
|
+
const col = await tasks();
|
|
303
|
+
const items = await col.find({ projectId }).sort({ createdAt: -1 }).toArray();
|
|
304
|
+
return NextResponse.json(items.map(shape));
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export async function POST(request) {
|
|
308
|
+
const body = await request.json().catch(() => ({}));
|
|
309
|
+
const projectId = typeof body.projectId === "string" ? body.projectId : "";
|
|
310
|
+
const title = typeof body.title === "string" ? body.title.trim() : "";
|
|
311
|
+
const assignee = typeof body.assignee === "string" ? body.assignee.trim() : "";
|
|
312
|
+
const status = STATUSES.includes(body.status) ? body.status : "todo";
|
|
313
|
+
if (!projectId || !ObjectId.isValid(projectId)) return NextResponse.json({ error: "valid projectId is required" }, { status: 400 });
|
|
314
|
+
if (!title) return NextResponse.json({ error: "title is required" }, { status: 400 });
|
|
315
|
+
const col = await tasks();
|
|
316
|
+
const doc = { projectId, title, status, assignee, createdAt: new Date() };
|
|
317
|
+
const res = await col.insertOne(doc);
|
|
318
|
+
return NextResponse.json(shape({ ...doc, _id: res.insertedId }), { status: 201 });
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export async function PATCH(request) {
|
|
322
|
+
const id = new URL(request.url).searchParams.get("id");
|
|
323
|
+
if (!id || !ObjectId.isValid(id)) return NextResponse.json({ error: "valid id is required" }, { status: 400 });
|
|
324
|
+
const body = await request.json().catch(() => ({}));
|
|
325
|
+
if (!STATUSES.includes(body.status)) return NextResponse.json({ error: "bad status" }, { status: 400 });
|
|
326
|
+
const col = await tasks();
|
|
327
|
+
await col.updateOne({ _id: new ObjectId(id) }, { $set: { status: body.status } });
|
|
328
|
+
return NextResponse.json({ ok: true });
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export async function DELETE(request) {
|
|
332
|
+
const id = new URL(request.url).searchParams.get("id");
|
|
333
|
+
if (!id || !ObjectId.isValid(id)) return NextResponse.json({ error: "valid id is required" }, { status: 400 });
|
|
334
|
+
const col = await tasks();
|
|
335
|
+
await col.deleteOne({ _id: new ObjectId(id) });
|
|
336
|
+
return NextResponse.json({ ok: true });
|
|
337
|
+
}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
## Adapt it
|
|
341
|
+
|
|
342
|
+
- Rename the `projects` / `tasks` collections; change document fields (due dates,
|
|
343
|
+
priorities, labels).
|
|
344
|
+
- Add more statuses (edit `STATUSES` in `board.js` and the tasks route validation).
|
|
345
|
+
- Add `cache: true` to `needs:` only if you actually need Redis.
|
|
346
|
+
- Run `grid dev` to test locally, `grid plug` to deploy (async — poll to live).
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// App Router route handler for the `projects` collection.
|
|
2
|
+
// GET -> list projects, POST -> add a project, DELETE -> remove a project (and its tasks).
|
|
3
|
+
//
|
|
4
|
+
// To adapt this app, rename the collection and change the fields to match your
|
|
5
|
+
// own data.
|
|
6
|
+
import { NextResponse } from "next/server";
|
|
7
|
+
import { ObjectId } from "mongodb";
|
|
8
|
+
import { getDb } from "../../../lib/db.js";
|
|
9
|
+
|
|
10
|
+
// Never cache — always read/write live data.
|
|
11
|
+
export const dynamic = "force-dynamic";
|
|
12
|
+
|
|
13
|
+
async function projects() {
|
|
14
|
+
const db = await getDb();
|
|
15
|
+
return db.collection("projects");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// GET /api/projects — list all projects, newest first.
|
|
19
|
+
export async function GET() {
|
|
20
|
+
const col = await projects();
|
|
21
|
+
const items = await col.find({}).sort({ createdAt: -1 }).toArray();
|
|
22
|
+
return NextResponse.json(items.map((p) => ({ id: p._id.toString(), name: p.name })));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// POST /api/projects — add a project. Body: { name: string }.
|
|
26
|
+
export async function POST(request) {
|
|
27
|
+
const body = await request.json().catch(() => ({}));
|
|
28
|
+
const name = typeof body.name === "string" ? body.name.trim() : "";
|
|
29
|
+
if (!name) {
|
|
30
|
+
return NextResponse.json({ error: "name is required" }, { status: 400 });
|
|
31
|
+
}
|
|
32
|
+
const col = await projects();
|
|
33
|
+
const res = await col.insertOne({ name, createdAt: new Date() });
|
|
34
|
+
return NextResponse.json({ id: res.insertedId.toString(), name }, { status: 201 });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// DELETE /api/projects?id=<id> — remove a project and all of its tasks.
|
|
38
|
+
export async function DELETE(request) {
|
|
39
|
+
const id = new URL(request.url).searchParams.get("id");
|
|
40
|
+
if (!id || !ObjectId.isValid(id)) {
|
|
41
|
+
return NextResponse.json({ error: "valid id is required" }, { status: 400 });
|
|
42
|
+
}
|
|
43
|
+
const db = await getDb();
|
|
44
|
+
await db.collection("projects").deleteOne({ _id: new ObjectId(id) });
|
|
45
|
+
// Cascade: drop the project's tasks too (tasks store projectId as a string).
|
|
46
|
+
await db.collection("tasks").deleteMany({ projectId: id });
|
|
47
|
+
return NextResponse.json({ ok: true });
|
|
48
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// App Router route handler for the `tasks` collection.
|
|
2
|
+
// GET -> list tasks for a project, POST -> add a task,
|
|
3
|
+
// PATCH -> change a task's status, DELETE -> remove a task.
|
|
4
|
+
//
|
|
5
|
+
// A task document: { projectId: string, title: string, status: "todo"|"doing"|"done",
|
|
6
|
+
// assignee: string, createdAt: Date }.
|
|
7
|
+
import { NextResponse } from "next/server";
|
|
8
|
+
import { ObjectId } from "mongodb";
|
|
9
|
+
import { getDb } from "../../../lib/db.js";
|
|
10
|
+
|
|
11
|
+
// Never cache — always read/write live data.
|
|
12
|
+
export const dynamic = "force-dynamic";
|
|
13
|
+
|
|
14
|
+
const STATUSES = ["todo", "doing", "done"];
|
|
15
|
+
|
|
16
|
+
async function tasks() {
|
|
17
|
+
const db = await getDb();
|
|
18
|
+
return db.collection("tasks");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function shape(t) {
|
|
22
|
+
return {
|
|
23
|
+
id: t._id.toString(),
|
|
24
|
+
projectId: t.projectId,
|
|
25
|
+
title: t.title,
|
|
26
|
+
status: t.status,
|
|
27
|
+
assignee: t.assignee || "",
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// GET /api/tasks?projectId=<id> — list a project's tasks, newest first.
|
|
32
|
+
export async function GET(request) {
|
|
33
|
+
const projectId = new URL(request.url).searchParams.get("projectId");
|
|
34
|
+
if (!projectId) {
|
|
35
|
+
return NextResponse.json({ error: "projectId is required" }, { status: 400 });
|
|
36
|
+
}
|
|
37
|
+
const col = await tasks();
|
|
38
|
+
const items = await col.find({ projectId }).sort({ createdAt: -1 }).toArray();
|
|
39
|
+
return NextResponse.json(items.map(shape));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// POST /api/tasks — add a task. Body: { projectId, title, assignee?, status? }.
|
|
43
|
+
export async function POST(request) {
|
|
44
|
+
const body = await request.json().catch(() => ({}));
|
|
45
|
+
const projectId = typeof body.projectId === "string" ? body.projectId : "";
|
|
46
|
+
const title = typeof body.title === "string" ? body.title.trim() : "";
|
|
47
|
+
const assignee = typeof body.assignee === "string" ? body.assignee.trim() : "";
|
|
48
|
+
const status = STATUSES.includes(body.status) ? body.status : "todo";
|
|
49
|
+
if (!projectId || !ObjectId.isValid(projectId)) {
|
|
50
|
+
return NextResponse.json({ error: "valid projectId is required" }, { status: 400 });
|
|
51
|
+
}
|
|
52
|
+
if (!title) {
|
|
53
|
+
return NextResponse.json({ error: "title is required" }, { status: 400 });
|
|
54
|
+
}
|
|
55
|
+
const col = await tasks();
|
|
56
|
+
const doc = { projectId, title, status, assignee, createdAt: new Date() };
|
|
57
|
+
const res = await col.insertOne(doc);
|
|
58
|
+
return NextResponse.json(shape({ ...doc, _id: res.insertedId }), { status: 201 });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// PATCH /api/tasks?id=<id> — change a task's status. Body: { status }.
|
|
62
|
+
export async function PATCH(request) {
|
|
63
|
+
const id = new URL(request.url).searchParams.get("id");
|
|
64
|
+
if (!id || !ObjectId.isValid(id)) {
|
|
65
|
+
return NextResponse.json({ error: "valid id is required" }, { status: 400 });
|
|
66
|
+
}
|
|
67
|
+
const body = await request.json().catch(() => ({}));
|
|
68
|
+
if (!STATUSES.includes(body.status)) {
|
|
69
|
+
return NextResponse.json({ error: "status must be todo, doing, or done" }, { status: 400 });
|
|
70
|
+
}
|
|
71
|
+
const col = await tasks();
|
|
72
|
+
await col.updateOne({ _id: new ObjectId(id) }, { $set: { status: body.status } });
|
|
73
|
+
return NextResponse.json({ ok: true });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// DELETE /api/tasks?id=<id> — remove a task.
|
|
77
|
+
export async function DELETE(request) {
|
|
78
|
+
const id = new URL(request.url).searchParams.get("id");
|
|
79
|
+
if (!id || !ObjectId.isValid(id)) {
|
|
80
|
+
return NextResponse.json({ error: "valid id is required" }, { status: 400 });
|
|
81
|
+
}
|
|
82
|
+
const col = await tasks();
|
|
83
|
+
await col.deleteOne({ _id: new ObjectId(id) });
|
|
84
|
+
return NextResponse.json({ ok: true });
|
|
85
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// Client component: renders the project list plus a per-project task board with
|
|
4
|
+
// three status columns (todo / doing / done). Talks to /api/projects and
|
|
5
|
+
// /api/tasks. Kept self-contained — no external UI libraries.
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
|
|
8
|
+
const STATUSES = ["todo", "doing", "done"];
|
|
9
|
+
const LABELS = { todo: "To do", doing: "Doing", done: "Done" };
|
|
10
|
+
|
|
11
|
+
export default function Board({ initialProjects, initialSelectedId, initialTasks }) {
|
|
12
|
+
const [projects, setProjects] = useState(initialProjects);
|
|
13
|
+
const [selectedId, setSelectedId] = useState(initialSelectedId);
|
|
14
|
+
const [tasks, setTasks] = useState(initialTasks);
|
|
15
|
+
const [projectName, setProjectName] = useState("");
|
|
16
|
+
const [taskTitle, setTaskTitle] = useState("");
|
|
17
|
+
const [taskAssignee, setTaskAssignee] = useState("");
|
|
18
|
+
const [busy, setBusy] = useState(false);
|
|
19
|
+
|
|
20
|
+
async function loadTasks(projectId) {
|
|
21
|
+
const res = await fetch(`/api/tasks?projectId=${encodeURIComponent(projectId)}`);
|
|
22
|
+
if (res.ok) setTasks(await res.json());
|
|
23
|
+
else setTasks([]);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function selectProject(id) {
|
|
27
|
+
setSelectedId(id);
|
|
28
|
+
await loadTasks(id);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function addProject(e) {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
const name = projectName.trim();
|
|
34
|
+
if (!name) return;
|
|
35
|
+
setBusy(true);
|
|
36
|
+
const res = await fetch("/api/projects", {
|
|
37
|
+
method: "POST",
|
|
38
|
+
headers: { "content-type": "application/json" },
|
|
39
|
+
body: JSON.stringify({ name }),
|
|
40
|
+
});
|
|
41
|
+
if (res.ok) {
|
|
42
|
+
const project = await res.json();
|
|
43
|
+
setProjects((prev) => [project, ...prev]);
|
|
44
|
+
setProjectName("");
|
|
45
|
+
setSelectedId(project.id);
|
|
46
|
+
setTasks([]);
|
|
47
|
+
}
|
|
48
|
+
setBusy(false);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function removeProject(id) {
|
|
52
|
+
setBusy(true);
|
|
53
|
+
const res = await fetch(`/api/projects?id=${encodeURIComponent(id)}`, { method: "DELETE" });
|
|
54
|
+
if (res.ok) {
|
|
55
|
+
const next = projects.filter((p) => p.id !== id);
|
|
56
|
+
setProjects(next);
|
|
57
|
+
if (selectedId === id) {
|
|
58
|
+
const fallback = next[0] ? next[0].id : null;
|
|
59
|
+
setSelectedId(fallback);
|
|
60
|
+
if (fallback) await loadTasks(fallback);
|
|
61
|
+
else setTasks([]);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
setBusy(false);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function addTask(e) {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
const title = taskTitle.trim();
|
|
70
|
+
if (!title || !selectedId) return;
|
|
71
|
+
setBusy(true);
|
|
72
|
+
const res = await fetch("/api/tasks", {
|
|
73
|
+
method: "POST",
|
|
74
|
+
headers: { "content-type": "application/json" },
|
|
75
|
+
body: JSON.stringify({ projectId: selectedId, title, assignee: taskAssignee.trim() }),
|
|
76
|
+
});
|
|
77
|
+
if (res.ok) {
|
|
78
|
+
const task = await res.json();
|
|
79
|
+
setTasks((prev) => [task, ...prev]);
|
|
80
|
+
setTaskTitle("");
|
|
81
|
+
setTaskAssignee("");
|
|
82
|
+
}
|
|
83
|
+
setBusy(false);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async function moveTask(id, status) {
|
|
87
|
+
setBusy(true);
|
|
88
|
+
const res = await fetch(`/api/tasks?id=${encodeURIComponent(id)}`, {
|
|
89
|
+
method: "PATCH",
|
|
90
|
+
headers: { "content-type": "application/json" },
|
|
91
|
+
body: JSON.stringify({ status }),
|
|
92
|
+
});
|
|
93
|
+
if (res.ok) setTasks((prev) => prev.map((t) => (t.id === id ? { ...t, status } : t)));
|
|
94
|
+
setBusy(false);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async function removeTask(id) {
|
|
98
|
+
setBusy(true);
|
|
99
|
+
const res = await fetch(`/api/tasks?id=${encodeURIComponent(id)}`, { method: "DELETE" });
|
|
100
|
+
if (res.ok) setTasks((prev) => prev.filter((t) => t.id !== id));
|
|
101
|
+
setBusy(false);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<div>
|
|
106
|
+
<form onSubmit={addProject} className="row">
|
|
107
|
+
<input
|
|
108
|
+
value={projectName}
|
|
109
|
+
onChange={(e) => setProjectName(e.target.value)}
|
|
110
|
+
placeholder="New project name…"
|
|
111
|
+
aria-label="New project name"
|
|
112
|
+
/>
|
|
113
|
+
<button type="submit" disabled={busy}>Add project</button>
|
|
114
|
+
</form>
|
|
115
|
+
|
|
116
|
+
<ul className="projects">
|
|
117
|
+
{projects.length === 0 && <li className="empty">No projects yet.</li>}
|
|
118
|
+
{projects.map((p) => (
|
|
119
|
+
<li key={p.id} className={p.id === selectedId ? "active" : ""}>
|
|
120
|
+
<span className="name" onClick={() => selectProject(p.id)}>{p.name}</span>
|
|
121
|
+
<button type="button" onClick={() => removeProject(p.id)} disabled={busy}>Delete</button>
|
|
122
|
+
</li>
|
|
123
|
+
))}
|
|
124
|
+
</ul>
|
|
125
|
+
|
|
126
|
+
{selectedId && (
|
|
127
|
+
<>
|
|
128
|
+
<h2>Tasks</h2>
|
|
129
|
+
<form onSubmit={addTask} className="row">
|
|
130
|
+
<input
|
|
131
|
+
value={taskTitle}
|
|
132
|
+
onChange={(e) => setTaskTitle(e.target.value)}
|
|
133
|
+
placeholder="Task title…"
|
|
134
|
+
aria-label="Task title"
|
|
135
|
+
/>
|
|
136
|
+
<input
|
|
137
|
+
value={taskAssignee}
|
|
138
|
+
onChange={(e) => setTaskAssignee(e.target.value)}
|
|
139
|
+
placeholder="Assignee (optional)"
|
|
140
|
+
aria-label="Assignee"
|
|
141
|
+
/>
|
|
142
|
+
<button type="submit" disabled={busy}>Add task</button>
|
|
143
|
+
</form>
|
|
144
|
+
|
|
145
|
+
<div className="board">
|
|
146
|
+
{STATUSES.map((status) => (
|
|
147
|
+
<div className="col" key={status}>
|
|
148
|
+
<h3>{LABELS[status]}</h3>
|
|
149
|
+
{tasks.filter((t) => t.status === status).length === 0 && (
|
|
150
|
+
<p className="hint">Nothing here.</p>
|
|
151
|
+
)}
|
|
152
|
+
{tasks
|
|
153
|
+
.filter((t) => t.status === status)
|
|
154
|
+
.map((t) => (
|
|
155
|
+
<div className="card" key={t.id}>
|
|
156
|
+
<div className="title">{t.title}</div>
|
|
157
|
+
{t.assignee && <div className="assignee">{t.assignee}</div>}
|
|
158
|
+
<div className="actions">
|
|
159
|
+
{STATUSES.filter((s) => s !== status).map((s) => (
|
|
160
|
+
<button
|
|
161
|
+
key={s}
|
|
162
|
+
type="button"
|
|
163
|
+
onClick={() => moveTask(t.id, s)}
|
|
164
|
+
disabled={busy}
|
|
165
|
+
>
|
|
166
|
+
→ {LABELS[s]}
|
|
167
|
+
</button>
|
|
168
|
+
))}
|
|
169
|
+
<button type="button" onClick={() => removeTask(t.id)} disabled={busy}>
|
|
170
|
+
Delete
|
|
171
|
+
</button>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
))}
|
|
175
|
+
</div>
|
|
176
|
+
))}
|
|
177
|
+
</div>
|
|
178
|
+
</>
|
|
179
|
+
)}
|
|
180
|
+
</div>
|
|
181
|
+
);
|
|
182
|
+
}
|