@cloudgrid-io/mcp 0.13.0 → 0.15.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 +81 -7
- package/src/corpus/templates/_cloudgrid.yaml.reference +228 -0
- package/src/corpus/templates/admin-dashboard/cloudgrid.yaml +226 -8
- package/src/corpus/templates/admin-dashboard/index.md +3 -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/cloudgrid.yaml +222 -4
- package/src/corpus/templates/api-docs/index.md +3 -5
- 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/cloudgrid.yaml +222 -4
- package/src/corpus/templates/changelog/index.md +3 -5
- 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/cloudgrid.yaml +226 -8
- package/src/corpus/templates/crm/index.md +3 -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/cloudgrid.yaml +222 -4
- package/src/corpus/templates/docs-site/index.md +3 -5
- 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/cloudgrid.yaml +226 -8
- package/src/corpus/templates/kanban/index.md +3 -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/cloudgrid.yaml +222 -4
- package/src/corpus/templates/portfolio/index.md +3 -5
- 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/cloudgrid.yaml +222 -4
- package/src/corpus/templates/saas-marketing/index.md +3 -5
- package/src/corpus/templates/semantic-search/AGENTS.md +192 -0
- package/src/corpus/templates/semantic-search/README.md +74 -0
- package/src/corpus/templates/semantic-search/cloudgrid.yaml +217 -0
- package/src/corpus/templates/semantic-search/index.md +97 -0
- package/src/corpus/templates/semantic-search/services/backend/requirements.txt +7 -0
- package/src/corpus/templates/semantic-search/services/backend/src/app/__init__.py +0 -0
- package/src/corpus/templates/semantic-search/services/backend/src/app/answer.py +90 -0
- package/src/corpus/templates/semantic-search/services/backend/src/app/auth.py +65 -0
- package/src/corpus/templates/semantic-search/services/backend/src/app/config.py +110 -0
- package/src/corpus/templates/semantic-search/services/backend/src/app/db.py +89 -0
- package/src/corpus/templates/semantic-search/services/backend/src/app/embeddings.py +44 -0
- package/src/corpus/templates/semantic-search/services/backend/src/app/indexing.py +222 -0
- package/src/corpus/templates/semantic-search/services/backend/src/app/main.py +259 -0
- package/src/corpus/templates/semantic-search/services/backend/src/app/search.py +222 -0
- package/src/corpus/templates/semantic-search/services/backend/src/app/source.py +259 -0
- package/src/corpus/templates/semantic-search/services/backend/src/main.py +12 -0
- package/src/corpus/templates/semantic-search/services/web/index.html +12 -0
- package/src/corpus/templates/semantic-search/services/web/package-lock.json +1680 -0
- package/src/corpus/templates/semantic-search/services/web/package.json +19 -0
- package/src/corpus/templates/semantic-search/services/web/src/App.jsx +55 -0
- package/src/corpus/templates/semantic-search/services/web/src/api.js +125 -0
- package/src/corpus/templates/semantic-search/services/web/src/components/Dashboard.jsx +61 -0
- package/src/corpus/templates/semantic-search/services/web/src/components/ManagerLogin.jsx +39 -0
- package/src/corpus/templates/semantic-search/services/web/src/components/SearchView.jsx +166 -0
- package/src/corpus/templates/semantic-search/services/web/src/components/Settings.jsx +148 -0
- package/src/corpus/templates/semantic-search/services/web/src/main.jsx +10 -0
- package/src/corpus/templates/semantic-search/services/web/src/styles.css +78 -0
- package/src/corpus/templates/semantic-search/services/web/vite.config.js +10 -0
- package/src/corpus/templates/status-page/cloudgrid.yaml +222 -4
- package/src/corpus/templates/status-page/index.md +3 -5
- 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/cloudgrid.yaml +226 -8
- package/src/corpus/templates/task-manager/index.md +3 -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/cloudgrid.yaml +222 -4
- package/src/corpus/templates/waitlist/index.md +3 -5
- package/src/corpus/templates/web-app/cloudgrid.yaml +228 -4
- package/src/corpus/templates/web-app/index.md +3 -5
- 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/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/company-website.md +46 -0
- package/src/corpus/workflows/course-platform.md +126 -0
- package/src/corpus/workflows/directory.md +101 -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/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/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/semantic-search.md +133 -0
- package/src/corpus/workflows/subscription-management.md +141 -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/tools.js +73 -12
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// Small client component: renders the current-status grid + recent history and
|
|
4
|
+
// posts new checks to /api/checks. Recomputes the per-service grid on the client
|
|
5
|
+
// after each POST so the board updates without a full refresh.
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
|
|
8
|
+
const STATUSES = ["up", "degraded", "down"];
|
|
9
|
+
|
|
10
|
+
function computeServices(checks) {
|
|
11
|
+
const seen = new Map();
|
|
12
|
+
for (const c of checks) {
|
|
13
|
+
if (!seen.has(c.service)) seen.set(c.service, c);
|
|
14
|
+
}
|
|
15
|
+
return [...seen.values()].sort((a, b) => a.service.localeCompare(b.service));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function fmt(at) {
|
|
19
|
+
const d = new Date(at);
|
|
20
|
+
return isNaN(d) ? at : d.toLocaleString();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default function CheckForm({ initialChecks, initialServices }) {
|
|
24
|
+
const [checks, setChecks] = useState(initialChecks);
|
|
25
|
+
const [services, setServices] = useState(initialServices);
|
|
26
|
+
const [service, setService] = useState("");
|
|
27
|
+
const [status, setStatus] = useState("up");
|
|
28
|
+
const [latency, setLatency] = useState("");
|
|
29
|
+
const [busy, setBusy] = useState(false);
|
|
30
|
+
|
|
31
|
+
async function add(e) {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
const name = service.trim();
|
|
34
|
+
if (!name) return;
|
|
35
|
+
setBusy(true);
|
|
36
|
+
const res = await fetch("/api/checks", {
|
|
37
|
+
method: "POST",
|
|
38
|
+
headers: { "content-type": "application/json" },
|
|
39
|
+
body: JSON.stringify({
|
|
40
|
+
service: name,
|
|
41
|
+
status,
|
|
42
|
+
latencyMs: latency === "" ? undefined : Number(latency),
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
45
|
+
if (res.ok) {
|
|
46
|
+
const check = await res.json();
|
|
47
|
+
const next = [check, ...checks];
|
|
48
|
+
setChecks(next);
|
|
49
|
+
setServices(computeServices(next));
|
|
50
|
+
setService("");
|
|
51
|
+
setLatency("");
|
|
52
|
+
}
|
|
53
|
+
setBusy(false);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div>
|
|
58
|
+
<form onSubmit={add} className="row">
|
|
59
|
+
<input
|
|
60
|
+
className="service"
|
|
61
|
+
value={service}
|
|
62
|
+
onChange={(e) => setService(e.target.value)}
|
|
63
|
+
placeholder="Service name (e.g. api, web, db)…"
|
|
64
|
+
aria-label="Service name"
|
|
65
|
+
/>
|
|
66
|
+
<select value={status} onChange={(e) => setStatus(e.target.value)} aria-label="Status">
|
|
67
|
+
{STATUSES.map((s) => (
|
|
68
|
+
<option key={s} value={s}>{s}</option>
|
|
69
|
+
))}
|
|
70
|
+
</select>
|
|
71
|
+
<input
|
|
72
|
+
className="latency"
|
|
73
|
+
type="number"
|
|
74
|
+
min="0"
|
|
75
|
+
value={latency}
|
|
76
|
+
onChange={(e) => setLatency(e.target.value)}
|
|
77
|
+
placeholder="Latency ms"
|
|
78
|
+
aria-label="Latency in milliseconds"
|
|
79
|
+
/>
|
|
80
|
+
<button type="submit" disabled={busy}>Record check</button>
|
|
81
|
+
</form>
|
|
82
|
+
|
|
83
|
+
<h2>Current status</h2>
|
|
84
|
+
<div className="grid">
|
|
85
|
+
{services.length === 0 && <div className="empty">No services checked yet.</div>}
|
|
86
|
+
{services.map((s) => (
|
|
87
|
+
<div className="card" key={s.service}>
|
|
88
|
+
<div className="name">{s.service}</div>
|
|
89
|
+
<div><span className={`badge ${s.status}`}>{s.status}</span></div>
|
|
90
|
+
<div className="meta">
|
|
91
|
+
{typeof s.latencyMs === "number" ? `${s.latencyMs} ms · ` : ""}
|
|
92
|
+
{fmt(s.at)}
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
))}
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<h2>Recent history</h2>
|
|
99
|
+
<table>
|
|
100
|
+
<thead>
|
|
101
|
+
<tr>
|
|
102
|
+
<th>Service</th>
|
|
103
|
+
<th>Status</th>
|
|
104
|
+
<th>Latency</th>
|
|
105
|
+
<th>At</th>
|
|
106
|
+
</tr>
|
|
107
|
+
</thead>
|
|
108
|
+
<tbody>
|
|
109
|
+
{checks.length === 0 && (
|
|
110
|
+
<tr><td className="empty" colSpan={4}>No checks recorded yet.</td></tr>
|
|
111
|
+
)}
|
|
112
|
+
{checks.map((c) => (
|
|
113
|
+
<tr key={c.id}>
|
|
114
|
+
<td>{c.service}</td>
|
|
115
|
+
<td><span className={`badge ${c.status}`}>{c.status}</span></td>
|
|
116
|
+
<td>{typeof c.latencyMs === "number" ? `${c.latencyMs} ms` : "—"}</td>
|
|
117
|
+
<td>{fmt(c.at)}</td>
|
|
118
|
+
</tr>
|
|
119
|
+
))}
|
|
120
|
+
</tbody>
|
|
121
|
+
</table>
|
|
122
|
+
</div>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Root layout + plain inline CSS (no external CDNs, fonts, or stylesheets).
|
|
2
|
+
export const metadata = {
|
|
3
|
+
title: "Monitoring Dashboard",
|
|
4
|
+
description: "A service health board on CloudGrid, backed by grid-shared Mongo.",
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const css = `
|
|
8
|
+
:root { color-scheme: light dark; }
|
|
9
|
+
* { box-sizing: border-box; }
|
|
10
|
+
body { margin: 0; font-family: system-ui, -apple-system, sans-serif; line-height: 1.5; }
|
|
11
|
+
main { max-width: 52rem; margin: 3rem auto; padding: 0 1.25rem; }
|
|
12
|
+
h1 { margin: 0 0 .25rem; }
|
|
13
|
+
h2 { margin: 2rem 0 .75rem; font-size: 1.1rem; }
|
|
14
|
+
.hint { margin: 0 0 1.5rem; opacity: .7; font-size: .9rem; }
|
|
15
|
+
form.row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; align-items: center; }
|
|
16
|
+
input, select { padding: .5rem .75rem; border: 1px solid #8886; border-radius: .5rem; font: inherit; }
|
|
17
|
+
input.service { flex: 1; min-width: 10rem; }
|
|
18
|
+
input.latency { width: 8rem; }
|
|
19
|
+
button { padding: .5rem .9rem; border: 1px solid #8886; border-radius: .5rem; background: #6663; font: inherit; cursor: pointer; }
|
|
20
|
+
button:disabled { opacity: .5; cursor: default; }
|
|
21
|
+
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .75rem; }
|
|
22
|
+
.card { border: 1px solid #8884; border-radius: .6rem; padding: .8rem .9rem; }
|
|
23
|
+
.card .name { font-weight: 600; }
|
|
24
|
+
.card .meta { font-size: .85rem; opacity: .7; margin-top: .2rem; }
|
|
25
|
+
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 1rem; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
|
|
26
|
+
.badge.up { background: #1f8f4922; color: #1f8f49; }
|
|
27
|
+
.badge.degraded { background: #b9770022; color: #b97700; }
|
|
28
|
+
.badge.down { background: #c0392b22; color: #c0392b; }
|
|
29
|
+
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
|
|
30
|
+
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid #8883; }
|
|
31
|
+
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; opacity: .7; }
|
|
32
|
+
.empty { opacity: .6; }
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
export default function RootLayout({ children }) {
|
|
36
|
+
return (
|
|
37
|
+
<html lang="en">
|
|
38
|
+
<head>
|
|
39
|
+
<style dangerouslySetInnerHTML={{ __html: css }} />
|
|
40
|
+
</head>
|
|
41
|
+
<body>{children}</body>
|
|
42
|
+
</html>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Home page: a server component reads the checks straight from Mongo, derives a
|
|
2
|
+
// current-status grid (latest check per service) plus a recent history, and a
|
|
3
|
+
// small client form posts new checks via the API route. Data persists across
|
|
4
|
+
// refresh and across users because it lives in the grid-shared Mongo, not memory.
|
|
5
|
+
import { getDb } from "../lib/db.js";
|
|
6
|
+
import CheckForm from "./check-form.js";
|
|
7
|
+
|
|
8
|
+
export const dynamic = "force-dynamic";
|
|
9
|
+
|
|
10
|
+
async function listChecks() {
|
|
11
|
+
const db = await getDb();
|
|
12
|
+
const items = await db
|
|
13
|
+
.collection("checks")
|
|
14
|
+
.find({})
|
|
15
|
+
.sort({ at: -1 })
|
|
16
|
+
.limit(200)
|
|
17
|
+
.toArray();
|
|
18
|
+
return items.map((c) => ({
|
|
19
|
+
id: c._id.toString(),
|
|
20
|
+
service: c.service,
|
|
21
|
+
status: c.status,
|
|
22
|
+
latencyMs: c.latencyMs,
|
|
23
|
+
at: (c.at instanceof Date ? c.at : new Date(c.at)).toISOString(),
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Latest check per service = the current status grid.
|
|
28
|
+
function currentStatus(checks) {
|
|
29
|
+
const seen = new Map();
|
|
30
|
+
for (const c of checks) {
|
|
31
|
+
if (!seen.has(c.service)) seen.set(c.service, c);
|
|
32
|
+
}
|
|
33
|
+
return [...seen.values()].sort((a, b) => a.service.localeCompare(b.service));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default async function Page() {
|
|
37
|
+
const checks = await listChecks();
|
|
38
|
+
const services = currentStatus(checks);
|
|
39
|
+
return (
|
|
40
|
+
<main>
|
|
41
|
+
<h1>Monitoring Dashboard</h1>
|
|
42
|
+
<p className="hint">
|
|
43
|
+
Service health from the grid-shared Mongo — status grid + recent history,
|
|
44
|
+
survives refresh.
|
|
45
|
+
</p>
|
|
46
|
+
<CheckForm initialChecks={checks} initialServices={services} />
|
|
47
|
+
</main>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Cached MongoDB client for the App Router.
|
|
2
|
+
//
|
|
3
|
+
// The grid injects the connection string as the DATABASE_MONGODB_URL environment
|
|
4
|
+
// variable (plus the legacy MONGODB_URL alias) at dev-time (`grid dev`) and
|
|
5
|
+
// runtime (after `grid plug`). Read the canonical var first, fall back to the
|
|
6
|
+
// legacy alias. Never hardcode a connection string here and never commit a secret.
|
|
7
|
+
//
|
|
8
|
+
// The env var and client are resolved LAZILY (inside getDb), never at module top
|
|
9
|
+
// level — otherwise `next build` throws when it imports this module for route
|
|
10
|
+
// analysis, before the grid injects the var.
|
|
11
|
+
import { MongoClient } from "mongodb";
|
|
12
|
+
|
|
13
|
+
function clientPromise() {
|
|
14
|
+
const uri = process.env.DATABASE_MONGODB_URL || process.env.MONGODB_URL;
|
|
15
|
+
if (!uri) {
|
|
16
|
+
throw new Error(
|
|
17
|
+
"DATABASE_MONGODB_URL is not set. The grid injects it automatically — run " +
|
|
18
|
+
"this app with `grid dev` locally, or deploy it with `grid plug` (the grid " +
|
|
19
|
+
"injects the DB connection string at runtime). Do not set it by hand.",
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
if (!globalThis.__mongoClientPromise) {
|
|
23
|
+
globalThis.__mongoClientPromise = new MongoClient(uri).connect();
|
|
24
|
+
}
|
|
25
|
+
return globalThis.__mongoClientPromise;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export async function getDb() {
|
|
29
|
+
const client = await clientPromise();
|
|
30
|
+
// The default DB comes from the connection-string path segment the grid injects.
|
|
31
|
+
return client.db();
|
|
32
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "monitoring-dashboard",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "next dev",
|
|
7
|
+
"build": "next build",
|
|
8
|
+
"start": "next start"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"next": "^15.1.0",
|
|
12
|
+
"react": "^19.0.0",
|
|
13
|
+
"react-dom": "^19.0.0",
|
|
14
|
+
"mongodb": "^6.12.0"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# AGENTS.md — online-store (blueprint)
|
|
2
|
+
|
|
3
|
+
This is a **blueprint**, not runnable app code. It tells an agent exactly how to
|
|
4
|
+
build a working e-commerce store on CloudGrid: a Next.js storefront with a cart,
|
|
5
|
+
Stripe checkout, a Stripe webhook that confirms payment, and orders persisted in
|
|
6
|
+
the grid-shared Mongo. Read this whole file, then write the files under
|
|
7
|
+
`services/web/` following the tree and wiring rules below.
|
|
8
|
+
|
|
9
|
+
The proven shape to imitate is `app-with-data` (Next.js App Router + `mongodb`
|
|
10
|
+
driver, lazy DB getter, app under `services/web/`). This blueprint adds a second
|
|
11
|
+
collection (`orders`), Stripe checkout, and a webhook.
|
|
12
|
+
|
|
13
|
+
## 1. File tree
|
|
14
|
+
|
|
15
|
+
App code MUST live under `services/web/` — `path: /` in `cloudgrid.yaml` is the
|
|
16
|
+
URL mount, NOT the filesystem path. A service named `web` means the CLI looks for
|
|
17
|
+
`services/web/`; files at the project root fail with
|
|
18
|
+
`Error: Service directory not found: …/services/web`.
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
cloudgrid.yaml # name + services.web (nextjs) + needs:{database:true} + vault:{STRIPE_KEY}
|
|
22
|
+
services/web/package.json # next, react, react-dom, mongodb, stripe
|
|
23
|
+
services/web/lib/db.js # lazy Mongo client from DATABASE_MONGODB_URL (legacy MONGODB_URL fallback)
|
|
24
|
+
services/web/lib/stripe.js # lazy Stripe client from process.env.STRIPE_KEY (injected by the vault: block)
|
|
25
|
+
services/web/lib/products.js # product catalog source (seed array, or read the products collection)
|
|
26
|
+
services/web/app/layout.js # root layout + inline CSS
|
|
27
|
+
services/web/app/page.js # storefront: server component, lists products from Mongo
|
|
28
|
+
services/web/app/cart.js # "use client" cart UI (localStorage), "Checkout" button
|
|
29
|
+
services/web/app/success/page.js # post-checkout confirmation (reads ?session_id, shows the order)
|
|
30
|
+
services/web/app/api/checkout/route.js # POST: create a Stripe Checkout Session from the cart, return its URL
|
|
31
|
+
services/web/app/api/webhook/route.js # POST: Stripe webhook — verify signature, persist the paid order
|
|
32
|
+
services/web/app/api/products/route.js # GET (list) / POST (add) — optional admin CRUD for the catalog
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 2. Mongo collections + fields
|
|
36
|
+
|
|
37
|
+
The grid provisions one Mongo database (`needs: { database: true }`). Use two
|
|
38
|
+
collections:
|
|
39
|
+
|
|
40
|
+
**`products`**
|
|
41
|
+
- `_id` — ObjectId
|
|
42
|
+
- `name` — string
|
|
43
|
+
- `description` — string
|
|
44
|
+
- `priceCents` — integer (store money in the smallest unit — cents — never floats)
|
|
45
|
+
- `currency` — string, e.g. `"usd"`
|
|
46
|
+
- `image` — string URL (optional)
|
|
47
|
+
- `active` — boolean (hide without deleting)
|
|
48
|
+
|
|
49
|
+
**`orders`**
|
|
50
|
+
- `_id` — ObjectId
|
|
51
|
+
- `stripeSessionId` — string (Checkout Session id; unique — use it for idempotency)
|
|
52
|
+
- `items` — array of `{ productId, name, priceCents, quantity }`
|
|
53
|
+
- `amountTotalCents` — integer (authoritative total from the Stripe event, not the client)
|
|
54
|
+
- `currency` — string
|
|
55
|
+
- `email` — string (customer email from Stripe)
|
|
56
|
+
- `status` — string: `"pending"` → `"paid"` (set to paid ONLY by the webhook)
|
|
57
|
+
- `createdAt` — Date
|
|
58
|
+
|
|
59
|
+
Never trust prices sent by the browser. The checkout route builds line items from
|
|
60
|
+
the server-side `products` catalog; the webhook records the total from the
|
|
61
|
+
verified Stripe event.
|
|
62
|
+
|
|
63
|
+
## 3. How CloudGrid injects things (do NOT hardcode any of this)
|
|
64
|
+
|
|
65
|
+
- **Mongo:** declare `needs: { database: true }`. The platform provisions Mongo
|
|
66
|
+
and injects the connection string as **`DATABASE_MONGODB_URL`** (plus the legacy
|
|
67
|
+
**`MONGODB_URL`** alias) at dev-time (`grid dev`) and at runtime (after
|
|
68
|
+
`grid plug`). Read it as `process.env.DATABASE_MONGODB_URL || process.env.MONGODB_URL`
|
|
69
|
+
**lazily inside a getter**, never at module top level — a top-level read fails
|
|
70
|
+
`next build`, which imports the module for route analysis before the grid injects
|
|
71
|
+
the var. Never hardcode a connection string; never commit a secret.
|
|
72
|
+
- **Stripe secret:** put it in the vault, not in code. The `vault:` block in
|
|
73
|
+
`cloudgrid.yaml` maps the vault item `stripe-live-key` to the env var
|
|
74
|
+
**`STRIPE_KEY`**. Set the vault item once with `grid secrets set stripe-live-key`
|
|
75
|
+
(paste the `sk_live_…` / `sk_test_…` key); the platform injects it as
|
|
76
|
+
`process.env.STRIPE_KEY`. Read it lazily in `services/web/lib/stripe.js`.
|
|
77
|
+
- **Stripe webhook signing secret:** the `whsec_…` value Stripe gives you for the
|
|
78
|
+
webhook endpoint. Add it to the vault too and map it in the `vault:` block, e.g.
|
|
79
|
+
`STRIPE_WEBHOOK_SECRET: stripe-webhook-secret`, then verify events with
|
|
80
|
+
`stripe.webhooks.constructEvent(rawBody, sig, process.env.STRIPE_WEBHOOK_SECRET)`.
|
|
81
|
+
- **Public base URL:** Stripe Checkout needs absolute `success_url` /`cancel_url`.
|
|
82
|
+
Derive them from the incoming request (`new URL(request.url).origin`) rather than
|
|
83
|
+
hardcoding the live host, so it works in `grid dev` and after `grid plug`.
|
|
84
|
+
- **AI (only if you add it):** declare `needs: { ai: true }` and the platform
|
|
85
|
+
injects `AI_GATEWAY_URL`; call it via `@cloudgrid-io/ai`. Not required for a store.
|
|
86
|
+
|
|
87
|
+
## 4. Wiring payments (Stripe) — and optional auth
|
|
88
|
+
|
|
89
|
+
**Checkout route (`app/api/checkout/route.js`):**
|
|
90
|
+
1. Read the cart (array of `{ productId, quantity }`) from the POST body.
|
|
91
|
+
2. Load each product from the server-side `products` collection — never trust the
|
|
92
|
+
client's prices.
|
|
93
|
+
3. Build Stripe `line_items` with `price_data` from the DB (`unit_amount:
|
|
94
|
+
priceCents`, `currency`).
|
|
95
|
+
4. `stripe.checkout.sessions.create({ mode: "payment", line_items,
|
|
96
|
+
success_url: origin + "/success?session_id={CHECKOUT_SESSION_ID}",
|
|
97
|
+
cancel_url: origin + "/" })`.
|
|
98
|
+
5. Return `{ url: session.url }`; the client redirects to it.
|
|
99
|
+
|
|
100
|
+
**Webhook route (`app/api/webhook/route.js`):**
|
|
101
|
+
1. Read the **raw** body (in the App Router: `await request.text()` — do NOT
|
|
102
|
+
`request.json()`; signature verification needs the exact bytes).
|
|
103
|
+
2. Verify with `stripe.webhooks.constructEvent(rawBody,
|
|
104
|
+
request.headers.get("stripe-signature"), process.env.STRIPE_WEBHOOK_SECRET)`.
|
|
105
|
+
3. On `checkout.session.completed`, upsert the `orders` doc by `stripeSessionId`
|
|
106
|
+
(idempotent — Stripe may retry), set `status: "paid"`, `amountTotalCents =
|
|
107
|
+
event.data.object.amount_total`, and the customer email.
|
|
108
|
+
4. Return `200` fast; return `400` if verification fails.
|
|
109
|
+
Register the endpoint URL (`<live-url>/api/webhook`) in the Stripe dashboard and
|
|
110
|
+
copy its `whsec_…` secret into the vault.
|
|
111
|
+
|
|
112
|
+
**Optional auth (accounts / order history):** add a provider SDK (Clerk, Auth0,
|
|
113
|
+
or NextAuth). Put its keys in the vault and map them in the `vault:` block, e.g.
|
|
114
|
+
`AUTH_PROVIDER_KEY: clerk-secret-key` (and any publishable key), read them from
|
|
115
|
+
`process.env`, and gate the account/order-history pages behind the provider's
|
|
116
|
+
middleware. Not required for a basic store; add it only if the user wants logins.
|
|
117
|
+
|
|
118
|
+
## 5. Deploy steps
|
|
119
|
+
|
|
120
|
+
1. `grid init` an app `<name>` (creates the entity + `.cloudgrid/link.json`,
|
|
121
|
+
writes a `cloudgrid.yaml` with empty `services: {}`). Run this FIRST — `plug`
|
|
122
|
+
needs a linked directory.
|
|
123
|
+
2. Write the app under `services/web/` and set `cloudgrid.yaml` to the shape in
|
|
124
|
+
this template (name + `services.web` nextjs + `needs: { database: true }` +
|
|
125
|
+
the `vault: { STRIPE_KEY: stripe-live-key }` block).
|
|
126
|
+
3. `grid secrets set stripe-live-key` (and the webhook secret) so the vault items
|
|
127
|
+
the `vault:` block references exist. Do NOT set `DATABASE_MONGODB_URL` yourself.
|
|
128
|
+
4. (Optional) `grid dev` to run locally against the injected Mongo + your Stripe
|
|
129
|
+
test key before deploying.
|
|
130
|
+
5. `grid plug` to build + deploy. A runtime deploy is **async**: `plug` returns
|
|
131
|
+
`status: building`. Poll `grid status` until the entity is live; surface a
|
|
132
|
+
liveness signal, never a bare silent wait. Only then return the live app URL.
|
|
133
|
+
6. Register `<live-url>/api/webhook` in the Stripe dashboard, copy its `whsec_…`
|
|
134
|
+
into the vault, and re-`grid plug` the SAME entity (same URL) if you changed the
|
|
135
|
+
`vault:` mapping.
|
|
136
|
+
|
|
137
|
+
## 6. Edition note
|
|
138
|
+
|
|
139
|
+
This is a **runtime app** (a built + deployed container), so it needs the **local
|
|
140
|
+
edition** (Claude Desktop / Claude Code) or the CloudGrid CLI. The hosted edition
|
|
141
|
+
(Claude Web / hosted MCP) is inline-only and can publish only static pages — it
|
|
142
|
+
cannot build this store. If you are on hosted, offer a static storefront preview
|
|
143
|
+
instead and stop the runtime path.
|
|
144
|
+
|
|
145
|
+
## 7. Self-check before you call it done
|
|
146
|
+
|
|
147
|
+
- App code is under `services/web/`, not the root.
|
|
148
|
+
- DB and Stripe clients are read LAZILY inside getters, never at module top level.
|
|
149
|
+
- Prices come from the server-side catalog; the webhook records the Stripe total.
|
|
150
|
+
- The webhook reads the raw body and verifies the signature.
|
|
151
|
+
- `cloudgrid.yaml` active fields are exactly: `name`, `services.web {type:nextjs,
|
|
152
|
+
path:/}`, `needs: { database: true }`, and the `vault:` block for `STRIPE_KEY`.
|
|
153
|
+
- No secret or connection string is committed anywhere.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# online-store template — e-commerce blueprint (Next.js + Mongo + Stripe)
|
|
2
|
+
|
|
3
|
+
A **blueprint** for a real online store on CloudGrid: a Next.js storefront with a
|
|
4
|
+
cart, Stripe Checkout, a signature-verified Stripe webhook that confirms payment,
|
|
5
|
+
and `products` + `orders` persisted in the grid-shared Mongo — the same proven
|
|
6
|
+
`services/web/` + lazy-Mongo shape as `app-with-data`, plus payments. It exists
|
|
7
|
+
because "sell products online" is a common ask that needs a database *and* a
|
|
8
|
+
payment provider wired the CloudGrid-correct way (Mongo via `needs`, the Stripe
|
|
9
|
+
key via the `vault:` block → `STRIPE_KEY`), and getting that wiring right is the
|
|
10
|
+
hard part.
|
|
11
|
+
|
|
12
|
+
**This is a blueprint: structure + `cloudgrid.yaml`, not finished app code.** Read
|
|
13
|
+
`AGENTS.md` for the file tree, the Mongo collections/fields, how the grid injects
|
|
14
|
+
Mongo (`DATABASE_MONGODB_URL`) and the Stripe secret (`vault:` → `STRIPE_KEY`), the
|
|
15
|
+
checkout + webhook wiring, and the deploy steps — then build the app under
|
|
16
|
+
`services/web/`, adapting the catalog and UI to the user's store.
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# ============================================================================
|
|
2
|
+
# cloudgrid.yaml — Complete Example
|
|
3
|
+
# ============================================================================
|
|
4
|
+
#
|
|
5
|
+
# This file shows EVERY field the platform supports, with comments explaining
|
|
6
|
+
# each one. It is a reference — no real project would use all of these at once.
|
|
7
|
+
#
|
|
8
|
+
# STANDARD: every CloudGrid template ships its cloudgrid.yaml in THIS full form.
|
|
9
|
+
# Uncomment ONLY the fields the archetype needs (always: name + services; plus
|
|
10
|
+
# needs: for runtime apps). Leave everything else commented. Comments are
|
|
11
|
+
# ignored by the parser, so the file deploys to exactly the active fields.
|
|
12
|
+
#
|
|
13
|
+
# Only two fields are required: name and services. Everything else is optional.
|
|
14
|
+
# Full docs: docs/cloudgrid-yaml-reference.md
|
|
15
|
+
# ============================================================================
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# ─── IDENTITY ───────────────────────────────────────────────────────────────
|
|
19
|
+
|
|
20
|
+
# Entity slug (REQUIRED). 2-42 chars, lowercase alphanumeric + hyphens.
|
|
21
|
+
# Must start and end with a letter or digit.
|
|
22
|
+
# Becomes part of your public URL: <name>-<4hex>.<org>.cloudgrid.io
|
|
23
|
+
name: online-store
|
|
24
|
+
|
|
25
|
+
# One-line summary. Max 280 chars. If omitted, Grid Brain auto-generates one.
|
|
26
|
+
# description: Order processing API for the e-commerce platform
|
|
27
|
+
|
|
28
|
+
# Single emoji or short text shown as the entity icon. Max 64 chars.
|
|
29
|
+
# icon: "📦"
|
|
30
|
+
|
|
31
|
+
# Entity type: 'app' (default) or 'agent'. An agent is an app with an agent: block.
|
|
32
|
+
# kind: app
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# ─── NETWORKING ─────────────────────────────────────────────────────────────
|
|
36
|
+
|
|
37
|
+
# Whether this entity serves public HTTP traffic.
|
|
38
|
+
# true = public URL + Ingress (default). false = internal only.
|
|
39
|
+
# expose: true
|
|
40
|
+
|
|
41
|
+
# Additional domain names this entity serves on (the platform URL is always active).
|
|
42
|
+
# custom_domains:
|
|
43
|
+
# - orders.example.com
|
|
44
|
+
# - shop.example.com
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# ─── HEALTH PROBE (entity-level override) ──────────────────────────────────
|
|
48
|
+
|
|
49
|
+
# Override the default health check for the entire entity.
|
|
50
|
+
# probe:
|
|
51
|
+
# path: /healthz # HTTP path to probe (default: /).
|
|
52
|
+
# expected: "<500" # '<500' (default), '200', '2xx'.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
# ─── DEPLOY NOTIFICATIONS ──────────────────────────────────────────────────
|
|
56
|
+
|
|
57
|
+
# Slack notification to the org's default channel on deploy failure.
|
|
58
|
+
# true = notify (default), false = silent.
|
|
59
|
+
# notify: true
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# ─── SCALING ────────────────────────────────────────────────────────────────
|
|
63
|
+
|
|
64
|
+
# Replica scaling intent.
|
|
65
|
+
# 'auto' — platform decides from the grid tier (default).
|
|
66
|
+
# 'alert' — single-replica, emit a SPOF warning at plug time.
|
|
67
|
+
# 1-10 — explicit replica count, clamped to the grid max.
|
|
68
|
+
# scale: auto
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
# ─── INFRASTRUCTURE NEEDS ──────────────────────────────────────────────────
|
|
72
|
+
#
|
|
73
|
+
# Declare infrastructure; the platform provisions it and injects connection
|
|
74
|
+
# details as env vars. Nine needs: database, cache, kv, queue, pubsub, vector,
|
|
75
|
+
# object_storage, disk, ai. Simplest form is `true`.
|
|
76
|
+
#
|
|
77
|
+
# needs:
|
|
78
|
+
# # database — MongoDB. Injects DATABASE_MONGODB_URL (+ legacy MONGODB_URL).
|
|
79
|
+
# # true | pool | dedicated | { tier: external, secret: MY_DB }
|
|
80
|
+
# database: true
|
|
81
|
+
# # cache — Redis, LRU eviction (derived data). Injects CACHE_REDIS_URL (+ REDIS_URL).
|
|
82
|
+
# # true | redis | { engine: external, secret: MY_REDIS_URL }
|
|
83
|
+
# cache: true
|
|
84
|
+
# # kv — Redis, no eviction (durable: flags, idempotency). Injects KV_REDIS_URL.
|
|
85
|
+
# kv: true
|
|
86
|
+
# # queue — Redis job-queue substrate (BullMQ). Injects QUEUE_REDIS_URL.
|
|
87
|
+
# queue: true
|
|
88
|
+
# # pubsub — Redis broadcast pub/sub. Injects PUBSUB_REDIS_URL.
|
|
89
|
+
# pubsub: true
|
|
90
|
+
# # vector — pgvector on Postgres. Injects VECTOR_PGVECTOR_URL (+ PGVECTOR_URL).
|
|
91
|
+
# # true | pgvector | { engine: pgvector, dim: 1536 }
|
|
92
|
+
# vector: pgvector
|
|
93
|
+
# # object_storage — GCS bucket. Injects OBJECT_STORAGE_GCS_BUCKET, _GCS_REGION.
|
|
94
|
+
# # true | { size: 10Gi }
|
|
95
|
+
# object_storage: true
|
|
96
|
+
# # disk — persistent FS mount (PVC). Injects DISK_PATH. Pins to 1 replica.
|
|
97
|
+
# # true | { size: 1Gi, mount: /var/data } (forbidden: /proc /sys /dev)
|
|
98
|
+
# disk: true
|
|
99
|
+
# # ai — AI Gateway via @cloudgrid-io/ai. Injects AI_GATEWAY_URL. true | false.
|
|
100
|
+
# ai: true
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
# ─── INTER-ENTITY COMMUNICATION ────────────────────────────────────────────
|
|
104
|
+
|
|
105
|
+
# Entities this app calls (outbound). Service-account token injected per pair.
|
|
106
|
+
# calls:
|
|
107
|
+
# - org:atomic/billing-api
|
|
108
|
+
|
|
109
|
+
# Inbound caller policy — who can call YOUR entity.
|
|
110
|
+
# callers:
|
|
111
|
+
# policy: auto # 'auto' | 'manual' (default).
|
|
112
|
+
# scope: org # 'org' (default) | 'space' | 'explicit'.
|
|
113
|
+
# fallback: deny # 'deny' (default) | 'warn'.
|
|
114
|
+
# # allowed_apps: # required only when scope: explicit
|
|
115
|
+
# # - org:atomic/frontend
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# ─── VAULT ──────────────────────────────────────────────────────────────────
|
|
119
|
+
|
|
120
|
+
# Map org vault items to env vars. Keys UPPER_SNAKE_CASE; values = vault item keys.
|
|
121
|
+
# Stripe secret key for the checkout + webhook routes. Set the vault item once
|
|
122
|
+
# (`grid secrets set stripe-live-key`); the platform injects it as STRIPE_KEY.
|
|
123
|
+
vault:
|
|
124
|
+
STRIPE_KEY: stripe-live-key
|
|
125
|
+
# SENDGRID_API_KEY: sendgrid-key
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
# ─── CONNECTORS AND HOOKS ──────────────────────────────────────────────────
|
|
129
|
+
|
|
130
|
+
# connectors:
|
|
131
|
+
# - id: team-slack
|
|
132
|
+
# target: org # 'system' | 'org'.
|
|
133
|
+
# channel: "#deploys"
|
|
134
|
+
# hooks:
|
|
135
|
+
# - on: deploy.failed # release.published | deploy.failed | feedback.received | entity.created
|
|
136
|
+
# via: team-slack
|
|
137
|
+
# template: "Deploy failed for {entity_name}: {error}"
|
|
138
|
+
# channel: "#alerts"
|
|
139
|
+
# triggers:
|
|
140
|
+
# - from: team-slack
|
|
141
|
+
# event: message
|
|
142
|
+
# channel: "#support"
|
|
143
|
+
# route: /webhooks/slack
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
# ─── LOCAL DEVELOPMENT ──────────────────────────────────────────────────────
|
|
147
|
+
|
|
148
|
+
# Config for `grid dev`. Redact fields in dev data snapshots.
|
|
149
|
+
# dev:
|
|
150
|
+
# snapshot:
|
|
151
|
+
# mask:
|
|
152
|
+
# - users.email
|
|
153
|
+
# - users.phone
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
# ─── AGENT METADATA ────────────────────────────────────────────────────────
|
|
157
|
+
|
|
158
|
+
# An agent is an app with kind: agent (above) and an agent: block.
|
|
159
|
+
# agent:
|
|
160
|
+
# purpose: Sync customer data from external CRM every night
|
|
161
|
+
# schedule: "0 2 * * *"
|
|
162
|
+
# trigger: webhook
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
# ─── PRIVATE RESOURCE AUTO-DEPENDENCIES ────────────────────────────────────
|
|
166
|
+
|
|
167
|
+
# When true (default), private resources are auto-injected as depends_on.
|
|
168
|
+
# auto_depends_on_private_requires: true
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
# ─── SERVICES (REQUIRED) ───────────────────────────────────────────────────
|
|
172
|
+
#
|
|
173
|
+
# At least one service is required. Key = service name (slug rules).
|
|
174
|
+
# Types: node, nextjs, python, static, cron.
|
|
175
|
+
#
|
|
176
|
+
services:
|
|
177
|
+
web:
|
|
178
|
+
# type (REQUIRED): node | nextjs | python | static | cron
|
|
179
|
+
type: nextjs
|
|
180
|
+
# HTTP route: '/' | '/api' | false (internal) | omitted (=false + warning).
|
|
181
|
+
# Only one service per entity can claim '/'.
|
|
182
|
+
path: /
|
|
183
|
+
# Container port (default 8080; read process.env.PORT). Not for cron.
|
|
184
|
+
# port: 3000
|
|
185
|
+
# nextjs only: base_image: distroless (default) | alpine
|
|
186
|
+
# base_image: distroless
|
|
187
|
+
# node only: lang: javascript (default) | typescript
|
|
188
|
+
# lang: typescript
|
|
189
|
+
# Custom source location (default services/<name>/). '.' = project root.
|
|
190
|
+
# source:
|
|
191
|
+
# path: src/worker
|
|
192
|
+
# Health probe: false/omitted (TCP) | true (/health) | "/path" | {path,expected}
|
|
193
|
+
# health:
|
|
194
|
+
# path: /api/health
|
|
195
|
+
# expected: "200"
|
|
196
|
+
# Static runtime env vars (strings). Reserved: PORT, APP_NAME, SERVICE_NAME,
|
|
197
|
+
# NODE_ENV, MONGODB_URL, REDIS_URL, AI_GATEWAY_URL, N8N_WEBHOOK_URL, CLOUDGRID_*.
|
|
198
|
+
# env:
|
|
199
|
+
# LOG_LEVEL: info
|
|
200
|
+
# Sibling services/private resources that must be Ready first (no cron, no cycles).
|
|
201
|
+
# depends_on:
|
|
202
|
+
# - worker
|
|
203
|
+
# Per-service needs override (merges with app-level needs).
|
|
204
|
+
# needs:
|
|
205
|
+
# queue: true
|
|
206
|
+
# Static-only build step:
|
|
207
|
+
# build:
|
|
208
|
+
# command: npm run build
|
|
209
|
+
# output: dist
|
|
210
|
+
# env:
|
|
211
|
+
# VITE_API_URL: https://api.example.com
|
|
212
|
+
# node_version: "22" # static build step: '18'|'20'|'22'|'24' (quoted)
|
|
213
|
+
# Cron-only: schedule (REQUIRED), timezone (UTC|EST|PST), run (job | https URL)
|
|
214
|
+
# schedule: "0 9 * * 1"
|
|
215
|
+
# timezone: UTC
|
|
216
|
+
# run: job
|
|
217
|
+
# Verbose per-service persistence (prefer needs.disk):
|
|
218
|
+
# persist:
|
|
219
|
+
# - name: scratch
|
|
220
|
+
# path: /tmp/scratch
|
|
221
|
+
# size: 500Mi
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
needs:
|
|
225
|
+
database: true
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
# ============================================================================
|
|
229
|
+
# NOTES
|
|
230
|
+
# - NOT here: org:/entity_id: (→ .cloudgrid/link.json), secrets (→ grid secrets set),
|
|
231
|
+
# Dockerfile (platform generates from services.*.type).
|
|
232
|
+
# - Deploy: grid plug | Local with grid resources: grid dev
|
|
233
|
+
# - Full reference: docs/cloudgrid-yaml-reference.md | CLI: docs/cli-reference.md
|
|
234
|
+
# ============================================================================
|