@stacksjs/defaults 0.70.206 → 0.70.208
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/TODO.md +21 -0
- package/ai/AGENTS.md +79 -0
- package/ai/README.md +45 -0
- package/ai/claude/launch.json +12 -0
- package/ai/skills/stacks-actions/SKILL.md +128 -0
- package/ai/skills/stacks-ai/SKILL.md +276 -0
- package/ai/skills/stacks-alias/SKILL.md +94 -0
- package/ai/skills/stacks-analytics/SKILL.md +91 -0
- package/ai/skills/stacks-api/SKILL.md +738 -0
- package/ai/skills/stacks-arrays/SKILL.md +277 -0
- package/ai/skills/stacks-auth/SKILL.md +422 -0
- package/ai/skills/stacks-auto-imports/SKILL.md +138 -0
- package/ai/skills/stacks-brandkit/SKILL.md +811 -0
- package/ai/skills/stacks-browse/SKILL.md +127 -0
- package/ai/skills/stacks-browse/scripts/browse.ts +492 -0
- package/ai/skills/stacks-browser/SKILL.md +145 -0
- package/ai/skills/stacks-buddy/SKILL.md +676 -0
- package/ai/skills/stacks-build/SKILL.md +163 -0
- package/ai/skills/stacks-cache/SKILL.md +125 -0
- package/ai/skills/stacks-calendar/SKILL.md +113 -0
- package/ai/skills/stacks-chat/SKILL.md +371 -0
- package/ai/skills/stacks-cli/SKILL.md +112 -0
- package/ai/skills/stacks-cloud/SKILL.md +192 -0
- package/ai/skills/stacks-cms/SKILL.md +217 -0
- package/ai/skills/stacks-collections/SKILL.md +82 -0
- package/ai/skills/stacks-commerce/SKILL.md +114 -0
- package/ai/skills/stacks-composables/SKILL.md +161 -0
- package/ai/skills/stacks-config/SKILL.md +144 -0
- package/ai/skills/stacks-configuration/SKILL.md +154 -0
- package/ai/skills/stacks-cron/SKILL.md +123 -0
- package/ai/skills/stacks-crosswind/SKILL.md +190 -0
- package/ai/skills/stacks-dashboard/SKILL.md +173 -0
- package/ai/skills/stacks-database/SKILL.md +286 -0
- package/ai/skills/stacks-datetime/SKILL.md +269 -0
- package/ai/skills/stacks-dependencies/SKILL.md +111 -0
- package/ai/skills/stacks-deploy/SKILL.md +102 -0
- package/ai/skills/stacks-design-brutalist/SKILL.md +110 -0
- package/ai/skills/stacks-design-minimalist/SKILL.md +115 -0
- package/ai/skills/stacks-design-output/SKILL.md +55 -0
- package/ai/skills/stacks-design-soft/SKILL.md +156 -0
- package/ai/skills/stacks-design-taste/SKILL.md +1012 -0
- package/ai/skills/stacks-design-taste-codex/SKILL.md +294 -0
- package/ai/skills/stacks-desktop/SKILL.md +78 -0
- package/ai/skills/stacks-development/SKILL.md +298 -0
- package/ai/skills/stacks-dns/SKILL.md +149 -0
- package/ai/skills/stacks-docs/SKILL.md +109 -0
- package/ai/skills/stacks-email/SKILL.md +236 -0
- package/ai/skills/stacks-enums/SKILL.md +100 -0
- package/ai/skills/stacks-env/SKILL.md +181 -0
- package/ai/skills/stacks-error-handling/SKILL.md +137 -0
- package/ai/skills/stacks-events/SKILL.md +228 -0
- package/ai/skills/stacks-faker/SKILL.md +158 -0
- package/ai/skills/stacks-git/SKILL.md +158 -0
- package/ai/skills/stacks-guard/SKILL.md +98 -0
- package/ai/skills/stacks-health/SKILL.md +75 -0
- package/ai/skills/stacks-http/SKILL.md +316 -0
- package/ai/skills/stacks-i18n/SKILL.md +198 -0
- package/ai/skills/stacks-image-to-code/SKILL.md +629 -0
- package/ai/skills/stacks-imagegen-mobile/SKILL.md +1474 -0
- package/ai/skills/stacks-imagegen-web/SKILL.md +998 -0
- package/ai/skills/stacks-investigate/SKILL.md +119 -0
- package/ai/skills/stacks-jobs/SKILL.md +136 -0
- package/ai/skills/stacks-lint/SKILL.md +184 -0
- package/ai/skills/stacks-listeners/SKILL.md +99 -0
- package/ai/skills/stacks-logging/SKILL.md +78 -0
- package/ai/skills/stacks-mail/SKILL.md +120 -0
- package/ai/skills/stacks-middleware/SKILL.md +249 -0
- package/ai/skills/stacks-migrations/SKILL.md +105 -0
- package/ai/skills/stacks-models/SKILL.md +267 -0
- package/ai/skills/stacks-new-feature/SKILL.md +206 -0
- package/ai/skills/stacks-notifications/SKILL.md +210 -0
- package/ai/skills/stacks-objects/SKILL.md +205 -0
- package/ai/skills/stacks-office-hours/SKILL.md +134 -0
- package/ai/skills/stacks-orm/SKILL.md +342 -0
- package/ai/skills/stacks-path/SKILL.md +118 -0
- package/ai/skills/stacks-payments/SKILL.md +373 -0
- package/ai/skills/stacks-plan-review/SKILL.md +152 -0
- package/ai/skills/stacks-plugins/SKILL.md +149 -0
- package/ai/skills/stacks-push/SKILL.md +376 -0
- package/ai/skills/stacks-query-builder/SKILL.md +128 -0
- package/ai/skills/stacks-queue/SKILL.md +559 -0
- package/ai/skills/stacks-realtime/SKILL.md +442 -0
- package/ai/skills/stacks-redesign/SKILL.md +182 -0
- package/ai/skills/stacks-registry/SKILL.md +58 -0
- package/ai/skills/stacks-repl/SKILL.md +80 -0
- package/ai/skills/stacks-retro/SKILL.md +122 -0
- package/ai/skills/stacks-review/SKILL.md +135 -0
- package/ai/skills/stacks-router/SKILL.md +231 -0
- package/ai/skills/stacks-routes/SKILL.md +105 -0
- package/ai/skills/stacks-scaffolding/SKILL.md +162 -0
- package/ai/skills/stacks-scheduler/SKILL.md +363 -0
- package/ai/skills/stacks-search-engine/SKILL.md +112 -0
- package/ai/skills/stacks-security/SKILL.md +129 -0
- package/ai/skills/stacks-security-audit/SKILL.md +128 -0
- package/ai/skills/stacks-server/SKILL.md +458 -0
- package/ai/skills/stacks-shell/SKILL.md +62 -0
- package/ai/skills/stacks-slug/SKILL.md +87 -0
- package/ai/skills/stacks-sms/SKILL.md +385 -0
- package/ai/skills/stacks-socials/SKILL.md +303 -0
- package/ai/skills/stacks-storage/SKILL.md +576 -0
- package/ai/skills/stacks-strings/SKILL.md +416 -0
- package/ai/skills/stacks-stx/SKILL.md +176 -0
- package/ai/skills/stacks-technical-diagrams/LICENSE +22 -0
- package/ai/skills/stacks-technical-diagrams/SKILL.md +290 -0
- package/ai/skills/stacks-technical-diagrams/agents/openai.yaml +4 -0
- package/ai/skills/stacks-technical-diagrams/assets/template.html +1252 -0
- package/ai/skills/stacks-technical-diagrams/bin/technical-diagrams.mjs +289 -0
- package/ai/skills/stacks-technical-diagrams/bunfig.toml +1 -0
- package/ai/skills/stacks-technical-diagrams/examples/agent-run.lifecycle.json +64 -0
- package/ai/skills/stacks-technical-diagrams/examples/agent-tool-call.workflow.json +88 -0
- package/ai/skills/stacks-technical-diagrams/examples/cache-miss-request.sequence.json +75 -0
- package/ai/skills/stacks-technical-diagrams/examples/product-analytics.dataflow.json +70 -0
- package/ai/skills/stacks-technical-diagrams/examples/web-app.architecture.json +41 -0
- package/ai/skills/stacks-technical-diagrams/renderers/architecture/grid.mjs +62 -0
- package/ai/skills/stacks-technical-diagrams/renderers/architecture/render-architecture.mjs +371 -0
- package/ai/skills/stacks-technical-diagrams/renderers/dataflow/README.md +82 -0
- package/ai/skills/stacks-technical-diagrams/renderers/dataflow/render-dataflow.mjs +295 -0
- package/ai/skills/stacks-technical-diagrams/renderers/lifecycle/README.md +91 -0
- package/ai/skills/stacks-technical-diagrams/renderers/lifecycle/render-lifecycle.mjs +384 -0
- package/ai/skills/stacks-technical-diagrams/renderers/sequence/README.md +84 -0
- package/ai/skills/stacks-technical-diagrams/renderers/sequence/render-sequence.mjs +257 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/cli.mjs +42 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/generated-validators.mjs +13 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/geometry.mjs +230 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/layout-report.mjs +40 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/utils.mjs +88 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/validator.mjs +40 -0
- package/ai/skills/stacks-technical-diagrams/renderers/workflow/README.md +103 -0
- package/ai/skills/stacks-technical-diagrams/renderers/workflow/render-workflow.mjs +481 -0
- package/ai/skills/stacks-technical-diagrams/schemas/README.md +68 -0
- package/ai/skills/stacks-technical-diagrams/schemas/architecture.schema.json +121 -0
- package/ai/skills/stacks-technical-diagrams/schemas/common.schema.json +43 -0
- package/ai/skills/stacks-technical-diagrams/schemas/dataflow.schema.json +221 -0
- package/ai/skills/stacks-technical-diagrams/schemas/lifecycle.schema.json +241 -0
- package/ai/skills/stacks-technical-diagrams/schemas/sequence.schema.json +186 -0
- package/ai/skills/stacks-technical-diagrams/schemas/workflow.schema.json +332 -0
- package/ai/skills/stacks-technical-diagrams/scripts/check-render-output.mjs +297 -0
- package/ai/skills/stacks-technical-diagrams/scripts/render-examples.mjs +28 -0
- package/ai/skills/stacks-testing/SKILL.md +129 -0
- package/ai/skills/stacks-tunnel/SKILL.md +125 -0
- package/ai/skills/stacks-types/SKILL.md +178 -0
- package/ai/skills/stacks-ui/SKILL.md +246 -0
- package/ai/skills/stacks-utils/SKILL.md +444 -0
- package/ai/skills/stacks-validation/SKILL.md +371 -0
- package/ai/skills/stacks-whois/SKILL.md +315 -0
- package/assets/world-map-data.ts +121 -0
- package/bootstrap.ts +114 -0
- package/docs/api-examples.md +46 -0
- package/docs/index.md +24 -0
- package/docs/markdown-examples.md +87 -0
- package/functions/analytics.ts +97 -0
- package/functions/api.ts +143 -0
- package/functions/auth.ts +208 -0
- package/functions/billing/payments.ts +149 -0
- package/functions/blog.ts +120 -0
- package/functions/cms/categorizables.ts +107 -0
- package/functions/cms/pages.ts +108 -0
- package/functions/cms/posts.ts +100 -0
- package/functions/cms/taggables.ts +102 -0
- package/functions/commerce/coupons.ts +128 -0
- package/functions/commerce/customers.ts +128 -0
- package/functions/commerce/gift-cards.ts +119 -0
- package/functions/commerce/orders.ts +112 -0
- package/functions/commerce/payments.ts +119 -0
- package/functions/commerce/products/categories.ts +123 -0
- package/functions/commerce/products/manufacturers.ts +123 -0
- package/functions/commerce/products/products.ts +123 -0
- package/functions/commerce/products/reviews.ts +123 -0
- package/functions/commerce/products/units.ts +123 -0
- package/functions/commerce/products/variants.ts +123 -0
- package/functions/commerce/shippings/delivery-routes.ts +123 -0
- package/functions/commerce/shippings/digital-deliveries.ts +119 -0
- package/functions/commerce/shippings/drivers.ts +123 -0
- package/functions/commerce/shippings/license-keys.ts +123 -0
- package/functions/commerce/shippings/shipping-methods.ts +123 -0
- package/functions/commerce/shippings/shipping-rates.ts +119 -0
- package/functions/commerce/shippings/shipping-zones.ts +119 -0
- package/functions/commerce/taxes.ts +119 -0
- package/functions/commerce/waitlist/products.ts +123 -0
- package/functions/commerce/waitlist/restaurants.ts +123 -0
- package/functions/craft.ts +107 -0
- package/functions/dashboard.ts +153 -0
- package/functions/inbox.ts +95 -0
- package/functions/jobs.ts +86 -0
- package/functions/monitoring/errors.ts +295 -0
- package/functions/queue.ts +111 -0
- package/functions/realtime/websockets.ts +96 -0
- package/functions/realtime.ts +52 -0
- package/functions/releases.ts +49 -0
- package/functions/search.ts +126 -0
- package/functions/toasts.ts +95 -0
- package/functions/uploads.ts +216 -0
- package/ide/.gitignore +4 -0
- package/ide/cursor/rules/auto-imports.mdc +574 -0
- package/ide/cursor/rules/code-style.mdc +12 -0
- package/ide/cursor/rules/documentation.mdc +9 -0
- package/ide/cursor/rules/error-handling-validation.mdc +11 -0
- package/ide/cursor/rules/key-conventions.mdc +11 -0
- package/ide/cursor/rules/project-structure.mdc +169 -0
- package/ide/cursor/rules/readme.mdc +318 -0
- package/ide/cursor/rules/syntax-formatting.mdc +9 -0
- package/ide/cursor/rules/testing.mdc +10 -0
- package/ide/cursor/rules/typescript.mdc +9 -0
- package/ide/cursor/rules/ui-styling.mdc +0 -0
- package/ide/dictionary.txt +397 -0
- package/ide/jetbrains/.fleet/settings.json +4 -0
- package/ide/jetbrains/.idea/.gitignore +5 -0
- package/ide/jetbrains/.idea/.name +1 -0
- package/ide/jetbrains/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/ide/jetbrains/.idea/jsLinters/eslint.xml +7 -0
- package/ide/jetbrains/.idea/modules.xml +8 -0
- package/ide/jetbrains/.idea/stacks.iml +22 -0
- package/ide/jetbrains/.idea/vcs.xml +6 -0
- package/ide/jetbrains/.idea/webResources.xml +14 -0
- package/ide/jetbrains/IntelliJ IDEA Global Settings +0 -0
- package/ide/jetbrains/installed.txt +4 -0
- package/ide/jetbrains/options/github-copilot.xml +5 -0
- package/ide/jetbrains/options/nodejs.xml +7 -0
- package/ide/jetbrains/options/templates.xml +124 -0
- package/ide/jetbrains/templates/JavaScript.xml +6 -0
- package/ide/jetbrains/templates/Stacks.xml +8 -0
- package/ide/vscode/.vscode/README.md +23 -0
- package/ide/vscode/.vscode/extensions.json +5 -0
- package/ide/vscode/.vscode/settings.json +176 -0
- package/ide/vscode/.vscode/stacks.code-snippets +181 -0
- package/ide/vscode/LICENSE.md +21 -0
- package/ide/vscode/README.md +36 -0
- package/ide/vscode/logo.png +0 -0
- package/ide/vscode/package.json +79 -0
- package/ide/zed/.zed/settings.json +139 -0
- package/lang/README.md +28 -0
- package/lang/de.yml +14 -0
- package/lang/en.yml +15 -0
- package/package.json +19 -3
- package/project/bootstrap +161 -0
- package/project/buddy +175 -0
- package/project/storage/framework/tsconfig.app.json +50 -0
- package/project/storage/framework/tsconfig.base.json +58 -0
- package/routes/core.ts +78 -0
- package/routes/dashboard-api.ts +233 -0
- package/routes/dashboard.ts +739 -0
- package/routes/email.ts +129 -0
- package/stores/[name].stx +16 -0
- package/stores/git.ts +71 -0
- package/stores/payment.ts +474 -0
- package/stores/queue.ts +43 -0
- package/stores/user.ts +29 -0
- package/stx-components-plugin.ts +25 -0
- package/styles/design-tokens.css +597 -0
- package/types/dashboard.ts +70 -0
- package/types/defaults.ts +438 -0
- package/vcs/github/CODE_OF_CONDUCT.md +83 -0
- package/vcs/github/CONTRIBUTING.md +187 -0
- package/vcs/github/EXPLANATIONS.md +41 -0
- package/vcs/github/FUNDING.yml +1 -0
- package/vcs/github/ISSUE_TEMPLATE/bug_report.yml +49 -0
- package/vcs/github/ISSUE_TEMPLATE/config.yml +10 -0
- package/vcs/github/ISSUE_TEMPLATE/feature_request.yml +44 -0
- package/vcs/github/SECURITY.md +70 -0
- package/vcs/github/renovate.json +5 -0
- package/vcs/github/stale.yml +14 -0
- package/vcs/github/workflows/README.md +16 -0
- package/vcs/github/workflows/ci.yml +114 -0
- package/vcs/github/workflows/export-size.yml +25 -0
- package/vcs/github/workflows/labeler.yml +13 -0
- package/vcs/github/workflows/release.yml +219 -0
- package/views/[...all].stx +8 -0
- package/views/about.md +3 -0
- package/views/auth/login.stx +1 -0
- package/views/auth/signup.stx +85 -0
- package/views/dashboard/.discovered-models.json +542 -0
- package/views/dashboard/AUDIT.md +904 -0
- package/views/dashboard/[...all].stx +89 -0
- package/views/dashboard/access-tokens/index.stx +177 -0
- package/views/dashboard/actions/index.stx +129 -0
- package/views/dashboard/analytics/blog/index.stx +356 -0
- package/views/dashboard/analytics/browsers/index.stx +263 -0
- package/views/dashboard/analytics/commerce/sales/index.stx +329 -0
- package/views/dashboard/analytics/commerce/web/index.stx +379 -0
- package/views/dashboard/analytics/countries/index.stx +289 -0
- package/views/dashboard/analytics/devices/index.stx +305 -0
- package/views/dashboard/analytics/events/index.stx +536 -0
- package/views/dashboard/analytics/index.stx +88 -0
- package/views/dashboard/analytics/marketing/index.stx +315 -0
- package/views/dashboard/analytics/pages/index.stx +271 -0
- package/views/dashboard/analytics/referrers/index.stx +319 -0
- package/views/dashboard/analytics/web/index.stx +356 -0
- package/views/dashboard/buddy/index.stx +198 -0
- package/views/dashboard/ci/index.stx +462 -0
- package/views/dashboard/cloud/index.stx +452 -0
- package/views/dashboard/commands/index.stx +295 -0
- package/views/dashboard/commerce/categories/index.stx +406 -0
- package/views/dashboard/commerce/coupons/index.stx +485 -0
- package/views/dashboard/commerce/customers/index.stx +410 -0
- package/views/dashboard/commerce/dashboard/index.stx +287 -0
- package/views/dashboard/commerce/delivery/delivery-routes.stx +305 -0
- package/views/dashboard/commerce/delivery/digital-delivery.stx +332 -0
- package/views/dashboard/commerce/delivery/drivers.stx +397 -0
- package/views/dashboard/commerce/delivery/index.stx +18 -0
- package/views/dashboard/commerce/delivery/license-keys.stx +380 -0
- package/views/dashboard/commerce/delivery/shipping-methods.stx +346 -0
- package/views/dashboard/commerce/delivery/shipping-rates.stx +338 -0
- package/views/dashboard/commerce/delivery/shipping-zones.stx +302 -0
- package/views/dashboard/commerce/delivery/tabs.ts +25 -0
- package/views/dashboard/commerce/gift-cards/index.stx +561 -0
- package/views/dashboard/commerce/manufacturers/index.stx +308 -0
- package/views/dashboard/commerce/orders/index.stx +247 -0
- package/views/dashboard/commerce/payments/index.stx +535 -0
- package/views/dashboard/commerce/pos/index.stx +653 -0
- package/views/dashboard/commerce/printers/devices/index.stx +273 -0
- package/views/dashboard/commerce/printers/receipts/index.stx +308 -0
- package/views/dashboard/commerce/products/detail.stx +563 -0
- package/views/dashboard/commerce/products/index.stx +370 -0
- package/views/dashboard/commerce/reviews/index.stx +656 -0
- package/views/dashboard/commerce/reviews/index.ts +0 -0
- package/views/dashboard/commerce/taxes/index.stx +377 -0
- package/views/dashboard/commerce/units/index.stx +317 -0
- package/views/dashboard/commerce/variants/index.stx +319 -0
- package/views/dashboard/commerce/waitlist/products.stx +942 -0
- package/views/dashboard/commerce/waitlist/restaurant.stx +1024 -0
- package/views/dashboard/components/index.stx +330 -0
- package/views/dashboard/composables/index.ts +19 -0
- package/views/dashboard/composables/useChart.ts +77 -0
- package/views/dashboard/composables/useNavigation.ts +99 -0
- package/views/dashboard/composables/useRole.ts +58 -0
- package/views/dashboard/composables/useTheme.ts +74 -0
- package/views/dashboard/content/authors/index.stx +171 -0
- package/views/dashboard/content/blog/index.stx +493 -0
- package/views/dashboard/content/categories/index.stx +169 -0
- package/views/dashboard/content/comments/index.stx +189 -0
- package/views/dashboard/content/dashboard.stx +383 -0
- package/views/dashboard/content/files/index.stx +706 -0
- package/views/dashboard/content/pages/index.stx +174 -0
- package/views/dashboard/content/posts/index.stx +269 -0
- package/views/dashboard/content/seo/index.stx +240 -0
- package/views/dashboard/content/tags/index.stx +167 -0
- package/views/dashboard/data/activity/index.stx +261 -0
- package/views/dashboard/data/dashboard/index.stx +116 -0
- package/views/dashboard/data/subscribers.stx +270 -0
- package/views/dashboard/data/teams.stx +275 -0
- package/views/dashboard/data/users.stx +279 -0
- package/views/dashboard/dependencies/index.stx +178 -0
- package/views/dashboard/deployments/[id].stx +234 -0
- package/views/dashboard/deployments/index.stx +9 -0
- package/views/dashboard/dns/index.stx +163 -0
- package/views/dashboard/environment/index.stx +283 -0
- package/views/dashboard/errors/index.stx +274 -0
- package/views/dashboard/forgot-password.stx +57 -0
- package/views/dashboard/functions/index.stx +159 -0
- package/views/dashboard/health/index.stx +248 -0
- package/views/dashboard/inbox/activity.stx +350 -0
- package/views/dashboard/inbox/index.stx +452 -0
- package/views/dashboard/inbox/settings.stx +290 -0
- package/views/dashboard/index.stx +252 -0
- package/views/dashboard/insights/index.stx +529 -0
- package/views/dashboard/jobs/[id].stx +430 -0
- package/views/dashboard/jobs/history.stx +222 -0
- package/views/dashboard/jobs/index.stx +214 -0
- package/views/dashboard/kanban/[id].stx +899 -0
- package/views/dashboard/kanban/index.stx +260 -0
- package/views/dashboard/layouts/default.stx +565 -0
- package/views/dashboard/layouts/guest.stx +10 -0
- package/views/dashboard/login.stx +48 -0
- package/views/dashboard/logs/index.stx +540 -0
- package/views/dashboard/mailboxes/index.stx +149 -0
- package/views/dashboard/management/permissions/index.stx +490 -0
- package/views/dashboard/marketing/campaigns/index.stx +604 -0
- package/views/dashboard/marketing/lists/index.stx +514 -0
- package/views/dashboard/marketing/reviews/index.stx +475 -0
- package/views/dashboard/marketing/social-posts/index.stx +560 -0
- package/views/dashboard/models/[model].stx +195 -0
- package/views/dashboard/models/index.stx +159 -0
- package/views/dashboard/monitoring/errors/index.stx +415 -0
- package/views/dashboard/notifications/dashboard.stx +383 -0
- package/views/dashboard/notifications/email.stx +336 -0
- package/views/dashboard/notifications/history.stx +373 -0
- package/views/dashboard/notifications/sms.stx +332 -0
- package/views/dashboard/packages/index.stx +195 -0
- package/views/dashboard/queries/[id].stx +381 -0
- package/views/dashboard/queries/history.stx +227 -0
- package/views/dashboard/queries/index.stx +335 -0
- package/views/dashboard/queries/slow.stx +318 -0
- package/views/dashboard/queue/index.stx +427 -0
- package/views/dashboard/realtime/index.stx +429 -0
- package/views/dashboard/register.stx +46 -0
- package/views/dashboard/releases/index.stx +389 -0
- package/views/dashboard/requests/index.stx +462 -0
- package/views/dashboard/serverless/index.stx +475 -0
- package/views/dashboard/servers/[id].stx +299 -0
- package/views/dashboard/servers/index.stx +483 -0
- package/views/dashboard/settings/billing.stx +50 -0
- package/views/dashboard/settings/index.stx +256 -0
- package/views/dashboard/settings/mail.stx +252 -0
- package/views/dashboard/stores/auth.ts +123 -0
- package/views/dashboard/stores/ci.ts +342 -0
- package/views/dashboard/stores/index.ts +129 -0
- package/views/dashboard/stores/kanban.ts +723 -0
- package/views/dashboard/stores/rbac.ts +350 -0
- package/views/dashboard/stx.config.ts +34 -0
- package/views/dashboard/teams/[id].stx +170 -0
- package/views/forum/category.stx +92 -0
- package/views/forum/index.stx +209 -0
- package/views/forum/new-topic.stx +113 -0
- package/views/forum/profile.stx +1 -0
- package/views/forum/topic.stx +143 -0
- package/views/hello-world/[name].stx +47 -0
- package/views/index.stx +21 -0
- package/views/system-tray/index.stx +147 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-mail
|
|
3
|
+
description: Use when creating mail classes in app/Mail/ — defining email content and templates, using the template() function with STX or HTML templates, variable interpolation, email layouts, or the app-level mail sending pattern. For the email framework itself (drivers, Mail singleton, EmailSDK, inbox management), see stacks-email.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Stacks Mail Classes
|
|
10
|
+
|
|
11
|
+
Application-level email definitions in `app/Mail/`.
|
|
12
|
+
|
|
13
|
+
## Key Paths
|
|
14
|
+
- Application mail: `app/Mail/`
|
|
15
|
+
- Email templates: `resources/emails/` (or `storage/framework/defaults/resources/emails/`)
|
|
16
|
+
- Email layouts: `storage/framework/defaults/resources/emails/layouts/`
|
|
17
|
+
|
|
18
|
+
## Creating a Mail Class
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// app/Mail/WelcomeEmail.ts
|
|
22
|
+
import { mail, template } from '@stacksjs/email'
|
|
23
|
+
import { config } from '@stacksjs/config'
|
|
24
|
+
|
|
25
|
+
interface WelcomeEmailOptions {
|
|
26
|
+
to: string
|
|
27
|
+
name: string
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export async function sendWelcomeEmail({ to, name }: WelcomeEmailOptions) {
|
|
31
|
+
const { html, text } = await template('welcome', {
|
|
32
|
+
variables: { name, appName: config.app.name },
|
|
33
|
+
layout: 'default'
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
await mail.send({
|
|
37
|
+
from: { name: config.app.name, address: config.email.from.address },
|
|
38
|
+
to,
|
|
39
|
+
subject: `Welcome to ${config.app.name}!`,
|
|
40
|
+
html,
|
|
41
|
+
text
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Template Rendering
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { template, renderHtml, templateExists, listTemplates } from '@stacksjs/email'
|
|
50
|
+
|
|
51
|
+
// From template file (welcome.stx or welcome.html)
|
|
52
|
+
const { html, text } = await template('welcome', {
|
|
53
|
+
variables: { name: 'John', url: 'https://app.com/verify' },
|
|
54
|
+
layout: 'default', // wrap in layout (or false to skip)
|
|
55
|
+
subject: 'Welcome'
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
// From raw HTML
|
|
59
|
+
const { html, text } = renderHtml('<h1>Hello {{ name }}</h1>', { name: 'John' })
|
|
60
|
+
|
|
61
|
+
// Check templates
|
|
62
|
+
templateExists('welcome') // boolean
|
|
63
|
+
listTemplates() // string[]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Variable syntax: `{{ variableName }}` (double braces with spaces).
|
|
67
|
+
|
|
68
|
+
## Example: Subscription Confirmation
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
// app/Mail/SubscriptionConfirmation.ts
|
|
72
|
+
import { mail, template } from '@stacksjs/email'
|
|
73
|
+
import { url } from '@stacksjs/router'
|
|
74
|
+
import { config } from '@stacksjs/config'
|
|
75
|
+
|
|
76
|
+
export async function sendSubscriptionConfirmation({ to, subscriberUuid }: Options) {
|
|
77
|
+
const { html, text } = await template('subscription-confirmation', {
|
|
78
|
+
variables: {
|
|
79
|
+
unsubscribeUrl: url('email.unsubscribe', { token: subscriberUuid }),
|
|
80
|
+
appName: config.app.name
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
await mail.send({
|
|
85
|
+
from: { name: config.app.name, address: config.email.from.address },
|
|
86
|
+
to,
|
|
87
|
+
subject: 'Confirm your subscription',
|
|
88
|
+
html,
|
|
89
|
+
text
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Using Mail in Actions/Events
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
// In an action
|
|
98
|
+
import { sendWelcomeEmail } from '../../app/Mail/WelcomeEmail'
|
|
99
|
+
|
|
100
|
+
export default {
|
|
101
|
+
name: 'SendWelcomeEmail',
|
|
102
|
+
async handle(event: { email: string, name: string }) {
|
|
103
|
+
await sendWelcomeEmail({ to: event.email, name: event.name })
|
|
104
|
+
return { success: true }
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Template Locations
|
|
110
|
+
- STX templates: `.stx` files processed by STX engine
|
|
111
|
+
- HTML templates: `.html` files with `{{ }}` variable interpolation
|
|
112
|
+
- Layouts: base HTML wrapping templates (header, footer, styles)
|
|
113
|
+
|
|
114
|
+
## Gotchas
|
|
115
|
+
- Mail classes are plain functions, not classes — no inheritance needed
|
|
116
|
+
- Templates support both `.stx` (reactive) and `.html` (static) formats
|
|
117
|
+
- Variable interpolation uses `{{ }}` — not `${}`
|
|
118
|
+
- `text` output is auto-generated from HTML via `htmlToText()`
|
|
119
|
+
- Layouts wrap the template content with shared structure (header/footer)
|
|
120
|
+
- For the email driver system (SES, SendGrid, etc.), see the `stacks-email` skill
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-middleware
|
|
3
|
+
description: Use when working with middleware in a Stacks application — defining middleware, applying to routes, middleware aliases, parameterized middleware, groups, or the middleware execution pipeline. Covers the Middleware class, app/Middleware.ts alias registry, and all 22 default middleware files.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Stacks Middleware
|
|
10
|
+
|
|
11
|
+
Built into `@stacksjs/router`. Middleware intercepts requests before they reach route handlers.
|
|
12
|
+
|
|
13
|
+
## Key Paths
|
|
14
|
+
- Middleware class: `storage/framework/core/router/src/middleware.ts`
|
|
15
|
+
- Execution engine: `storage/framework/core/router/src/stacks-router.ts`
|
|
16
|
+
- Alias registry: `app/Middleware.ts`
|
|
17
|
+
- Default middleware: `storage/framework/defaults/app/Middleware/` (22 files)
|
|
18
|
+
- Auth middleware (standalone): `storage/framework/core/auth/src/middleware.ts`
|
|
19
|
+
- Tests: `storage/framework/core/router/tests/middleware.test.ts`
|
|
20
|
+
|
|
21
|
+
## Middleware Class
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { Middleware } from '@stacksjs/router'
|
|
25
|
+
|
|
26
|
+
export interface MiddlewareConfig {
|
|
27
|
+
name: string
|
|
28
|
+
priority?: number // Lower = runs first, default: 10
|
|
29
|
+
handle: (request: EnhancedRequest) => void | Promise<void>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class Middleware {
|
|
33
|
+
readonly name: string
|
|
34
|
+
readonly priority: number
|
|
35
|
+
readonly handle: (request: EnhancedRequest) => void | Promise<void>
|
|
36
|
+
|
|
37
|
+
constructor(config: MiddlewareConfig)
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Creating Custom Middleware
|
|
42
|
+
|
|
43
|
+
Create a file in `app/Middleware/`:
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
// app/Middleware/RateLimit.ts
|
|
47
|
+
import { Middleware } from '@stacksjs/router'
|
|
48
|
+
|
|
49
|
+
export default new Middleware({
|
|
50
|
+
name: 'RateLimit',
|
|
51
|
+
priority: 2,
|
|
52
|
+
async handle(request) {
|
|
53
|
+
// Throw to short-circuit the request
|
|
54
|
+
// throw new HttpError(429, 'Too many requests')
|
|
55
|
+
|
|
56
|
+
// Return void to continue to next middleware
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Short-Circuiting
|
|
62
|
+
|
|
63
|
+
Middleware can stop request processing by:
|
|
64
|
+
1. **Throwing an Error with `statusCode`** — converted to HTTP error response
|
|
65
|
+
2. **Throwing a Response** — returned directly to client
|
|
66
|
+
3. **Returning void** — continues to next middleware
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// Error with status code
|
|
70
|
+
const error = new Error('Unauthorized') as Error & { statusCode: number }
|
|
71
|
+
error.statusCode = 401
|
|
72
|
+
throw error
|
|
73
|
+
|
|
74
|
+
// Direct Response (full control)
|
|
75
|
+
throw new Response(JSON.stringify({ error: 'Rate limited' }), {
|
|
76
|
+
status: 429,
|
|
77
|
+
headers: { 'Retry-After': '60' },
|
|
78
|
+
})
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Alias Registry (app/Middleware.ts)
|
|
82
|
+
|
|
83
|
+
Maps short names to middleware class filenames:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
export default {
|
|
87
|
+
'maintenance': 'Maintenance',
|
|
88
|
+
'auth': 'Auth',
|
|
89
|
+
'guest': 'Guest',
|
|
90
|
+
'api': 'Api',
|
|
91
|
+
'team': 'Team',
|
|
92
|
+
'logger': 'Logger',
|
|
93
|
+
'abilities': 'Abilities',
|
|
94
|
+
'can': 'Can',
|
|
95
|
+
'throttle': 'Throttle',
|
|
96
|
+
'env': 'Env',
|
|
97
|
+
'env:local': 'EnvLocal',
|
|
98
|
+
'env:development': 'EnvDevelopment',
|
|
99
|
+
'env:dev': 'EnvDevelopment',
|
|
100
|
+
'env:staging': 'EnvStaging',
|
|
101
|
+
'env:production': 'EnvProduction',
|
|
102
|
+
'env:prod': 'EnvProduction',
|
|
103
|
+
'role': 'Role',
|
|
104
|
+
'permission': 'Permission',
|
|
105
|
+
'verified': 'EnsureEmailIsVerified',
|
|
106
|
+
} satisfies Middleware
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Applying Middleware
|
|
110
|
+
|
|
111
|
+
### Per-Route (Chainable)
|
|
112
|
+
```typescript
|
|
113
|
+
route.get('/dashboard', 'DashboardAction')
|
|
114
|
+
.middleware('auth')
|
|
115
|
+
.middleware('verified')
|
|
116
|
+
.name('dashboard.show')
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Route Groups
|
|
120
|
+
```typescript
|
|
121
|
+
route.group({ prefix: '/api/v1', middleware: ['auth', 'throttle'] }, () => {
|
|
122
|
+
route.get('/users', listUsers)
|
|
123
|
+
route.post('/users', createUser)
|
|
124
|
+
})
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Group middleware is prepended to all routes inside the callback. Groups can be nested — middleware accumulates.
|
|
128
|
+
|
|
129
|
+
### Parameterized Middleware
|
|
130
|
+
|
|
131
|
+
Pass parameters using colon syntax:
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
route.get('/admin', handler).middleware('throttle:60,1') // 60 requests per 1 minute
|
|
135
|
+
route.get('/posts', handler).middleware('abilities:read,write')
|
|
136
|
+
route.get('/settings', handler).middleware('role:admin,editor')
|
|
137
|
+
route.get('/posts/{id}', handler).middleware('can:update,post')
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Parameters are stored on `request._middlewareParams[middlewareName]` and parsed by the middleware's `handle` function.
|
|
141
|
+
|
|
142
|
+
## Default Middleware Reference
|
|
143
|
+
|
|
144
|
+
| Alias | Class | Priority | Description |
|
|
145
|
+
|-------|-------|----------|-------------|
|
|
146
|
+
| `maintenance` | Maintenance | 0 | Checks maintenance mode, supports secret bypass URL and IP allowlist |
|
|
147
|
+
| `auth` | Auth | 1 | Validates bearer token, sets authenticated user on request |
|
|
148
|
+
| `api` | Api | 1 | Validates request accepts JSON |
|
|
149
|
+
| `guest` | Guest | 1 | Ensures user is NOT authenticated (for login/register pages) |
|
|
150
|
+
| `env` | Env | 1 | Checks current environment |
|
|
151
|
+
| `logger` | Logger | 2 | Logs request method and URL |
|
|
152
|
+
| `abilities` | Abilities | 2 | Checks token abilities/scopes (parameterized: `abilities:read,write`) |
|
|
153
|
+
| `can` | Can | 3 | Authorization gate (parameterized: `can:update,post`) |
|
|
154
|
+
| `role` | Role | 3 | Checks user roles (parameterized: `role:admin`) |
|
|
155
|
+
| `permission` | Permission | 3 | Checks user permissions (parameterized: `permission:edit-posts`) |
|
|
156
|
+
| `team` | Team | 3 | Ensures user belongs to a team (parameterized: `team:teamId`) |
|
|
157
|
+
| `verified` | EnsureEmailIsVerified | 4 | Verifies email is confirmed |
|
|
158
|
+
| `throttle` | Throttle | — | Rate limiting (parameterized: `throttle:60,1` or `throttle:100,5m`) |
|
|
159
|
+
| `env:local` | EnvLocal | — | Only allows local environment |
|
|
160
|
+
| `env:development` / `env:dev` | EnvDevelopment | — | Only allows development |
|
|
161
|
+
| `env:staging` | EnvStaging | — | Only allows staging |
|
|
162
|
+
| `env:production` / `env:prod` | EnvProduction | — | Only allows production |
|
|
163
|
+
|
|
164
|
+
### Environment Negation Variants
|
|
165
|
+
|
|
166
|
+
Files exist for `EnvNotLocal`, `EnvNotDevelopment`, `EnvNotStaging`, `EnvNotProduction` — but they have **no aliases registered** in `app/Middleware.ts`.
|
|
167
|
+
|
|
168
|
+
## Middleware Loading Flow
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
1. Parse middleware name: 'throttle:60,1' → { name: 'throttle', params: '60,1' }
|
|
172
|
+
2. Check middleware cache (loaded once, cached for performance)
|
|
173
|
+
3. Resolve alias: 'throttle' → 'Throttle' (via app/Middleware.ts)
|
|
174
|
+
4. Try loading from app/Middleware/Throttle.ts (user overrides)
|
|
175
|
+
5. Fall back to storage/framework/defaults/app/Middleware/Throttle.ts
|
|
176
|
+
6. Store params on request: request._middlewareParams.throttle = '60,1'
|
|
177
|
+
7. Execute: await middleware.handle(enhancedRequest)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
User middleware in `app/Middleware/` always takes precedence over framework defaults.
|
|
181
|
+
|
|
182
|
+
## Representative Implementations
|
|
183
|
+
|
|
184
|
+
### Auth Middleware
|
|
185
|
+
```typescript
|
|
186
|
+
export default new Middleware({
|
|
187
|
+
name: 'Auth',
|
|
188
|
+
priority: 1,
|
|
189
|
+
async handle(request) {
|
|
190
|
+
const bearerToken = request.bearerToken()
|
|
191
|
+
if (!bearerToken)
|
|
192
|
+
throw new HttpError(401, 'Unauthorized. No token provided.')
|
|
193
|
+
const isValid = await Auth.validateToken(bearerToken)
|
|
194
|
+
if (!isValid)
|
|
195
|
+
throw new HttpError(401, 'Unauthorized. Invalid token.')
|
|
196
|
+
},
|
|
197
|
+
})
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Maintenance Middleware
|
|
201
|
+
```typescript
|
|
202
|
+
export default new Middleware({
|
|
203
|
+
name: 'Maintenance',
|
|
204
|
+
priority: 0,
|
|
205
|
+
async handle(request) {
|
|
206
|
+
if (!(await isDownForMaintenance())) return
|
|
207
|
+
const payload = await maintenancePayload()
|
|
208
|
+
// Check secret bypass URL → set cookie and redirect
|
|
209
|
+
// Check bypass cookie or allowed IP → continue
|
|
210
|
+
// Otherwise → throw maintenance response
|
|
211
|
+
},
|
|
212
|
+
})
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Throttle Middleware (Parameterized)
|
|
216
|
+
```typescript
|
|
217
|
+
// '60,1' = 60 requests per 1 minute
|
|
218
|
+
// '100,5m' = 100 requests per 5 minutes
|
|
219
|
+
// '1000,1h' = 1000 requests per hour
|
|
220
|
+
async handle(request) {
|
|
221
|
+
const params = request._middlewareParams?.throttle || '60,1'
|
|
222
|
+
const config = parseThrottleString(params)
|
|
223
|
+
const limiter = createRateLimitMiddleware(config)
|
|
224
|
+
// Returns 429 if rate limit exceeded
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Standalone Auth Middleware (@stacksjs/auth)
|
|
229
|
+
|
|
230
|
+
A separate, more complete auth middleware exists:
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
import { authMiddleware, authMiddlewareHandler } from '@stacksjs/auth'
|
|
234
|
+
|
|
235
|
+
// Checks both request.bearerToken() and raw Authorization header
|
|
236
|
+
// Calls Auth.getUserFromToken() to validate
|
|
237
|
+
// Sets Auth.setUser(user) and request._authenticatedUser
|
|
238
|
+
// Loads current access token onto request._currentAccessToken
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Gotchas
|
|
242
|
+
- **Priority exists but isn't used for ordering** — the router executes middleware in registration order, not priority order
|
|
243
|
+
- **`terminate()` doesn't exist** — some docs reference it, but it's not in the actual `MiddlewareConfig` interface
|
|
244
|
+
- **Two auth middleware implementations** — defaults version (basic token check) and `@stacksjs/auth` version (full user loading)
|
|
245
|
+
- **EnvNot* files have no aliases** — `EnvNotLocal.ts`, etc. exist but aren't registered in `app/Middleware.ts`
|
|
246
|
+
- **Middleware is cached after first load** — changes require server restart
|
|
247
|
+
- **User overrides take precedence** — `app/Middleware/Auth.ts` replaces the framework default completely
|
|
248
|
+
- **Group middleware accumulates** — nested groups combine all parent middleware
|
|
249
|
+
- **Request body parsed before middleware** — Laravel-style methods (`.input()`, `.query`, `.file()`) are available in middleware
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-migrations
|
|
3
|
+
description: Use when working with database migrations in a Stacks application — creating migration files, running migrations, fresh migration (drop + recreate), seeding after migration, migration file naming conventions, or the 96+ built-in migration files. For the database API itself (queries, connections, SQL helpers), see stacks-database.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript, SQLite >= 3.47.2
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Stacks Database Migrations
|
|
10
|
+
|
|
11
|
+
Schema change management via migration files.
|
|
12
|
+
|
|
13
|
+
## Key Paths
|
|
14
|
+
- Migration files: `database/migrations/` (96+ files)
|
|
15
|
+
- Database config: `config/database.ts`
|
|
16
|
+
|
|
17
|
+
## CLI Commands
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
buddy migrate # run pending migrations
|
|
21
|
+
buddy migrate --diff # show SQL without running
|
|
22
|
+
buddy migrate --auth # include auth tables
|
|
23
|
+
buddy migrate:fresh # drop ALL tables and re-migrate
|
|
24
|
+
buddy migrate:fresh --seed # drop, migrate, then seed
|
|
25
|
+
buddy migrate:dns # DNS-specific migration
|
|
26
|
+
buddy make:migration <name> # create new migration file
|
|
27
|
+
buddy seed # seed database
|
|
28
|
+
buddy generate:migrations # generate migrations from model diffs
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Creating a Migration
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
buddy make:migration create_orders_table
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Creates a timestamped migration file in `database/migrations/`.
|
|
38
|
+
|
|
39
|
+
## Migration Generation from Models
|
|
40
|
+
|
|
41
|
+
When you define or modify a model, generate migrations automatically:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
buddy generate:migrations
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
This diffs model definitions against the current schema and generates the necessary SQL.
|
|
48
|
+
|
|
49
|
+
## Built-in Migrations (96+)
|
|
50
|
+
|
|
51
|
+
The framework includes migrations for all built-in models:
|
|
52
|
+
|
|
53
|
+
### Core Tables
|
|
54
|
+
- `users` — id, name, email (unique), password, timestamps
|
|
55
|
+
- `personal_access_tokens` — auth tokens
|
|
56
|
+
- `passkeys` — WebAuthn credentials
|
|
57
|
+
- `password_resets` — password reset tokens
|
|
58
|
+
|
|
59
|
+
### Content
|
|
60
|
+
- `posts` — title, content, excerpt, views, status, published_at, author_id
|
|
61
|
+
- `pages`, `categories`, `tags`, `comments`
|
|
62
|
+
- `authors` — linked to users
|
|
63
|
+
|
|
64
|
+
### Commerce (20+ tables)
|
|
65
|
+
- `products`, `product_variants`, `product_units`
|
|
66
|
+
- `orders`, `order_items`
|
|
67
|
+
- `carts`, `cart_items`
|
|
68
|
+
- `coupons`, `gift_cards`, `reviews`
|
|
69
|
+
- `customers`, `manufacturers`
|
|
70
|
+
|
|
71
|
+
### Payments
|
|
72
|
+
- `payments`, `payment_methods`, `payment_products`, `payment_transactions`
|
|
73
|
+
- `subscriptions`, `transactions`
|
|
74
|
+
|
|
75
|
+
### Shipping
|
|
76
|
+
- `shipping_methods`, `shipping_rates`, `shipping_zones`
|
|
77
|
+
- `delivery_routes`, `drivers`
|
|
78
|
+
|
|
79
|
+
### System
|
|
80
|
+
- `jobs`, `failed_jobs` — queue tables
|
|
81
|
+
- `errors`, `logs`, `notifications`
|
|
82
|
+
- `activities`, `requests`, `websockets`
|
|
83
|
+
|
|
84
|
+
### Indexes
|
|
85
|
+
- `users.email` (unique), `users(email, name)` (composite)
|
|
86
|
+
- `subscribers.email` (unique)
|
|
87
|
+
- `coupons.code` (unique), `gift_cards.code` (unique)
|
|
88
|
+
- `payments.transaction_id` (unique)
|
|
89
|
+
- `subscriptions.provider_id` (unique)
|
|
90
|
+
|
|
91
|
+
## Workflow
|
|
92
|
+
|
|
93
|
+
1. Define/modify model in `storage/framework/defaults/app/Models/` or `app/Models/`
|
|
94
|
+
2. Run `buddy generate:migrations` to generate SQL diffs
|
|
95
|
+
3. Review generated migration files
|
|
96
|
+
4. Run `buddy migrate` to apply
|
|
97
|
+
|
|
98
|
+
## Gotchas
|
|
99
|
+
- `migrate:fresh` drops ALL tables — only use in development
|
|
100
|
+
- Migrations run in filename order (timestamps ensure correct sequence)
|
|
101
|
+
- Never edit a migration that's been run in production — create a new one
|
|
102
|
+
- `--seed` flag after `migrate:fresh` seeds the database with factory data
|
|
103
|
+
- 96+ migration files exist by default for all framework models
|
|
104
|
+
- SQLite >= 3.47.2 is required (system requirement)
|
|
105
|
+
- For the database API (queries, connections), see the `stacks-database` skill
|