@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,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-dashboard
|
|
3
|
+
description: Use when building or customizing the Stacks admin dashboard — adding dashboard pages, model management views, analytics widgets, commerce dashboards, content management, settings panels, deployment monitoring, job/queue management, or the 150+ built-in dashboard components. Covers the dashboard system at storage/framework/defaults/.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Stacks Dashboard
|
|
10
|
+
|
|
11
|
+
The Stacks admin dashboard provides a full-featured admin panel with 136+ routes, 150+ components, and multi-section layout.
|
|
12
|
+
|
|
13
|
+
## Key Paths
|
|
14
|
+
- Dashboard pages: `storage/framework/defaults/views/dashboard/`
|
|
15
|
+
- Dashboard components: `storage/framework/defaults/resources/components/Dashboard/`
|
|
16
|
+
- Dashboard views: `storage/framework/defaults/views/dashboard/`
|
|
17
|
+
- Dashboard layouts: `storage/framework/defaults/views/dashboard/layouts/`
|
|
18
|
+
- Dashboard actions: `storage/framework/defaults/app/Actions/Dashboard/`
|
|
19
|
+
- Configuration: `config/ui.ts`
|
|
20
|
+
|
|
21
|
+
## Dashboard Sections
|
|
22
|
+
|
|
23
|
+
### Analytics & Monitoring
|
|
24
|
+
- `/dashboard` — main dashboard overview
|
|
25
|
+
- `/dashboard/analytics` — analytics widgets and charts
|
|
26
|
+
- `/dashboard/requests` — HTTP request analytics (method, path, status, duration)
|
|
27
|
+
- `/dashboard/errors` — error tracking and analysis
|
|
28
|
+
- `/dashboard/jobs` — background job monitoring
|
|
29
|
+
- `/dashboard/queue` — queue management and metrics
|
|
30
|
+
|
|
31
|
+
### Commerce
|
|
32
|
+
- `/dashboard/commerce/products` — product management (CRUD, variants, units)
|
|
33
|
+
- `/dashboard/commerce/orders` — order management and processing
|
|
34
|
+
- `/dashboard/commerce/customers` — customer profiles and history
|
|
35
|
+
- `/dashboard/commerce/payments` — payment tracking
|
|
36
|
+
- `/dashboard/commerce/coupons` — coupon and promotion management
|
|
37
|
+
- `/dashboard/commerce/gift-cards` — gift card management
|
|
38
|
+
- `/dashboard/commerce/shipping` — shipping methods, rates, zones
|
|
39
|
+
- `/dashboard/commerce/tax-rates` — tax rate configuration
|
|
40
|
+
- `/dashboard/commerce/reviews` — product review moderation
|
|
41
|
+
- `/dashboard/commerce/loyalty` — loyalty points and rewards
|
|
42
|
+
- `/dashboard/commerce/delivery` — delivery route tracking
|
|
43
|
+
- `/dashboard/commerce/waitlists` — product waitlist management
|
|
44
|
+
- `/dashboard/commerce/receipts` — receipt management
|
|
45
|
+
|
|
46
|
+
### Content Management
|
|
47
|
+
- `/dashboard/content/posts` — blog post CRUD
|
|
48
|
+
- `/dashboard/content/pages` — page management
|
|
49
|
+
- `/dashboard/content/authors` — author profiles
|
|
50
|
+
- `/dashboard/content/categories` — content categorization
|
|
51
|
+
- `/dashboard/content/tags` — tag management
|
|
52
|
+
- `/dashboard/content/comments` — comment moderation
|
|
53
|
+
|
|
54
|
+
### Data Management
|
|
55
|
+
- `/dashboard/data/users` — user management (highlighted model)
|
|
56
|
+
- `/dashboard/data/subscribers` — subscriber management
|
|
57
|
+
- `/dashboard/data/teams` — team management
|
|
58
|
+
- `/dashboard/data/notifications` — notification history
|
|
59
|
+
|
|
60
|
+
### Marketing
|
|
61
|
+
- `/dashboard/marketing/campaigns` — campaign management
|
|
62
|
+
- `/dashboard/marketing/email-lists` — email list management
|
|
63
|
+
- `/dashboard/marketing/social` — social post management
|
|
64
|
+
|
|
65
|
+
### Library
|
|
66
|
+
- `/dashboard/library/components` — component browser
|
|
67
|
+
- `/dashboard/library/functions` — function registry
|
|
68
|
+
- `/dashboard/library/releases` — release management
|
|
69
|
+
|
|
70
|
+
### Settings (20+ panels)
|
|
71
|
+
- `/dashboard/settings/ai` — AI/LLM configuration
|
|
72
|
+
- `/dashboard/settings/analytics` — analytics settings
|
|
73
|
+
- `/dashboard/settings/app` — application settings
|
|
74
|
+
- `/dashboard/settings/cache` — cache configuration
|
|
75
|
+
- `/dashboard/settings/cloud` — cloud/deployment settings
|
|
76
|
+
- `/dashboard/settings/database` — database configuration
|
|
77
|
+
- `/dashboard/settings/dns` — DNS management
|
|
78
|
+
- `/dashboard/settings/email` — email settings
|
|
79
|
+
- `/dashboard/settings/environment` — environment variables
|
|
80
|
+
- `/dashboard/settings/hashing` — hashing configuration
|
|
81
|
+
- `/dashboard/settings/logging` — logging settings
|
|
82
|
+
- `/dashboard/settings/notifications` — notification settings
|
|
83
|
+
- `/dashboard/settings/payment` — payment/Stripe settings
|
|
84
|
+
- `/dashboard/settings/ports` — port configuration
|
|
85
|
+
- `/dashboard/settings/queue` — queue settings
|
|
86
|
+
- `/dashboard/settings/search-engine` — search settings
|
|
87
|
+
- `/dashboard/settings/security` — security/firewall settings
|
|
88
|
+
- `/dashboard/settings/services` — third-party services
|
|
89
|
+
- `/dashboard/settings/storage` — storage configuration
|
|
90
|
+
- `/dashboard/settings/team` — team settings
|
|
91
|
+
- `/dashboard/settings/ui` — UI configuration
|
|
92
|
+
|
|
93
|
+
### Deployments
|
|
94
|
+
- `/dashboard/deployments` — deployment history and monitoring
|
|
95
|
+
- `/dashboard/deployments/scripts` — deployment scripts
|
|
96
|
+
- `/dashboard/deployments/live-terminal` — live terminal output
|
|
97
|
+
|
|
98
|
+
### Utilities
|
|
99
|
+
- `/dashboard/maintenance` — maintenance mode toggle
|
|
100
|
+
|
|
101
|
+
## Dashboard Components (150+)
|
|
102
|
+
|
|
103
|
+
### Layout Components
|
|
104
|
+
- `DashboardNavbar` — top navigation bar
|
|
105
|
+
- `DashboardSidebar` — side navigation
|
|
106
|
+
- `DashboardLayout` — main layout wrapper
|
|
107
|
+
|
|
108
|
+
### UI Components
|
|
109
|
+
- Buttons, Modals, Toasts, Alerts, Dropdowns
|
|
110
|
+
- Tables with sorting, filtering, pagination
|
|
111
|
+
- Forms with validation
|
|
112
|
+
- Charts and analytics widgets
|
|
113
|
+
- File upload components
|
|
114
|
+
- Rich text editors
|
|
115
|
+
|
|
116
|
+
### Feature Components
|
|
117
|
+
- `ProductForm`, `ProductList`, `ProductVariants`
|
|
118
|
+
- `OrderTable`, `OrderDetail`, `OrderStatusUpdate`
|
|
119
|
+
- `UserTable`, `UserForm`, `UserProfile`
|
|
120
|
+
- `PostEditor`, `PostList`, `PostPublish`
|
|
121
|
+
- `CouponForm`, `CouponList`
|
|
122
|
+
- `EmailCompose`, `EmailList`, `EmailDetail`
|
|
123
|
+
- `DeploymentHistory`, `LiveTerminal`
|
|
124
|
+
- `JobMonitor`, `QueueStatus`
|
|
125
|
+
- `SettingsForm` (generic, used by all settings pages)
|
|
126
|
+
|
|
127
|
+
## Dashboard Actions
|
|
128
|
+
|
|
129
|
+
Located in `storage/framework/defaults/app/Actions/Dashboard/`:
|
|
130
|
+
- Settings actions — Get/Update for each settings category
|
|
131
|
+
- Commerce actions — CRUD operations for all commerce models
|
|
132
|
+
- Content actions — CRUD operations for content models
|
|
133
|
+
- Data actions — User count, subscriber count, metrics
|
|
134
|
+
- Deployment actions — Create, get, update deployments
|
|
135
|
+
- Job actions — Create, get, metrics
|
|
136
|
+
- Notification actions — Create, get, delivery rate
|
|
137
|
+
- Request actions — Analytics data
|
|
138
|
+
|
|
139
|
+
## Model Dashboard Integration
|
|
140
|
+
|
|
141
|
+
Models with `dashboard: { highlight: true }` appear prominently:
|
|
142
|
+
```typescript
|
|
143
|
+
defineModel({
|
|
144
|
+
name: 'Product',
|
|
145
|
+
dashboard: { highlight: true }, // highlighted in dashboard
|
|
146
|
+
traits: {
|
|
147
|
+
useApi: { uri: 'products', routes: ['index', 'store', 'show', 'update', 'destroy'] }
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
The `useApi` trait auto-generates dashboard CRUD views for the model.
|
|
153
|
+
|
|
154
|
+
## Dashboard Development
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
buddy dev --dashboard # start dashboard dev server
|
|
158
|
+
buddy dev -d # alias
|
|
159
|
+
buddy build:components # build dashboard components
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Port: 3002 (configured in `config/ports.ts` as `admin`)
|
|
163
|
+
|
|
164
|
+
## Gotchas
|
|
165
|
+
- Dashboard runs on port 3002 by default (separate from frontend on 3000)
|
|
166
|
+
- Dashboard components use STX templating with crosswind CSS
|
|
167
|
+
- Dashboard routes are registered from `storage/framework/defaults/routes/`, not from a generated type file
|
|
168
|
+
- Settings panels read/write from the corresponding `config/*.ts` files
|
|
169
|
+
- Models with `useApi` trait get auto-generated dashboard views
|
|
170
|
+
- `dashboard: { highlight: true }` makes models prominent in the dashboard
|
|
171
|
+
- Dashboard layout uses a sidebar + navbar pattern
|
|
172
|
+
- All dashboard actions are in `storage/framework/defaults/app/Actions/Dashboard/`
|
|
173
|
+
- The live terminal component streams deployment output in real-time
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-database
|
|
3
|
+
description: Use when working with databases in a Stacks application — configuring connections, running queries, migrations, seeding, SQL helpers, or using SQLite/MySQL/PostgreSQL/DynamoDB. Covers @stacksjs/database, bun-query-builder, config/database.ts, and the database/ migrations directory.
|
|
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
|
|
10
|
+
|
|
11
|
+
## Key Paths
|
|
12
|
+
- Database package: `storage/framework/core/database/src/`
|
|
13
|
+
- Configuration: `config/database.ts`
|
|
14
|
+
- QB config: `config/query-builder.ts`
|
|
15
|
+
- Migrations: `database/migrations/` (96+ migration files, `.sql` format)
|
|
16
|
+
- QB state: `.qb/`
|
|
17
|
+
- ORM: `storage/framework/orm/`
|
|
18
|
+
|
|
19
|
+
## Source Files
|
|
20
|
+
```
|
|
21
|
+
database/src/
|
|
22
|
+
├── database.ts # Database class + factory functions
|
|
23
|
+
├── driver-config.ts # Driver types, defaults, validation, env detection
|
|
24
|
+
├── defaults.ts # DB_HOST_DEFAULT, DB_PORTS, DB_NAMES, DB_USERS constants
|
|
25
|
+
├── utils.ts # Lazy `db` proxy (main query builder entry point)
|
|
26
|
+
├── types.ts # sql template tag, Generated/Insertable/Updateable types
|
|
27
|
+
├── sql-helpers.ts # Cross-dialect helpers (now/boolTrue/param/etc.)
|
|
28
|
+
├── migrations.ts # runDatabaseMigration, resetDatabase, generateMigrations
|
|
29
|
+
├── seeder.ts # seed, seedModel$, freshSeed, listSeedableModels
|
|
30
|
+
├── validators.ts # Column type inference from validator types
|
|
31
|
+
├── column.ts # Column definition helpers
|
|
32
|
+
├── schema.ts # Schema definition helpers
|
|
33
|
+
├── table.ts # Table definition helpers
|
|
34
|
+
├── query-parser.ts # Query parsing utilities
|
|
35
|
+
├── query-logger.ts # Query logging/monitoring
|
|
36
|
+
├── auth-tables.ts # Auth-related table migrations (OAuth, passkeys)
|
|
37
|
+
├── custom/ # Custom migrations (jobs.ts, errors.ts)
|
|
38
|
+
├── drivers/ # sqlite.ts, mysql.ts, postgres.ts, dynamodb.ts
|
|
39
|
+
│ └── defaults/ # Default migration helpers (traits.ts, passwords.ts)
|
|
40
|
+
└── index.ts # Re-exports everything
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Database Class (database.ts)
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
const db = new Database(options: DatabaseOptions)
|
|
47
|
+
db.driver // 'sqlite' | 'mysql' | 'postgres'
|
|
48
|
+
db.connection // DatabaseConnectionConfig
|
|
49
|
+
db.isInitialized
|
|
50
|
+
db.query // QueryBuilder (lazy-initialized via createQueryBuilder())
|
|
51
|
+
db.initialize() // Calls setConfig() + createQueryBuilder() from bun-query-builder
|
|
52
|
+
db.switchDriver(driver, connection) // Close + reinitialize with new driver
|
|
53
|
+
db.close() // Close connection, reset state
|
|
54
|
+
|
|
55
|
+
// Static factories
|
|
56
|
+
Database.fromConfig(config, env?) // From stacks config object
|
|
57
|
+
Database.fromEnv() // From env vars (DB_CONNECTION, DB_DATABASE, etc.)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Factory Functions (database.ts)
|
|
61
|
+
- `createDatabase(options: DatabaseOptions): Database`
|
|
62
|
+
- `createSqliteDatabase(database: string, options?): Database`
|
|
63
|
+
- `createPostgresDatabase(connection: DatabaseConnectionConfig, options?): Database`
|
|
64
|
+
- `createMysqlDatabase(connection: DatabaseConnectionConfig, options?): Database`
|
|
65
|
+
|
|
66
|
+
## Driver Configuration (driver-config.ts)
|
|
67
|
+
- `detectDriver(): SupportedDialect` -- checks `DB_CONNECTION` env, then `DATABASE_URL` prefix, defaults to `'sqlite'`
|
|
68
|
+
- `validateDriverConfig(driver, config): { valid: boolean, errors: string[] }`
|
|
69
|
+
- `mergeWithDefaults(driver, config): Config`
|
|
70
|
+
- `getConfigFromEnv(driver): Config` -- reads `DB_DATABASE`, `DB_HOST`, `DB_PORT`, `DB_USERNAME`, `DB_PASSWORD`, `DB_PREFIX`, `DB_SCHEMA`
|
|
71
|
+
- `getConnectionString(driver, config): string` -- builds `sqlite://`, `mysql://`, `postgres://` URL
|
|
72
|
+
|
|
73
|
+
## Global `db` Instance (utils.ts)
|
|
74
|
+
|
|
75
|
+
The `db` export is a **lazy Proxy** that auto-initializes on first property access:
|
|
76
|
+
1. At module load: reads env vars via `@stacksjs/env`, calls `setConfig()` on bun-query-builder
|
|
77
|
+
2. Background: attempts `import('@stacksjs/config')` to override with app config
|
|
78
|
+
3. On first property access: calls `createQueryBuilder()` from bun-query-builder
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import { db } from '@stacksjs/database'
|
|
82
|
+
|
|
83
|
+
// db auto-initializes here
|
|
84
|
+
const users = await db.selectFrom('users').where('active', '=', true).get()
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`initializeDbConfig(config)` can be called to update the backing config at runtime.
|
|
88
|
+
|
|
89
|
+
## SQL Template Tag (types.ts)
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
import { sql } from '@stacksjs/database'
|
|
93
|
+
|
|
94
|
+
const query = sql`SELECT * FROM users WHERE id = ${userId}`
|
|
95
|
+
// Returns: { sql: 'SELECT * FROM users WHERE id = ?', parameters: [userId] }
|
|
96
|
+
|
|
97
|
+
sql.raw('NOW()') // Raw SQL (NOT parameterized) -- returns { raw: 'NOW()' }
|
|
98
|
+
sql.ref('users.name') // Column reference -- returns { raw: 'users.name' }
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
How it works: template values are replaced with `?` placeholders and collected into `parameters[]`. Values wrapped in `sql.raw()` or `sql.ref()` are inlined directly into the SQL string.
|
|
102
|
+
|
|
103
|
+
## SQL Dialect Helpers (sql-helpers.ts)
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import { sqlHelpers } from '@stacksjs/database'
|
|
107
|
+
|
|
108
|
+
const h = sqlHelpers('sqlite') // or 'mysql' or 'postgres'
|
|
109
|
+
h.isPostgres // false
|
|
110
|
+
h.isMysql // false
|
|
111
|
+
h.isSqlite // true
|
|
112
|
+
h.now // "datetime('now')" for sqlite, 'NOW()' for mysql/postgres
|
|
113
|
+
h.boolTrue // '1' for sqlite/mysql, 'true' for postgres
|
|
114
|
+
h.boolFalse // '0' for sqlite/mysql, 'false' for postgres
|
|
115
|
+
h.autoIncrement // 'INTEGER' for sqlite, 'SERIAL' for postgres
|
|
116
|
+
h.primaryKey // 'PRIMARY KEY AUTOINCREMENT' | 'PRIMARY KEY AUTO_INCREMENT' | 'PRIMARY KEY'
|
|
117
|
+
h.param(1) // '?' for sqlite/mysql, '$1' for postgres
|
|
118
|
+
h.params('a', 'b') // { sql: '?, ?', values: ['a', 'b'] } or { sql: '$1, $2', values: ['a', 'b'] }
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Connection Defaults (defaults.ts)
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
DB_HOST_DEFAULT = '127.0.0.1'
|
|
125
|
+
DB_PORTS = { mysql: 3306, postgres: 5432, sqlite: 0 }
|
|
126
|
+
DB_NAMES = { default: 'stacks', sqlitePath: 'database/stacks.sqlite', sqliteTestingPath: 'database/stacks_testing.sqlite' }
|
|
127
|
+
DB_USERS = { mysql: 'root', postgres: 'postgres', sqlite: '' }
|
|
128
|
+
REDIS_DEFAULTS = { host: 'localhost', port: 6379 }
|
|
129
|
+
AWS_DEFAULTS = { region: 'us-east-1' }
|
|
130
|
+
|
|
131
|
+
getConnectionDefaults(driver: string, envProxy?): ConnectionDefaults
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## DatabaseOptions Type (database.ts)
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
interface DatabaseOptions {
|
|
138
|
+
driver: 'sqlite' | 'mysql' | 'postgres'
|
|
139
|
+
connection: { database: string, host?: string, port?: number, username?: string, password?: string, url?: string }
|
|
140
|
+
verbose?: boolean
|
|
141
|
+
timestamps?: { createdAt?: string, updatedAt?: string, defaultOrderColumn?: string }
|
|
142
|
+
softDeletes?: { enabled?: boolean, column?: string, defaultFilter?: boolean }
|
|
143
|
+
hooks?: QueryBuilderConfig['hooks']
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Connection Types (driver-config.ts)
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
interface SqliteConfig { database: string, prefix?: string }
|
|
151
|
+
interface MysqlConfig { name: string, host?: string, port?: number, username?: string, password?: string, prefix?: string, charset?: string, collation?: string }
|
|
152
|
+
interface PostgresConfig { name: string, host?: string, port?: number, username?: string, password?: string, prefix?: string, schema?: string, sslMode?: 'disable' | 'require' | 'verify-ca' | 'verify-full' }
|
|
153
|
+
interface DynamoDbConfig { key: string, secret: string, region?: string, prefix?: string, endpoint?: string, tableName?: string, singleTable?: { enabled?, pkAttribute?, skAttribute?, entityTypeAttribute?, keyDelimiter?, gsiCount? } }
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Migrations (migrations.ts)
|
|
157
|
+
|
|
158
|
+
### Migration Functions
|
|
159
|
+
- `runDatabaseMigration(): Promise<Result<string, Error>>` -- ensures DB exists (postgres/mysql), configures QB, preprocesses SQLite migrations, then calls `qbExecuteMigration()`
|
|
160
|
+
- `resetDatabase(): Promise<Result<string, Error>>` -- drops framework tables (OAuth, passkeys, jobs, etc.) then calls `qbResetDatabase()`
|
|
161
|
+
- `generateMigrations(): Promise<Result<string, Error>>` -- compares models to DB state, generates `.sql` diff files
|
|
162
|
+
- `generateMigrations2(): Promise<Result<string, Error>>` -- full regeneration ignoring previous state (`{ full: true }`)
|
|
163
|
+
|
|
164
|
+
### SQLite Migration Preprocessing
|
|
165
|
+
Before running migrations on SQLite, `preprocessSqliteMigrations()`:
|
|
166
|
+
1. Rewrites `ALTER TABLE ADD CONSTRAINT` to no-ops (SQLite does not support this)
|
|
167
|
+
2. Rewrites `CREATE UNIQUE INDEX` to no-ops (redundant when table already has inline UNIQUE)
|
|
168
|
+
3. Filters out `DROP COLUMN` for non-existent columns (checks via `PRAGMA table_info`)
|
|
169
|
+
|
|
170
|
+
### Framework Tables Dropped on Reset
|
|
171
|
+
`oauth_refresh_tokens`, `oauth_access_tokens`, `oauth_clients`, `passkeys`, `failed_jobs`, `jobs`, `notifications`, `password_reset_tokens`
|
|
172
|
+
|
|
173
|
+
## Seeding (seeder.ts)
|
|
174
|
+
|
|
175
|
+
### Seed Functions
|
|
176
|
+
- `seed(config?: SeederConfig): Promise<SeedSummary>` -- loads models from both `storage/framework/defaults/app/Models/` (recursive) and `app/Models/` (flat), user models override defaults by name
|
|
177
|
+
- `seedModel$(modelName, options?): Promise<SeedResult>` -- seed one model by name
|
|
178
|
+
- `freshSeed(config?): Promise<SeedSummary>` -- calls `seed({ ...config, fresh: true })` (truncates before seeding)
|
|
179
|
+
- `listSeedableModels(): Promise<Array<{ name, table, count, source: 'default' | 'user' }>>` -- list without seeding
|
|
180
|
+
|
|
181
|
+
### SeederConfig
|
|
182
|
+
```typescript
|
|
183
|
+
interface SeederConfig {
|
|
184
|
+
modelsDir?: string // defaults to path.userModelsPath()
|
|
185
|
+
defaultCount?: number // default 10
|
|
186
|
+
verbose?: boolean // default true
|
|
187
|
+
fresh?: boolean // truncate tables first
|
|
188
|
+
only?: string[] // specific models to seed
|
|
189
|
+
except?: string[] // models to exclude
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Seeding Behavior
|
|
194
|
+
- Models must have `traits.useSeeder` (or `traits.seedable`) set to `true` or `{ count: N }`
|
|
195
|
+
- Attributes with `factory: (faker) => ...` generate fake data via `@stacksjs/faker`
|
|
196
|
+
- Password fields are auto-detected (by name pattern or `hidden: true` + name includes "pass") and hashed with bcrypt
|
|
197
|
+
- Field names are converted from camelCase to snake_case for DB columns
|
|
198
|
+
- Records inserted in batches of 100
|
|
199
|
+
- Models sorted by dependency: User (0), Team (1), Project (2), everything else (10)
|
|
200
|
+
- Missing tables are skipped gracefully
|
|
201
|
+
|
|
202
|
+
### SeedResult / SeedSummary
|
|
203
|
+
```typescript
|
|
204
|
+
interface SeedResult { model: string, table: string, count: number, success: boolean, error?: string, duration: number }
|
|
205
|
+
interface SeedSummary { total: number, successful: number, failed: number, results: SeedResult[], duration: number }
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Validator Type Guards (validators.ts)
|
|
209
|
+
`isStringValidator`, `isNumberValidator`, `enumValidator`, `isBooleanValidator`, `isDateValidator`, `isUnixValidator`, `isFloatValidator`, `isDatetimeValidator`, `isTimestampValidator`, `isTimestampTzValidator`, `isDecimalValidator`, `isSmallintValidator`, `isIntegerValidator`, `isBigintValidator`, `isBinaryValidator`, `isBlobValidator`, `isJsonValidator`
|
|
210
|
+
|
|
211
|
+
- `checkValidator(validator, driver): string` -- converts validator type to SQL column type string (e.g., `'integer'`, `'text'`, `'varchar(255)'`)
|
|
212
|
+
- SQLite uses `'text'` for all strings, `'integer'` for numbers; MySQL uses `'varchar(N)'`, native `enum()`
|
|
213
|
+
|
|
214
|
+
## DynamoDB Support (drivers/dynamodb.ts)
|
|
215
|
+
Entity-centric API for single-table design:
|
|
216
|
+
- `createDynamo(config)`, `dynamo` (default instance)
|
|
217
|
+
- `EntityQueryBuilder` -- query builder for DynamoDB entities
|
|
218
|
+
- `generateKeyPattern`, `parseKeyPattern`, `buildKey` -- key pattern utilities
|
|
219
|
+
- `marshall`, `unmarshall` -- DynamoDB data type conversion
|
|
220
|
+
|
|
221
|
+
## Re-exports from bun-query-builder
|
|
222
|
+
- `createQueryBuilder`, `setConfig` -- core QB functions
|
|
223
|
+
- `QueryBuilder`, `QueryBuilderConfig`, `Seeder`, `SupportedDialect` -- types
|
|
224
|
+
|
|
225
|
+
## Compatibility Type Aliases (types.ts)
|
|
226
|
+
- `Generated<T>`, `GeneratedAlways<T>` -- column generation markers (both alias to `T`)
|
|
227
|
+
- `Insertable<T>`, `Selectable<T>`, `Updateable<T>` -- CRUD type utilities
|
|
228
|
+
- `RawBuilder<T>`, `Sql` -- raw SQL expression types
|
|
229
|
+
|
|
230
|
+
## CLI Commands
|
|
231
|
+
- `buddy migrate` -- run pending migrations
|
|
232
|
+
- `buddy migrate:fresh` -- drop all + re-migrate (add `--seed` to also seed)
|
|
233
|
+
- `buddy make:migration <name>` -- create migration file
|
|
234
|
+
- `buddy seed` -- seed database
|
|
235
|
+
- `buddy generate:migrations` -- generate migration diffs from models
|
|
236
|
+
|
|
237
|
+
## config/database.ts Shape
|
|
238
|
+
```typescript
|
|
239
|
+
{
|
|
240
|
+
default: env.DB_CONNECTION || 'mysql',
|
|
241
|
+
connections: { sqlite, mysql, postgres, dynamodb },
|
|
242
|
+
migrations: 'migrations',
|
|
243
|
+
migrationLocks: 'migration_locks',
|
|
244
|
+
queryLogging: {
|
|
245
|
+
enabled: true,
|
|
246
|
+
slowThreshold: 100, // ms
|
|
247
|
+
retention: 7, // days
|
|
248
|
+
pruneFrequency: 24, // hours
|
|
249
|
+
excludedQueries: ['query_logs'],
|
|
250
|
+
analysis: { enabled: true, analyzeAll: false, explainPlan: true, suggestions: true }
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## config/query-builder.ts (Query Builder Config)
|
|
256
|
+
```typescript
|
|
257
|
+
{
|
|
258
|
+
verbose: true,
|
|
259
|
+
dialect: env.DB_CONNECTION || 'sqlite',
|
|
260
|
+
database: { database, username?, password?, host?, port? },
|
|
261
|
+
timestamps: { createdAt: 'created_at', updatedAt: 'updated_at', defaultOrderColumn: 'created_at' },
|
|
262
|
+
pagination: { defaultPerPage: 25, cursorColumn: 'id' },
|
|
263
|
+
aliasing: { relationColumnAliasFormat: 'table_column' },
|
|
264
|
+
relations: { foreignKeyFormat: 'singularParent_id', maxDepth: 10, maxEagerLoad: 50, detectCycles: true },
|
|
265
|
+
transactionDefaults: { retries: 2, isolation: 'read committed', sqlStates: ['40001', '40P01'], backoff: { baseMs: 50, factor: 2, maxMs: 2000, jitter: true } },
|
|
266
|
+
sql: { randomFunction: 'RANDOM()', sharedLockSyntax: 'FOR SHARE', jsonContainsMode: 'operator' },
|
|
267
|
+
features: { distinctOn: true },
|
|
268
|
+
debug: { captureText: true },
|
|
269
|
+
softDeletes: { enabled: false, column: 'deleted_at', defaultFilter: true }
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Gotchas
|
|
274
|
+
- The actual default driver in `config/database.ts` is `'mysql'` (not `'sqlite'`), but `utils.ts` and `driver-config.ts` fall back to `'sqlite'` when `DB_CONNECTION` is unset
|
|
275
|
+
- The `db` export is a lazy Proxy -- it auto-initializes on first property access, which means errors are deferred until first use
|
|
276
|
+
- Query builder config lives in `config/query-builder.ts`, and reads `DB_CONNECTION` / `DB_*` from the env - it is not a second copy of `config/database.ts`
|
|
277
|
+
- The `.qb/` directory at project root stores query builder state for migration diffing
|
|
278
|
+
- `resetDatabase()` drops ALL tables including framework tables (OAuth, passkeys, jobs, etc.) -- only use in development
|
|
279
|
+
- `freshSeed()` truncates tables before seeding using `deleteFrom()` (not `DROP TABLE`)
|
|
280
|
+
- SQLite migration preprocessing mutates `.sql` files in-place (rewrites them to no-ops)
|
|
281
|
+
- The `ensureDatabaseExists()` function connects to admin DB (`postgres` or `mysql`) to run `CREATE DATABASE` before switching to the target DB
|
|
282
|
+
- `Database.fromConfig()` appends `_testing` to database name/path when `env === 'testing'`
|
|
283
|
+
- DynamoDB support uses a separate entity-centric API, not the standard query builder
|
|
284
|
+
- Soft deletes are disabled by default in qb.ts config (`enabled: false`)
|
|
285
|
+
- Transaction defaults: 2 retries, `read committed` isolation, with exponential backoff + jitter
|
|
286
|
+
- The ORM lives in TWO locations: `storage/framework/core/orm/` (package) and `storage/framework/orm/` (implementation)
|