@stacksjs/defaults 0.70.207 → 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,442 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-realtime
|
|
3
|
+
description: Use when implementing real-time features in Stacks — WebSocket broadcasting, public/private/presence channels, emit to users, the Channel class, broadcast discovery, server lifecycle, or realtime configuration. Covers @stacksjs/realtime and config/realtime.ts.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Stacks Realtime
|
|
10
|
+
|
|
11
|
+
WebSocket broadcasting via `ts-broadcasting` with channel-based messaging. Provides a Laravel-like API for real-time features.
|
|
12
|
+
|
|
13
|
+
## Key Paths
|
|
14
|
+
- Core package: `storage/framework/core/realtime/src/`
|
|
15
|
+
- Configuration: `config/realtime.ts`
|
|
16
|
+
- Application broadcasts: `app/Broadcasts/`
|
|
17
|
+
|
|
18
|
+
## Source Files
|
|
19
|
+
```
|
|
20
|
+
realtime/src/
|
|
21
|
+
index.ts # re-exports ts-broadcasting + all Stacks-specific exports
|
|
22
|
+
emit.ts # emit(), emitToUser(), emitToUsers()
|
|
23
|
+
channel.ts # Channel class + channel() factory
|
|
24
|
+
broadcast.ts # Broadcast class + runBroadcast() + broadcast()
|
|
25
|
+
ws.ts # WebSocket request handler (legacy, kept for backward compat)
|
|
26
|
+
server-instance.ts # server lifecycle (createServer/getServer/setServer/stopServer)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Exports (from index.ts)
|
|
30
|
+
|
|
31
|
+
The package re-exports everything from `ts-broadcasting` plus Stacks-specific APIs:
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
// Re-exported from ts-broadcasting
|
|
35
|
+
export * from 'ts-broadcasting'
|
|
36
|
+
|
|
37
|
+
// Server instance management
|
|
38
|
+
export { getServer, setServer, createServer, stopServer } from './server-instance'
|
|
39
|
+
|
|
40
|
+
// Stacks-specific exports
|
|
41
|
+
export { emit, emitToUser, emitToUsers } from './emit'
|
|
42
|
+
export type { EmitOptions } from './emit'
|
|
43
|
+
export { channel as createChannel, Channel as StacksChannel } from './channel'
|
|
44
|
+
export { broadcast as dispatchBroadcast, runBroadcast, Broadcast as LegacyBroadcast } from './broadcast'
|
|
45
|
+
export type { BroadcastInstance } from './broadcast'
|
|
46
|
+
export { setBunSocket, handleWebSocketRequest, storeWebSocketEvent } from './ws'
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Note the renamed exports:
|
|
50
|
+
- `channel()` is exported as `createChannel`
|
|
51
|
+
- `Channel` class is exported as `StacksChannel`
|
|
52
|
+
- `broadcast()` is exported as `dispatchBroadcast`
|
|
53
|
+
- `Broadcast` class is exported as `LegacyBroadcast`
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Emit Functions
|
|
58
|
+
|
|
59
|
+
The primary API for broadcasting events.
|
|
60
|
+
|
|
61
|
+
### `emit(channel, event, data?, options?)` - Broadcast to a channel
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { emit, emitToUser, emitToUsers } from '@stacksjs/realtime'
|
|
65
|
+
|
|
66
|
+
// Broadcast to a public channel
|
|
67
|
+
emit('chat-room', 'new-message', { text: 'Hello', sender: 'John' })
|
|
68
|
+
|
|
69
|
+
// Broadcast to a private channel (auto-prefixes 'private-')
|
|
70
|
+
emit('orders', 'updated', { status: 'shipped' }, { private: true })
|
|
71
|
+
|
|
72
|
+
// Broadcast to a presence channel (auto-prefixes 'presence-')
|
|
73
|
+
emit('room-1', 'user-joined', { userId: 42 }, { presence: true })
|
|
74
|
+
|
|
75
|
+
// Exclude specific socket(s) from receiving
|
|
76
|
+
// NOTE: BroadcastServer only supports single socket exclusion;
|
|
77
|
+
// if array is passed, only the first element is used
|
|
78
|
+
emit('chat', 'typing', data, { exclude: 'socket-id-1' })
|
|
79
|
+
emit('chat', 'typing', data, { exclude: ['socket-id-1', 'socket-id-2'] })
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### EmitOptions interface
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
interface EmitOptions {
|
|
86
|
+
private?: boolean // prefix channel with 'private-'
|
|
87
|
+
presence?: boolean // prefix channel with 'presence-'
|
|
88
|
+
exclude?: string | string[] // socket IDs to exclude (only first used)
|
|
89
|
+
driver?: string // broadcast driver override
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### `emitToUser(userId, event, data?, options?)` - Emit to specific user
|
|
94
|
+
|
|
95
|
+
Sends to `private-user.{userId}` channel. The target user must be subscribed to their own private user channel.
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
// Emit to a specific user (sends to 'private-user.42')
|
|
99
|
+
emitToUser(42, 'notification', { message: 'You have a new order' })
|
|
100
|
+
emitToUser('user-123', 'alert', { type: 'warning', text: 'Session expiring' })
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### `emitToUsers(userIds, event, data?, options?)` - Emit to multiple users
|
|
104
|
+
|
|
105
|
+
Iterates over userIds and calls `emitToUser` for each.
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
// Emit to multiple users
|
|
109
|
+
emitToUsers([42, 43, 44], 'announcement', { text: 'Server maintenance at 3pm' })
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Channel Class
|
|
115
|
+
|
|
116
|
+
Provides a fluent API for broadcasting to channels with explicit channel types.
|
|
117
|
+
|
|
118
|
+
### `channel(name)` - Factory function
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
import { createChannel } from '@stacksjs/realtime'
|
|
122
|
+
// or within the package: import { channel } from './channel'
|
|
123
|
+
|
|
124
|
+
const ch = createChannel('orders')
|
|
125
|
+
|
|
126
|
+
// Broadcast to public channel (no prefix)
|
|
127
|
+
await ch.public('new-order', { id: 1, total: 99.99 })
|
|
128
|
+
|
|
129
|
+
// Broadcast to private channel (auto-prefixes 'private-')
|
|
130
|
+
await ch.private('status-update', { status: 'shipped' })
|
|
131
|
+
|
|
132
|
+
// Broadcast to presence channel (auto-prefixes 'presence-')
|
|
133
|
+
await ch.presence('user-online', { userId: 42 })
|
|
134
|
+
|
|
135
|
+
// Broadcast with explicit type
|
|
136
|
+
await ch.broadcast('event', data, 'private') // type: 'public' | 'private' | 'presence'
|
|
137
|
+
await ch.broadcast('event', data) // defaults to 'public'
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Channel class internals
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
class Channel {
|
|
144
|
+
private channelName: string
|
|
145
|
+
|
|
146
|
+
constructor(channel: string)
|
|
147
|
+
|
|
148
|
+
async private(event: string, data?: any): Promise<void>
|
|
149
|
+
// Prefixes with 'private-' if not already prefixed
|
|
150
|
+
|
|
151
|
+
async public(event: string, data?: any): Promise<void>
|
|
152
|
+
// Uses channelName as-is
|
|
153
|
+
|
|
154
|
+
async presence(event: string, data?: any): Promise<void>
|
|
155
|
+
// Prefixes with 'presence-' if not already prefixed
|
|
156
|
+
|
|
157
|
+
async broadcast(event: string, data?: any, type: ChannelType = 'public'): Promise<void>
|
|
158
|
+
// Dispatches to private(), presence(), or public() based on type
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
All methods throw `Error('Broadcast server not initialized')` if `getServer()` returns null.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Server Lifecycle
|
|
167
|
+
|
|
168
|
+
The server instance is stored as a module-level singleton (`serverInstance`).
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
import { createServer, getServer, setServer, stopServer } from '@stacksjs/realtime'
|
|
172
|
+
import type { ServerConfig, BroadcastServer } from 'ts-broadcasting'
|
|
173
|
+
|
|
174
|
+
// Create and start a new broadcast server
|
|
175
|
+
// Internally: new BroadcastServer(config) -> server.start() -> setServer(server)
|
|
176
|
+
const server: BroadcastServer = await createServer(config)
|
|
177
|
+
|
|
178
|
+
// Get existing server instance (or null)
|
|
179
|
+
const server: BroadcastServer | null = getServer()
|
|
180
|
+
|
|
181
|
+
// Set server instance manually
|
|
182
|
+
setServer(server)
|
|
183
|
+
|
|
184
|
+
// Stop server and set instance to null
|
|
185
|
+
await stopServer()
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
`createServer()` dynamically imports `ts-broadcasting`, instantiates `BroadcastServer`, calls `start()`, stores the instance via `setServer()`, and returns it.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Broadcast Discovery
|
|
193
|
+
|
|
194
|
+
Dynamically loads broadcast files from `app/Broadcasts/` and executes them.
|
|
195
|
+
|
|
196
|
+
### `runBroadcast(name, payload?)` - Run a broadcast file
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
import { runBroadcast, dispatchBroadcast } from '@stacksjs/realtime'
|
|
200
|
+
|
|
201
|
+
// Loads app/Broadcasts/OrderStatusChanged.ts and executes it
|
|
202
|
+
await runBroadcast('OrderStatusChanged', { orderId: 1 })
|
|
203
|
+
|
|
204
|
+
// Alias - identical to runBroadcast
|
|
205
|
+
await dispatchBroadcast('NewMessage', { text: 'Hello' })
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Broadcast file interface
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
interface BroadcastInstance {
|
|
212
|
+
channel?: () => string | string[] // channels to broadcast on
|
|
213
|
+
broadcastOn?: () => string | string[] // alias for channel()
|
|
214
|
+
event?: () => string // event name
|
|
215
|
+
broadcastAs?: () => string // alias for event()
|
|
216
|
+
data?: () => any // data payload
|
|
217
|
+
broadcastWith?: () => any // alias for data()
|
|
218
|
+
handle?: (payload?: any) => Promise<void> | void // custom handler
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### How broadcast discovery works
|
|
223
|
+
|
|
224
|
+
1. Scans `app/Broadcasts/**/*.ts` using `bun.globSync()`
|
|
225
|
+
2. Finds file ending with `{name}.ts`
|
|
226
|
+
3. Imports the module and reads its `default` export
|
|
227
|
+
4. If `handle()` exists, calls it with the payload and returns
|
|
228
|
+
5. Otherwise, reads channel/event/data from the interface methods
|
|
229
|
+
6. Constructs a `BroadcastEvent` and calls `server.broadcaster.broadcast(event)`
|
|
230
|
+
|
|
231
|
+
### Example broadcast file
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
// app/Broadcasts/OrderCreated.ts
|
|
235
|
+
export default {
|
|
236
|
+
broadcastOn: () => ['orders', 'private-admin'],
|
|
237
|
+
broadcastAs: () => 'order.created',
|
|
238
|
+
broadcastWith: () => ({ orderId: 123, total: 99.99 }),
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Or with a custom handler:
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
// app/Broadcasts/UserNotification.ts
|
|
246
|
+
export default {
|
|
247
|
+
handle: async (payload) => {
|
|
248
|
+
const { emit } = await import('@stacksjs/realtime')
|
|
249
|
+
emit(`private-user.${payload.userId}`, 'notification', {
|
|
250
|
+
message: payload.message,
|
|
251
|
+
}, { private: true })
|
|
252
|
+
},
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Legacy/Backward Compatibility
|
|
259
|
+
|
|
260
|
+
### Broadcast class (exported as `LegacyBroadcast`)
|
|
261
|
+
|
|
262
|
+
```typescript
|
|
263
|
+
class Broadcast {
|
|
264
|
+
async connect(): Promise<void> // no-op
|
|
265
|
+
async disconnect(): Promise<void> // no-op
|
|
266
|
+
subscribe(channel, callback): void // warns: use BroadcastClient instead
|
|
267
|
+
unsubscribe(channel): void // warns: use BroadcastClient instead
|
|
268
|
+
broadcast(channel, event, data?, type?): void // delegates to server.broadcast()
|
|
269
|
+
isConnected(): boolean // returns getServer() !== null
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### WebSocket handler (ws.ts)
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
// Deprecated - handled by ts-broadcasting internally
|
|
277
|
+
setBunSocket(server: BroadcastServer | null): void // calls setServer()
|
|
278
|
+
storeWebSocketEvent(type, socket, details): Promise<void> // no-op
|
|
279
|
+
handleWebSocketRequest(req, server): Promise<Response | undefined> // delegates to server.upgrade()
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## config/realtime.ts
|
|
285
|
+
|
|
286
|
+
Full configuration with all options and their defaults:
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
289
|
+
export default {
|
|
290
|
+
enabled: true,
|
|
291
|
+
|
|
292
|
+
// Deployment mode
|
|
293
|
+
mode: 'server' as 'server' | 'serverless',
|
|
294
|
+
// 'server': ts-broadcasting (high-performance Bun WebSocket server)
|
|
295
|
+
// 'serverless': API Gateway WebSocket + Lambda + DynamoDB
|
|
296
|
+
|
|
297
|
+
// Legacy driver option (backward compat)
|
|
298
|
+
driver: 'bun' as 'socket' | 'pusher' | 'bun' | 'reverb' | 'ably',
|
|
299
|
+
|
|
300
|
+
// Server mode config (ts-broadcasting)
|
|
301
|
+
server: {
|
|
302
|
+
host: env.BROADCAST_HOST || '0.0.0.0',
|
|
303
|
+
port: Number(env.BROADCAST_PORT || 6001),
|
|
304
|
+
scheme: 'ws' as 'ws' | 'wss',
|
|
305
|
+
driver: 'bun',
|
|
306
|
+
|
|
307
|
+
redis: {
|
|
308
|
+
enabled: Boolean(env.BROADCAST_REDIS_ENABLED || false),
|
|
309
|
+
host: env.REDIS_HOST || 'localhost',
|
|
310
|
+
port: Number(env.REDIS_PORT || 6379),
|
|
311
|
+
password: env.REDIS_PASSWORD || '',
|
|
312
|
+
prefix: env.BROADCAST_REDIS_PREFIX || 'stacks:realtime:',
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
rateLimit: {
|
|
316
|
+
enabled: true, // env.BROADCAST_RATE_LIMIT_ENABLED
|
|
317
|
+
maxConnectionsPerIp: 100,
|
|
318
|
+
maxMessagesPerSecond: 50,
|
|
319
|
+
maxPayloadSize: 65536, // 64KB
|
|
320
|
+
banDuration: 300, // seconds
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
loadManagement: {
|
|
324
|
+
maxConnections: 10000,
|
|
325
|
+
backpressureThreshold: 1000,
|
|
326
|
+
messageQueueSize: 10000,
|
|
327
|
+
gracefulShutdownTimeout: 30000, // 30s
|
|
328
|
+
},
|
|
329
|
+
|
|
330
|
+
autoScaling: {
|
|
331
|
+
min: 1,
|
|
332
|
+
max: 10,
|
|
333
|
+
targetCPU: 70, // percentage
|
|
334
|
+
},
|
|
335
|
+
|
|
336
|
+
healthCheck: {
|
|
337
|
+
enabled: true,
|
|
338
|
+
path: '/health',
|
|
339
|
+
interval: 30, // seconds
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
metrics: {
|
|
343
|
+
enabled: Boolean(env.BROADCAST_METRICS_ENABLED || false),
|
|
344
|
+
port: 9090,
|
|
345
|
+
path: '/metrics',
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
|
|
349
|
+
// Serverless mode config (API Gateway WebSocket)
|
|
350
|
+
serverless: {
|
|
351
|
+
connectionTimeout: 3600, // 1 hour
|
|
352
|
+
idleTimeout: 600, // 10 minutes
|
|
353
|
+
stageName: env.APP_ENV || 'production',
|
|
354
|
+
memorySize: 256, // MB
|
|
355
|
+
timeout: 30, // seconds
|
|
356
|
+
},
|
|
357
|
+
|
|
358
|
+
// Channel configuration
|
|
359
|
+
channels: {
|
|
360
|
+
public: true,
|
|
361
|
+
private: true,
|
|
362
|
+
presence: {
|
|
363
|
+
enabled: true,
|
|
364
|
+
maxMembersPerChannel: 100,
|
|
365
|
+
memberInfoTtl: 60, // seconds
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
|
|
369
|
+
// App credentials (Pusher-compatible)
|
|
370
|
+
app: {
|
|
371
|
+
id: env.BROADCAST_APP_ID || 'stacks',
|
|
372
|
+
key: env.BROADCAST_APP_KEY || '',
|
|
373
|
+
secret: env.BROADCAST_APP_SECRET || '',
|
|
374
|
+
},
|
|
375
|
+
|
|
376
|
+
// Legacy socket config
|
|
377
|
+
socket: {
|
|
378
|
+
port: Number(env.BROADCAST_PORT || 6001),
|
|
379
|
+
host: env.BROADCAST_HOST || 'localhost',
|
|
380
|
+
cors: {
|
|
381
|
+
origin: env.BROADCAST_CORS_ORIGIN || env.APP_URL || 'http://localhost:3000',
|
|
382
|
+
methods: ['GET', 'POST'],
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
|
|
386
|
+
// Legacy Pusher config
|
|
387
|
+
pusher: {
|
|
388
|
+
appId: env.PUSHER_APP_ID || '',
|
|
389
|
+
key: env.PUSHER_APP_KEY || '',
|
|
390
|
+
secret: env.PUSHER_APP_SECRET || '',
|
|
391
|
+
cluster: env.PUSHER_APP_CLUSTER || 'mt1',
|
|
392
|
+
useTLS: Boolean(env.PUSHER_APP_USE_TLS ?? true),
|
|
393
|
+
},
|
|
394
|
+
|
|
395
|
+
debug: Boolean(env.BROADCAST_DEBUG || false),
|
|
396
|
+
} satisfies RealtimeConfig
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### Environment Variables
|
|
400
|
+
| Variable | Default | Description |
|
|
401
|
+
|---|---|---|
|
|
402
|
+
| `REALTIME_MODE` | `server` | Deployment mode: server or serverless |
|
|
403
|
+
| `BROADCAST_DRIVER` | `bun` | Broadcasting driver |
|
|
404
|
+
| `BROADCAST_HOST` | `0.0.0.0` | Server bind host |
|
|
405
|
+
| `BROADCAST_PORT` | `6001` | Server port |
|
|
406
|
+
| `BROADCAST_SCHEME` | `ws` | WebSocket scheme (ws/wss) |
|
|
407
|
+
| `BROADCAST_REDIS_ENABLED` | `false` | Enable Redis adapter |
|
|
408
|
+
| `REDIS_HOST` | `localhost` | Redis host |
|
|
409
|
+
| `REDIS_PORT` | `6379` | Redis port |
|
|
410
|
+
| `REDIS_PASSWORD` | (empty) | Redis password |
|
|
411
|
+
| `BROADCAST_REDIS_PREFIX` | `stacks:realtime:` | Redis key prefix |
|
|
412
|
+
| `BROADCAST_RATE_LIMIT_ENABLED` | `true` | Enable rate limiting |
|
|
413
|
+
| `BROADCAST_METRICS_ENABLED` | `false` | Enable metrics endpoint |
|
|
414
|
+
| `BROADCAST_APP_ID` | `stacks` | App ID |
|
|
415
|
+
| `BROADCAST_APP_KEY` | (empty) | App key |
|
|
416
|
+
| `BROADCAST_APP_SECRET` | (empty) | App secret |
|
|
417
|
+
| `BROADCAST_CORS_ORIGIN` | APP_URL | CORS origin |
|
|
418
|
+
| `BROADCAST_DEBUG` | `false` | Debug mode |
|
|
419
|
+
| `PUSHER_APP_ID` | (empty) | Pusher app ID |
|
|
420
|
+
| `PUSHER_APP_KEY` | (empty) | Pusher app key |
|
|
421
|
+
| `PUSHER_APP_SECRET` | (empty) | Pusher app secret |
|
|
422
|
+
| `PUSHER_APP_CLUSTER` | `mt1` | Pusher cluster |
|
|
423
|
+
| `PUSHER_APP_USE_TLS` | `true` | Pusher TLS |
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
## Gotchas
|
|
428
|
+
- The server must be created via `createServer()` before `emit()` works -- otherwise it silently logs a warning and returns
|
|
429
|
+
- Channel and Broadcast methods throw errors if the server is not initialized (unlike `emit()` which only warns)
|
|
430
|
+
- Private channels auto-prefix `private-` -- don't add it yourself (the code checks `channel.startsWith('private-')`)
|
|
431
|
+
- Presence channels auto-prefix `presence-` -- same logic applies
|
|
432
|
+
- `emitToUser()` sends to `private-user.{userId}` -- users must subscribe to this channel pattern
|
|
433
|
+
- When using `emit()` with `exclude`, only the first socket ID in an array is used (BroadcastServer limitation)
|
|
434
|
+
- Broadcast files are dynamically imported from `app/Broadcasts/` using `bun.globSync`
|
|
435
|
+
- The `Broadcast` class is legacy -- new code should use `emit()` and `channel()` directly
|
|
436
|
+
- `handleWebSocketRequest()` and `storeWebSocketEvent()` are deprecated -- ws events are tracked internally by ts-broadcasting
|
|
437
|
+
- `setBunSocket()` is deprecated -- use `setServer()` instead
|
|
438
|
+
- Serverless mode uses API Gateway WebSocket for AWS Lambda with DynamoDB for connection management
|
|
439
|
+
- Rate limiting defaults: 100 connections per IP, 50 messages/second, 64KB max payload, 300s ban duration
|
|
440
|
+
- Redis adapter enables horizontal scaling across multiple server instances
|
|
441
|
+
- Auto-scaling config (min/max/targetCPU) is for cloud deployment orchestration
|
|
442
|
+
- The `satisfies RealtimeConfig` type annotation ensures the config matches the expected type from `@stacksjs/types`
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-redesign
|
|
3
|
+
description: Use when auditing and upgrading an existing Stacks UI to premium quality - finding AI-slop and generic patterns in stx templates, then fixing layout, spacing, hierarchy, type, color, states, and copy without breaking functionality or migrating the stack. Composes with stacks-design-taste as the audit-first companion, working in stx + Crosswind + composables.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Redesign an Existing Stacks UI
|
|
10
|
+
|
|
11
|
+
**Related skills:** the audit-first companion to [`stacks-design-taste`](../stacks-design-taste/SKILL.md) (the flagship anti-slop skill). Apply an aesthetic preset with [`stacks-design-soft`](../stacks-design-soft/SKILL.md), [`stacks-design-minimalist`](../stacks-design-minimalist/SKILL.md), or [`stacks-design-brutalist`](../stacks-design-brutalist/SKILL.md). Work in [`stacks-stx`](../stacks-stx/SKILL.md), [`stacks-crosswind`](../stacks-crosswind/SKILL.md), [`stacks-ui`](../stacks-ui/SKILL.md), and [`stacks-composables`](../stacks-composables/SKILL.md).
|
|
12
|
+
|
|
13
|
+
## How This Works
|
|
14
|
+
|
|
15
|
+
When applied to an existing Stacks project, follow this sequence:
|
|
16
|
+
|
|
17
|
+
1. **Scan** - Read the codebase. Confirm the stack is stx + Crosswind + composables. Locate `resources/views/*.stx`, `resources/components/*.stx`, `resources/layouts/*.stx`, `config/ui.ts`, `config/crosswind.ts`, and the `fonts` config. Note current design patterns.
|
|
18
|
+
2. **Diagnose** - Run through the audit below. List every generic pattern, weak point, and missing state you find.
|
|
19
|
+
3. **Fix** - Apply targeted upgrades working with the existing stx + Crosswind stack. Do not rewrite from scratch and do not migrate frameworks. Improve what is there.
|
|
20
|
+
|
|
21
|
+
## Design Audit
|
|
22
|
+
|
|
23
|
+
### Typography
|
|
24
|
+
|
|
25
|
+
Check for these problems and fix them:
|
|
26
|
+
- **Browser default fonts or Inter everywhere.** Replace with a font that has character (`Geist`, `Outfit`, `Cabinet Grotesk`, `Satoshi`). Register the choice in the `fonts` config and load it with `@font-face` / `<link>` + `font-display: swap` in the layout `.stx` head. For editorial/creative projects, pair a serif header with a sans-serif body.
|
|
27
|
+
- **Headlines lack presence.** Increase size for display text, tighten letter-spacing, reduce line-height. Headlines should feel heavy and intentional.
|
|
28
|
+
- **Body text too wide.** Limit paragraph width to roughly 65 characters (`max-w-prose` / `max-w-2xl`). Increase line-height for readability.
|
|
29
|
+
- **Only Regular (400) and Bold (700) weights used.** Introduce Medium (500) and SemiBold (600) for subtler hierarchy.
|
|
30
|
+
- **Numbers in proportional font.** Use a monospace font or enable tabular figures (`tabular-nums` / `font-variant-numeric: tabular-nums`) for data-heavy interfaces.
|
|
31
|
+
- **Missing letter-spacing adjustments.** Negative tracking for large headers, positive tracking for small caps or labels.
|
|
32
|
+
- **All-caps subheaders everywhere.** Try lowercase italics, sentence case, or small-caps instead.
|
|
33
|
+
- **Orphaned words.** Single words alone on the last line. Fix with `text-wrap: balance` or `text-wrap: pretty`.
|
|
34
|
+
|
|
35
|
+
### Color and Surfaces
|
|
36
|
+
|
|
37
|
+
- **Pure `#000000` background.** Replace with off-black, dark charcoal, or tinted dark (`#0a0a0a`, `#121212`, or a dark navy).
|
|
38
|
+
- **Oversaturated accent colors.** Keep saturation below 80%. Desaturate accents so they blend with neutrals instead of screaming.
|
|
39
|
+
- **More than one accent color.** Pick one. Remove the rest. Consistency beats variety.
|
|
40
|
+
- **Mixing warm and cool grays.** Stick to one gray family; tint all grays with a consistent hue.
|
|
41
|
+
- **Purple/blue "AI gradient" aesthetic.** The most common AI design fingerprint. Replace with neutral bases and a single, considered accent.
|
|
42
|
+
- **Generic `box-shadow`.** Tint shadows to match the background hue. Use colored shadows instead of pure black at low opacity.
|
|
43
|
+
- **Flat design with zero texture.** Add subtle noise, grain, or micro-patterns to backgrounds. Pure flat vectors feel sterile.
|
|
44
|
+
- **Perfectly even gradients.** Break uniformity with radial gradients, noise overlays, or mesh gradients instead of standard linear 45-degree fades.
|
|
45
|
+
- **Inconsistent lighting direction.** Audit all shadows to suggest a single, consistent light source.
|
|
46
|
+
- **Random dark sections in a light-mode page (or vice versa).** A single dark-background section breaking an otherwise light page looks like a copy-paste accident. Either commit to full dark mode (`dark:` + `useColorMode()` / `useDark()`) or keep a consistent tone throughout. If contrast is needed, use a slightly darker shade of the same palette, not a sudden jump to `#111` in the middle of a cream page.
|
|
47
|
+
- **Empty, flat sections with no visual depth.** Add high-quality background imagery (blurred, overlaid, or masked), subtle patterns, or ambient gradients. Use `<img>` with explicit `width`/`height` via the stx asset pipeline; placeholder source `https://picsum.photos/seed/{name}/1920/1080`. Even a subtle full-width photo at low opacity adds presence.
|
|
48
|
+
|
|
49
|
+
### Layout
|
|
50
|
+
|
|
51
|
+
- **Everything centered and symmetrical.** Break symmetry with offset margins, mixed aspect ratios, or left-aligned headers over centered content.
|
|
52
|
+
- **Three equal card columns as feature row.** The most generic AI layout. Replace with a 2-column zig-zag, asymmetric grid, horizontal scroll, or masonry layout.
|
|
53
|
+
- **Using `height: 100vh` for full-screen sections.** Replace with `min-h-[100dvh]` to prevent layout jumping on mobile browsers (iOS Safari viewport bug).
|
|
54
|
+
- **Complex flexbox percentage math.** Replace with CSS Grid (`grid` utilities) for reliable multi-column structures.
|
|
55
|
+
- **No max-width container.** Add a container constraint (around `max-w-7xl`, 1200-1440px) with `mx-auto` so content does not stretch edge-to-edge on wide screens.
|
|
56
|
+
- **Cards of equal height forced by flexbox.** Allow variable heights or use masonry when content varies.
|
|
57
|
+
- **Uniform border-radius on everything.** Vary the radius: tighter on inner elements, softer on containers.
|
|
58
|
+
- **No overlap or depth.** Use negative margins to create layering and visual depth.
|
|
59
|
+
- **Symmetrical vertical padding.** Adjust optically; bottom padding often needs to be slightly larger.
|
|
60
|
+
- **Dashboard always has a left sidebar.** Try top navigation, a floating command menu, or a collapsible panel instead.
|
|
61
|
+
- **Missing whitespace.** Double the spacing. Let the design breathe. Dense layouts work for data dashboards, not for marketing pages.
|
|
62
|
+
- **Buttons not bottom-aligned in card groups.** Pin CTAs to the bottom of each card so they form a clean horizontal line regardless of content above.
|
|
63
|
+
- **Feature lists starting at different vertical positions.** In pricing tables or comparison cards, feature lists should start at the same Y position across columns.
|
|
64
|
+
- **Inconsistent vertical rhythm in side-by-side elements.** Align shared elements (titles, descriptions, prices, buttons) across all items. Misaligned baselines make the layout look broken.
|
|
65
|
+
- **Mathematical alignment that looks optically wrong.** Icons next to text, play buttons in circles, or text in buttons often need 1-2px optical adjustments to feel right.
|
|
66
|
+
|
|
67
|
+
### Interactivity and States
|
|
68
|
+
|
|
69
|
+
- **No hover states on buttons.** Add background shift, slight scale, or translate on `hover:`.
|
|
70
|
+
- **No active/pressed feedback.** Add `active:scale-[0.98]` or `active:translate-y-px` to simulate a physical click.
|
|
71
|
+
- **Instant transitions with zero duration.** Add smooth transitions (200-300ms) to all interactive elements.
|
|
72
|
+
- **Missing focus ring.** Ensure visible `focus-visible:` indicators for keyboard navigation. An accessibility requirement, not optional.
|
|
73
|
+
- **No loading states.** Replace generic circular spinners with skeleton loaders that match the layout shape. Drive async state with `useAsync` / `useFetch` / `useQuery`.
|
|
74
|
+
- **No empty states.** Design a composed "getting started" view instead of a blank dashboard.
|
|
75
|
+
- **No error states.** Add clear, inline error messages for forms. Do NOT use `window.alert()` (and never bare `window.*` in stx scripts).
|
|
76
|
+
- **Dead links.** Buttons that link to `#`. Either link to real destinations or visually disable them.
|
|
77
|
+
- **No indication of current page in navigation.** Style the active nav link differently (use `useRoute()` / `useRouter()` to detect it).
|
|
78
|
+
- **Scroll jumping.** Anchor clicks jump instantly. Add `scroll-behavior: smooth`.
|
|
79
|
+
- **Animations using `top`, `left`, `width`, `height`.** Switch to `transform` and `opacity` for GPU-accelerated, smooth animation.
|
|
80
|
+
|
|
81
|
+
### Content
|
|
82
|
+
|
|
83
|
+
- **Generic names like "John Doe" or "Jane Smith".** Use diverse, realistic-sounding names.
|
|
84
|
+
- **Fake round numbers like `99.99%`, `50%`, `$100.00`.** Use organic, messy data: `47.2%`, `$99.00`, `+1 (312) 847-1928`.
|
|
85
|
+
- **Placeholder company names like "Acme Corp", "Nexus", "SmartFlow".** Invent contextual, believable brand names.
|
|
86
|
+
- **AI copywriting cliches.** Never use "Elevate", "Seamless", "Unleash", "Next-Gen", "Game-changer", "Delve", "Tapestry", or "In the world of...". Write plain, specific language.
|
|
87
|
+
- **Exclamation marks in success messages.** Remove them. Be confident, not loud.
|
|
88
|
+
- **"Oops!" error messages.** Be direct: "Connection failed. Please try again."
|
|
89
|
+
- **Passive voice.** Use active voice: "We couldn't save your changes" instead of "Mistakes were made."
|
|
90
|
+
- **All blog post dates identical.** Randomize dates to appear real.
|
|
91
|
+
- **Same avatar image for multiple users.** Use unique assets for every distinct person.
|
|
92
|
+
- **Lorem Ipsum.** Never use placeholder latin text. Write real draft copy.
|
|
93
|
+
- **Title Case On Every Header.** Use sentence case instead.
|
|
94
|
+
|
|
95
|
+
### Component Patterns
|
|
96
|
+
|
|
97
|
+
- **Generic card look (border + shadow + white background).** Remove the border, or use only background color, or use only spacing. Cards should exist only when elevation communicates hierarchy.
|
|
98
|
+
- **Always one filled button + one ghost button.** Add text links or tertiary styles to reduce visual noise.
|
|
99
|
+
- **Pill-shaped "New" and "Beta" badges.** Try square badges, flags, or plain text labels.
|
|
100
|
+
- **Accordion FAQ sections.** Use a side-by-side list, searchable help, or inline progressive disclosure. When you do keep a disclosure, use the headless `Disclosure` from [`stacks-ui`](../stacks-ui/SKILL.md).
|
|
101
|
+
- **3-card carousel testimonials with dots.** Replace with a masonry wall, embedded social posts, or a single rotating quote.
|
|
102
|
+
- **Pricing table with 3 towers.** Highlight the recommended tier with color and emphasis, not just extra height.
|
|
103
|
+
- **Modals for everything.** Use inline editing, slide-over panels, or expandable sections instead of popups for simple actions. For real modals reach for the headless `Dialog`/`Modal` in [`stacks-ui`](../stacks-ui/SKILL.md).
|
|
104
|
+
- **Avatar circles exclusively.** Try squircles or rounded squares for a less generic look.
|
|
105
|
+
- **Light/dark toggle always a sun/moon switch.** Use a dropdown, system preference detection (`useColorMode()` / `useDark()`), or integrate it into settings.
|
|
106
|
+
- **Footer link farm with 4 columns.** Simplify. Focus on main navigational paths and legally required links.
|
|
107
|
+
|
|
108
|
+
### Iconography
|
|
109
|
+
|
|
110
|
+
- **Lucide or Feather icons exclusively.** The "default" AI icon choice. Use Iconify `i-*` classes (Phosphor `i-ph-*`, Heroicons, or the hugeicons default) for differentiation. NEVER hand-roll SVG icon paths and NEVER `npm install` an icon library.
|
|
111
|
+
- **Rocketship for "Launch", shield for "Security".** Replace cliche metaphors with less obvious icons (bolt, fingerprint, spark, vault).
|
|
112
|
+
- **Inconsistent stroke widths across icons.** Standardize to one stroke weight and one Iconify collection per project.
|
|
113
|
+
- **Missing favicon.** Always include a branded favicon.
|
|
114
|
+
- **Stock "diverse team" photos.** Use real team photos, candid shots, or a consistent illustration style instead of uncanny stock imagery.
|
|
115
|
+
|
|
116
|
+
### Code Quality
|
|
117
|
+
|
|
118
|
+
- **Div soup.** Use semantic stx markup: `<nav>`, `<main>`, `<article>`, `<aside>`, `<section>`.
|
|
119
|
+
- **Inline styles mixed with utility classes.** Move styling into Crosswind utilities or the `.stx` `<style>` block.
|
|
120
|
+
- **Hardcoded pixel widths.** Use relative units (`%`, `rem`, `em`, `max-w-*`) for flexible layouts.
|
|
121
|
+
- **Missing alt text on images.** Describe image content for screen readers. Never leave `alt=""` or `alt="image"` on meaningful images.
|
|
122
|
+
- **Arbitrary z-index values like `9999`.** Establish a clean z-index scale in the theme/tokens.
|
|
123
|
+
- **Commented-out dead code.** Remove all debug artifacts before shipping.
|
|
124
|
+
- **Import hallucinations.** Check that every import actually exists. Composables are auto-imported (no import line); do not invent composable names. Verify components exist in `resources/components`.
|
|
125
|
+
- **Missing meta tags.** Add proper `<title>`, `description`, `og:image`, and social sharing meta via the `@seo` / `@meta` directives or `useHead` / `useSeoMeta`.
|
|
126
|
+
- **Vanilla JS in stx scripts.** Replace any `var`, `document.*`, or `window.*` with signals + composables + directives.
|
|
127
|
+
|
|
128
|
+
### Strategic Omissions (What AI Typically Forgets)
|
|
129
|
+
|
|
130
|
+
- **No legal links.** Add privacy policy and terms of service links in the footer.
|
|
131
|
+
- **No "back" navigation.** Every page needs a way back.
|
|
132
|
+
- **No custom 404 page.** Design a helpful, branded "page not found" experience.
|
|
133
|
+
- **No form validation.** Add client-side validation for emails, required fields, and format checks.
|
|
134
|
+
- **No "skip to content" link.** Add a hidden skip-link for keyboard users.
|
|
135
|
+
- **No cookie consent.** If required by jurisdiction, add a compliant consent banner.
|
|
136
|
+
|
|
137
|
+
## Upgrade Techniques
|
|
138
|
+
|
|
139
|
+
Pull from these high-impact techniques to replace generic patterns. All motion is built with Crosswind transitions, CSS keyframes, and composables; Stacks ships no animation library, so do NOT import `motion`, `gsap`, or `framer-motion`.
|
|
140
|
+
|
|
141
|
+
### Typography Upgrades
|
|
142
|
+
- **Variable font animation.** Interpolate weight or width on scroll or hover for text that feels alive.
|
|
143
|
+
- **Outlined-to-fill transitions.** Text starts as a stroke outline and fills with color on scroll entry or interaction.
|
|
144
|
+
- **Text mask reveals.** Large typography acting as a window to video or animated imagery behind it.
|
|
145
|
+
|
|
146
|
+
### Layout Upgrades
|
|
147
|
+
- **Broken grid / asymmetry.** Elements that deliberately ignore column structure: overlapping, bleeding off-screen, or offset with calculated randomness.
|
|
148
|
+
- **Whitespace maximization.** Aggressive negative space to force focus on a single element.
|
|
149
|
+
- **Parallax card stacks.** Sections that stick and physically stack over each other during scroll. Build with `position: sticky` + `top: 0` and CSS scroll-driven animations (`animation-timeline: view()` / `scroll()`), not GSAP ScrollTrigger.
|
|
150
|
+
- **Split-screen scroll.** Two halves of the screen sliding in opposite directions via CSS scroll-driven animations.
|
|
151
|
+
|
|
152
|
+
### Motion Upgrades
|
|
153
|
+
- **Smooth scroll with inertia.** Use `scroll-behavior: smooth`; keep it CSS-driven, never a `requestAnimationFrame` loop writing signal state every frame.
|
|
154
|
+
- **Staggered entry.** Elements cascade in with slight delays, combining Y-axis translation with opacity fade. Toggle with `useIntersectionObserver` / `useElementVisibility`. Never mount everything at once.
|
|
155
|
+
- **Spring physics.** Replace linear easing with custom cubic-bezier motion (for example `ease-[cubic-bezier(0.32,0.72,0,1)]`) for a natural, weighty feel.
|
|
156
|
+
- **Scroll-driven reveals.** Content entering through expanding masks, wipes, or draw-on SVG paths tied to scroll progress via CSS scroll-driven animations. NEVER `window.addEventListener('scroll', ...)`.
|
|
157
|
+
|
|
158
|
+
### Surface Upgrades
|
|
159
|
+
- **True glassmorphism.** Go beyond `backdrop-blur`. Add a 1px inner border and a subtle inner shadow to simulate edge refraction. Apply blur only to fixed/sticky elements.
|
|
160
|
+
- **Spotlight borders.** Card borders that illuminate under the cursor. Track the pointer with `useMouse()` and drive a CSS custom property from an `effect`.
|
|
161
|
+
- **Grain and noise overlays.** A fixed, `pointer-events-none` overlay with subtle noise to break digital flatness.
|
|
162
|
+
- **Colored, tinted shadows.** Shadows that carry the hue of the background rather than generic black.
|
|
163
|
+
|
|
164
|
+
## Fix Priority
|
|
165
|
+
|
|
166
|
+
Apply changes in this order for maximum visual impact with minimum risk:
|
|
167
|
+
1. **Font swap** - biggest instant improvement, lowest risk
|
|
168
|
+
2. **Color palette cleanup** - remove clashing or oversaturated colors
|
|
169
|
+
3. **Hover and active states** - makes the interface feel alive
|
|
170
|
+
4. **Layout and spacing** - proper grid, max-width, consistent padding
|
|
171
|
+
5. **Replace generic components** - swap cliche patterns for modern alternatives
|
|
172
|
+
6. **Add loading, empty, and error states** - makes it feel finished
|
|
173
|
+
7. **Polish typography scale and spacing** - the premium final touch
|
|
174
|
+
|
|
175
|
+
## Rules
|
|
176
|
+
|
|
177
|
+
- Work with the existing stx + Crosswind + composables stack. Do not migrate frameworks or styling libraries.
|
|
178
|
+
- Do not break existing functionality. Test after every change.
|
|
179
|
+
- Before importing any new library, check `package.json` first. Composables are auto-imported; do not invent composable names (defer to [`stacks-composables`](../stacks-composables/SKILL.md) for the real list).
|
|
180
|
+
- Respect CLAUDE.md hard bans: no `var`, no `document.*`, no `window.*` in stx scripts; lint with pickier (`bunx --bun pickier .`), never eslint.
|
|
181
|
+
- Keep changes reviewable and focused. Small, targeted improvements over big rewrites.
|
|
182
|
+
- Ship complete stx; never a skeleton or placeholder comment.
|