@aurostack/stacks 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +209 -0
- package/cli/src/extract.mjs +165 -0
- package/cli/src/fsx.mjs +197 -0
- package/cli/src/generate.mjs +235 -0
- package/cli/src/hooks.mjs +55 -0
- package/cli/src/manifest.mjs +163 -0
- package/cli/src/strip.mjs +208 -0
- package/cli/src/tokens.mjs +102 -0
- package/cli/stack.mjs +672 -0
- package/package.json +37 -0
- package/templates/nest-api/files/.bin/db.ts +123 -0
- package/templates/nest-api/files/.bin/dc.ts +74 -0
- package/templates/nest-api/files/.bin/helpers.ts +49 -0
- package/templates/nest-api/files/.bin/secrets.ts +68 -0
- package/templates/nest-api/files/.bin/start.ts +47 -0
- package/templates/nest-api/files/.dockerignore +7 -0
- package/templates/nest-api/files/.env.example +91 -0
- package/templates/nest-api/files/.env.test.example +75 -0
- package/templates/nest-api/files/.forgejo/workflows/build-and-push.yml +41 -0
- package/templates/nest-api/files/.forgejo/workflows/test-e2e.yml +83 -0
- package/templates/nest-api/files/.forgejo/workflows/test.yml +53 -0
- package/templates/nest-api/files/.npmrc.example +1 -0
- package/templates/nest-api/files/.nvmrc +1 -0
- package/templates/nest-api/files/.prettierrc +8 -0
- package/templates/nest-api/files/.swcrc +15 -0
- package/templates/nest-api/files/.watchmanconfig +3 -0
- package/templates/nest-api/files/.yarnrc.yml +1 -0
- package/templates/nest-api/files/Dockerfile +40 -0
- package/templates/nest-api/files/__mocks__/activation-twofa.js +7 -0
- package/templates/nest-api/files/__mocks__/activation.js +7 -0
- package/templates/nest-api/files/__mocks__/forgot-password.js +7 -0
- package/templates/nest-api/files/__mocks__/main-layout.js +7 -0
- package/templates/nest-api/files/__mocks__/password-changed.js +7 -0
- package/templates/nest-api/files/__mocks__/reset-password.js +7 -0
- package/templates/nest-api/files/__mocks__/set-password.js +7 -0
- package/templates/nest-api/files/__mocks__/welcome.js +7 -0
- package/templates/nest-api/files/_gitignore +62 -0
- package/templates/nest-api/files/compose.test.yml +33 -0
- package/templates/nest-api/files/compose.yml +39 -0
- package/templates/nest-api/files/emails/activation-twofa.tsx +58 -0
- package/templates/nest-api/files/emails/activation.tsx +36 -0
- package/templates/nest-api/files/emails/forgot-password.tsx +29 -0
- package/templates/nest-api/files/emails/main-layout.tsx +134 -0
- package/templates/nest-api/files/emails/password-changed.tsx +24 -0
- package/templates/nest-api/files/emails/reset-password.tsx +24 -0
- package/templates/nest-api/files/emails/set-password.tsx +25 -0
- package/templates/nest-api/files/emails/welcome.tsx +39 -0
- package/templates/nest-api/files/eslint.config.mjs +28 -0
- package/templates/nest-api/files/global.d.ts +5 -0
- package/templates/nest-api/files/nest-cli.json +8 -0
- package/templates/nest-api/files/package.json +150 -0
- package/templates/nest-api/files/prisma/schema/auth.prisma +75 -0
- package/templates/nest-api/files/prisma/schema/base.prisma +17 -0
- package/templates/nest-api/files/prisma/schema/enum.prisma +17 -0
- package/templates/nest-api/files/prisma/schema/notification.prisma +14 -0
- package/templates/nest-api/files/prisma.config.ts +13 -0
- package/templates/nest-api/files/public/.gitkeep +0 -0
- package/templates/nest-api/files/seeders/index.ts +27 -0
- package/templates/nest-api/files/seeders/util.ts +88 -0
- package/templates/nest-api/files/src/__tests__/app.controller.spec.ts +29 -0
- package/templates/nest-api/files/src/app.controller.ts +40 -0
- package/templates/nest-api/files/src/app.module.ts +268 -0
- package/templates/nest-api/files/src/app.resolver.ts +32 -0
- package/templates/nest-api/files/src/app.setup.ts +178 -0
- package/templates/nest-api/files/src/common/__tests__/auth.service.spec.ts +31 -0
- package/templates/nest-api/files/src/common/__tests__/cache.service.spec.ts +214 -0
- package/templates/nest-api/files/src/common/__tests__/config.service.spec.ts +56 -0
- package/templates/nest-api/files/src/common/__tests__/generator.service.spec.ts +114 -0
- package/templates/nest-api/files/src/common/__tests__/health.controller.spec.ts +72 -0
- package/templates/nest-api/files/src/common/__tests__/helpers.spec.ts +124 -0
- package/templates/nest-api/files/src/common/__tests__/mail.service.spec.ts +75 -0
- package/templates/nest-api/files/src/common/__tests__/prisma.indicator.spec.ts +39 -0
- package/templates/nest-api/files/src/common/__tests__/prisma.service.spec.ts +15 -0
- package/templates/nest-api/files/src/common/__tests__/records.spec.ts +87 -0
- package/templates/nest-api/files/src/common/__tests__/schemas.spec.ts +142 -0
- package/templates/nest-api/files/src/common/__tests__/throttler-storage.service.spec.ts +80 -0
- package/templates/nest-api/files/src/common/common.module.ts +72 -0
- package/templates/nest-api/files/src/common/constants/index.ts +2 -0
- package/templates/nest-api/files/src/common/constants/options.ts +52 -0
- package/templates/nest-api/files/src/common/constants/pino.ts +24 -0
- package/templates/nest-api/files/src/common/controllers/health.controller.ts +54 -0
- package/templates/nest-api/files/src/common/controllers/index.ts +2 -0
- package/templates/nest-api/files/src/common/controllers/metrics.controller.ts +21 -0
- package/templates/nest-api/files/src/common/decorators/index.ts +2 -0
- package/templates/nest-api/files/src/common/decorators/misc.decorator.ts +49 -0
- package/templates/nest-api/files/src/common/decorators/multi-part.decorator.ts +6 -0
- package/templates/nest-api/files/src/common/dto/filters.dto.ts +25 -0
- package/templates/nest-api/files/src/common/dto/index.ts +1 -0
- package/templates/nest-api/files/src/common/entity/index.ts +2 -0
- package/templates/nest-api/files/src/common/entity/ok.entity.ts +11 -0
- package/templates/nest-api/files/src/common/entity/pagination.entity.ts +24 -0
- package/templates/nest-api/files/src/common/exceptions/index.ts +1 -0
- package/templates/nest-api/files/src/common/exceptions/prisma.exception.ts +57 -0
- package/templates/nest-api/files/src/common/guards/feature-flag.guard.ts +51 -0
- package/templates/nest-api/files/src/common/guards/index.ts +1 -0
- package/templates/nest-api/files/src/common/interceptors/index.ts +1 -0
- package/templates/nest-api/files/src/common/interceptors/metrics.interceptor.ts +37 -0
- package/templates/nest-api/files/src/common/misc/helpers.ts +26 -0
- package/templates/nest-api/files/src/common/misc/index.ts +3 -0
- package/templates/nest-api/files/src/common/misc/origin-builder.ts +56 -0
- package/templates/nest-api/files/src/common/misc/prisma.indicator.ts +24 -0
- package/templates/nest-api/files/src/common/modules/index.ts +3 -0
- package/templates/nest-api/files/src/common/modules/logger.module.ts +104 -0
- package/templates/nest-api/files/src/common/modules/metrics.module.ts +28 -0
- package/templates/nest-api/files/src/common/modules/queue.module.ts +23 -0
- package/templates/nest-api/files/src/common/processors/index.ts +1 -0
- package/templates/nest-api/files/src/common/processors/mail/index.ts +47 -0
- package/templates/nest-api/files/src/common/processors/mail/process.ts +225 -0
- package/templates/nest-api/files/src/common/schemas/fields.ts +76 -0
- package/templates/nest-api/files/src/common/schemas/index.ts +1 -0
- package/templates/nest-api/files/src/common/services/auth-rate-limit.storage.ts +79 -0
- package/templates/nest-api/files/src/common/services/auth.service.ts +16 -0
- package/templates/nest-api/files/src/common/services/cache.service.ts +118 -0
- package/templates/nest-api/files/src/common/services/config.service.ts +388 -0
- package/templates/nest-api/files/src/common/services/feature-flag.service.ts +117 -0
- package/templates/nest-api/files/src/common/services/generator.service.ts +54 -0
- package/templates/nest-api/files/src/common/services/index.ts +10 -0
- package/templates/nest-api/files/src/common/services/logger.service.ts +14 -0
- package/templates/nest-api/files/src/common/services/mail.service.ts +44 -0
- package/templates/nest-api/files/src/common/services/prisma.service.ts +106 -0
- package/templates/nest-api/files/src/common/services/throttler-storage.service.ts +112 -0
- package/templates/nest-api/files/src/common/types/email.ts +55 -0
- package/templates/nest-api/files/src/common/types/index.ts +3 -0
- package/templates/nest-api/files/src/common/types/misc.ts +20 -0
- package/templates/nest-api/files/src/common/types/prisma.ts +18 -0
- package/templates/nest-api/files/src/common/utils/enum.ts +39 -0
- package/templates/nest-api/files/src/common/utils/helpers.ts +139 -0
- package/templates/nest-api/files/src/common/utils/index.ts +5 -0
- package/templates/nest-api/files/src/common/utils/ip.ts +22 -0
- package/templates/nest-api/files/src/common/utils/records.ts +66 -0
- package/templates/nest-api/files/src/common/utils/redis.keys.ts +31 -0
- package/templates/nest-api/files/src/lib/__tests__/access.spec.ts +33 -0
- package/templates/nest-api/files/src/lib/access.ts +114 -0
- package/templates/nest-api/files/src/lib/auth.ts +76 -0
- package/templates/nest-api/files/src/lib/rate-limit.ts +20 -0
- package/templates/nest-api/files/src/main.ts +28 -0
- package/templates/nest-api/files/src/media/__tests__/media.service.spec.ts +60 -0
- package/templates/nest-api/files/src/media/__tests__/s3.service.spec.ts +159 -0
- package/templates/nest-api/files/src/media/entity/file.entity.ts +7 -0
- package/templates/nest-api/files/src/media/entity/index.ts +1 -0
- package/templates/nest-api/files/src/media/media.module.ts +20 -0
- package/templates/nest-api/files/src/media/processors/index.ts +44 -0
- package/templates/nest-api/files/src/media/services/index.ts +2 -0
- package/templates/nest-api/files/src/media/services/media.service.ts +29 -0
- package/templates/nest-api/files/src/media/services/s3.service.ts +168 -0
- package/templates/nest-api/files/src/notifications/controllers/index.ts +1 -0
- package/templates/nest-api/files/src/notifications/controllers/notifications.controller.ts +72 -0
- package/templates/nest-api/files/src/notifications/dto/index.ts +1 -0
- package/templates/nest-api/files/src/notifications/dto/notification.dto.ts +11 -0
- package/templates/nest-api/files/src/notifications/entity/index.ts +1 -0
- package/templates/nest-api/files/src/notifications/entity/notification.entity.ts +37 -0
- package/templates/nest-api/files/src/notifications/notifications.module.ts +11 -0
- package/templates/nest-api/files/src/notifications/services/index.ts +1 -0
- package/templates/nest-api/files/src/notifications/services/notifications.service.ts +98 -0
- package/templates/nest-api/files/src/realtime/__tests__/events.gateway.spec.ts +88 -0
- package/templates/nest-api/files/src/realtime/__tests__/rooms.spec.ts +29 -0
- package/templates/nest-api/files/src/realtime/__tests__/ws-permissions.guard.spec.ts +54 -0
- package/templates/nest-api/files/src/realtime/adapters/redis-io.adapter.ts +57 -0
- package/templates/nest-api/files/src/realtime/constants/index.ts +68 -0
- package/templates/nest-api/files/src/realtime/decorators/index.ts +1 -0
- package/templates/nest-api/files/src/realtime/decorators/ws-permissions.decorator.ts +14 -0
- package/templates/nest-api/files/src/realtime/gateways/events.gateway.ts +187 -0
- package/templates/nest-api/files/src/realtime/guards/index.ts +2 -0
- package/templates/nest-api/files/src/realtime/guards/ws-auth.guard.ts +20 -0
- package/templates/nest-api/files/src/realtime/guards/ws-permissions.guard.ts +35 -0
- package/templates/nest-api/files/src/realtime/misc/session-from-socket.ts +54 -0
- package/templates/nest-api/files/src/realtime/realtime.module.ts +26 -0
- package/templates/nest-api/files/src/realtime/services/presence.service.ts +56 -0
- package/templates/nest-api/files/src/realtime/services/realtime.service.ts +72 -0
- package/templates/nest-api/files/src/users/__tests__/current-user.controller.spec.ts +77 -0
- package/templates/nest-api/files/src/users/__tests__/current-user.service.spec.ts +159 -0
- package/templates/nest-api/files/src/users/__tests__/user.entity.spec.ts +175 -0
- package/templates/nest-api/files/src/users/__tests__/users.controller.spec.ts +89 -0
- package/templates/nest-api/files/src/users/__tests__/users.service.spec.ts +398 -0
- package/templates/nest-api/files/src/users/controllers/current-user.controller.ts +82 -0
- package/templates/nest-api/files/src/users/controllers/index.ts +2 -0
- package/templates/nest-api/files/src/users/controllers/users.controller.ts +40 -0
- package/templates/nest-api/files/src/users/decorators/index.ts +1 -0
- package/templates/nest-api/files/src/users/decorators/permissions.decorator.ts +24 -0
- package/templates/nest-api/files/src/users/dto/avatar.dto.ts +13 -0
- package/templates/nest-api/files/src/users/dto/filters.dto.ts +8 -0
- package/templates/nest-api/files/src/users/dto/index.ts +2 -0
- package/templates/nest-api/files/src/users/entity/index.ts +1 -0
- package/templates/nest-api/files/src/users/entity/user.entity.ts +53 -0
- package/templates/nest-api/files/src/users/services/current-user.service.ts +46 -0
- package/templates/nest-api/files/src/users/services/index.ts +2 -0
- package/templates/nest-api/files/src/users/services/users.service.ts +88 -0
- package/templates/nest-api/files/src/users/users.module.ts +10 -0
- package/templates/nest-api/files/test/app.spec.ts +102 -0
- package/templates/nest-api/files/test/auth.spec.ts +108 -0
- package/templates/nest-api/files/test/current-user.spec.ts +154 -0
- package/templates/nest-api/files/test/factory/app.ts +172 -0
- package/templates/nest-api/files/test/factory/constants.ts +22 -0
- package/templates/nest-api/files/test/factory/dto.ts +27 -0
- package/templates/nest-api/files/test/factory/entity.ts +70 -0
- package/templates/nest-api/files/test/factory/gen.ts +75 -0
- package/templates/nest-api/files/test/factory/util.ts +21 -0
- package/templates/nest-api/files/test/notifications.spec.ts +176 -0
- package/templates/nest-api/files/test/rate-limit.spec.ts +180 -0
- package/templates/nest-api/files/test/setup.ts +1 -0
- package/templates/nest-api/files/test/users.spec.ts +437 -0
- package/templates/nest-api/files/tsconfig.build.json +13 -0
- package/templates/nest-api/files/tsconfig.json +35 -0
- package/templates/nest-api/files/vitest.config.ts +53 -0
- package/templates/nest-api/template.json +452 -0
- package/templates/node-worker/files/.bin/db.ts +123 -0
- package/templates/node-worker/files/.bin/helpers.ts +49 -0
- package/templates/node-worker/files/.bin/secrets.ts +68 -0
- package/templates/node-worker/files/.dockerignore +5 -0
- package/templates/node-worker/files/.env.example +21 -0
- package/templates/node-worker/files/.forgejo/workflows/build-and-push.yml +41 -0
- package/templates/node-worker/files/.nvmrc +1 -0
- package/templates/node-worker/files/.prettierignore +4 -0
- package/templates/node-worker/files/.prettierrc +8 -0
- package/templates/node-worker/files/.yarnrc.yml +5 -0
- package/templates/node-worker/files/Dockerfile +63 -0
- package/templates/node-worker/files/Dockerfile.dev +59 -0
- package/templates/node-worker/files/_gitignore +48 -0
- package/templates/node-worker/files/ecosystem.config.cjs +10 -0
- package/templates/node-worker/files/eslint.config.js +37 -0
- package/templates/node-worker/files/package.json +67 -0
- package/templates/node-worker/files/prisma/_gitignore +1 -0
- package/templates/node-worker/files/prisma/schema/base.prisma +36 -0
- package/templates/node-worker/files/prisma.config.ts +13 -0
- package/templates/node-worker/files/src/config.ts +55 -0
- package/templates/node-worker/files/src/db.ts +118 -0
- package/templates/node-worker/files/src/index.ts +7 -0
- package/templates/node-worker/files/src/logger.ts +45 -0
- package/templates/node-worker/files/src/types.ts +23 -0
- package/templates/node-worker/files/src/utils/browser.ts +16 -0
- package/templates/node-worker/files/src/utils/date.ts +68 -0
- package/templates/node-worker/files/src/utils/helpers.ts +17 -0
- package/templates/node-worker/files/src/utils/number.ts +47 -0
- package/templates/node-worker/files/src/utils/worker.ts +29 -0
- package/templates/node-worker/files/src/workers/constants.ts +6 -0
- package/templates/node-worker/files/src/workers/example/index.ts +27 -0
- package/templates/node-worker/files/src/workers/index.ts +1 -0
- package/templates/node-worker/files/tsconfig.json +30 -0
- package/templates/node-worker/template.json +135 -0
- package/templates/py-worker/files/.dockerignore +176 -0
- package/templates/py-worker/files/.env.example +20 -0
- package/templates/py-worker/files/.forgejo/workflows/build-amd-push.yml +39 -0
- package/templates/py-worker/files/Dockerfile +10 -0
- package/templates/py-worker/files/README.md +3 -0
- package/templates/py-worker/files/_gitignore +176 -0
- package/templates/py-worker/files/config.py +89 -0
- package/templates/py-worker/files/models/decorators.py +42 -0
- package/templates/py-worker/files/models/enums.py +32 -0
- package/templates/py-worker/files/models/mixins.py +61 -0
- package/templates/py-worker/files/requirements.txt +18 -0
- package/templates/py-worker/files/utils/db.py +67 -0
- package/templates/py-worker/files/utils/logger.py +97 -0
- package/templates/py-worker/files/utils/misc.py +45 -0
- package/templates/py-worker/files/utils/worker.py +80 -0
- package/templates/py-worker/files/worker.py +41 -0
- package/templates/py-worker/files/workers/hello/process.py +22 -0
- package/templates/py-worker/template.json +87 -0
- package/templates/react-app/README.md +78 -0
- package/templates/react-app/derive.sh +128 -0
- package/templates/react-app/files/.bin/openapi.js +32 -0
- package/templates/react-app/files/.bin/secrets.js +47 -0
- package/templates/react-app/files/.dockerignore +16 -0
- package/templates/react-app/files/.editorconfig +12 -0
- package/templates/react-app/files/.env.example +34 -0
- package/templates/react-app/files/.forgejo/workflows/build-and-push.yml +55 -0
- package/templates/react-app/files/.forgejo/workflows/ci.yml +39 -0
- package/templates/react-app/files/.husky/pre-commit +1 -0
- package/templates/react-app/files/.nvmrc +1 -0
- package/templates/react-app/files/.prettierignore +6 -0
- package/templates/react-app/files/.prettierrc +9 -0
- package/templates/react-app/files/.yarnrc.yml +2 -0
- package/templates/react-app/files/Dockerfile +52 -0
- package/templates/react-app/files/_gitignore +33 -0
- package/templates/react-app/files/build.sh +53 -0
- package/templates/react-app/files/docker/nginx.conf +134 -0
- package/templates/react-app/files/eslint.config.mjs +75 -0
- package/templates/react-app/files/index.html +62 -0
- package/templates/react-app/files/openapi-ts.config.ts +22 -0
- package/templates/react-app/files/package.json +80 -0
- package/templates/react-app/files/src/app/nav.tsx +32 -0
- package/templates/react-app/files/src/app/providers.tsx +39 -0
- package/templates/react-app/files/src/app/router.tsx +142 -0
- package/templates/react-app/files/src/app/store.ts +20 -0
- package/templates/react-app/files/src/features/auth/components/auth-card.tsx +23 -0
- package/templates/react-app/files/src/features/auth/components/checkbox-field.tsx +32 -0
- package/templates/react-app/files/src/features/auth/components/google-button.tsx +41 -0
- package/templates/react-app/files/src/features/auth/components/or-divider.tsx +9 -0
- package/templates/react-app/files/src/features/auth/components/password-field.tsx +70 -0
- package/templates/react-app/files/src/features/auth/components/submit-button.tsx +16 -0
- package/templates/react-app/files/src/features/auth/lib/auth-actions.ts +68 -0
- package/templates/react-app/files/src/features/auth/lib/password-strength.ts +20 -0
- package/templates/react-app/files/src/features/auth/lib/redirect.ts +6 -0
- package/templates/react-app/files/src/features/auth/lib/schemas.ts +37 -0
- package/templates/react-app/files/src/features/seo/routes.ts +65 -0
- package/templates/react-app/files/src/lib/env.ts +28 -0
- package/templates/react-app/files/src/lib/paths.ts +58 -0
- package/templates/react-app/files/src/main.tsx +19 -0
- package/templates/react-app/files/src/routes/admin/home.tsx +24 -0
- package/templates/react-app/files/src/routes/auth/forgot-password.tsx +93 -0
- package/templates/react-app/files/src/routes/auth/login.tsx +87 -0
- package/templates/react-app/files/src/routes/auth/reset-password.tsx +83 -0
- package/templates/react-app/files/src/routes/auth/signup.tsx +117 -0
- package/templates/react-app/files/src/routes/auth/verified.tsx +31 -0
- package/templates/react-app/files/src/routes/auth/verify-email.tsx +97 -0
- package/templates/react-app/files/src/routes/home.tsx +17 -0
- package/templates/react-app/files/src/routes/legal/privacy.tsx +26 -0
- package/templates/react-app/files/src/routes/legal/terms.tsx +28 -0
- package/templates/react-app/files/src/routes/marketing/home.tsx +18 -0
- package/templates/react-app/files/src/routes/settings.tsx +10 -0
- package/templates/react-app/files/src/shared/api/base-api.ts +24 -0
- package/templates/react-app/files/src/shared/api/base-query.ts +29 -0
- package/templates/react-app/files/src/shared/api/config.ts +21 -0
- package/templates/react-app/files/src/shared/api/index.ts +15 -0
- package/templates/react-app/files/src/shared/api/realtime-events.ts +34 -0
- package/templates/react-app/files/src/shared/api/socket.ts +41 -0
- package/templates/react-app/files/src/shared/api/store.ts +39 -0
- package/templates/react-app/files/src/shared/api/upload-query.ts +115 -0
- package/templates/react-app/files/src/shared/auth/client.ts +27 -0
- package/templates/react-app/files/src/shared/auth/config.ts +28 -0
- package/templates/react-app/files/src/shared/auth/guards.tsx +75 -0
- package/templates/react-app/files/src/shared/auth/hooks.ts +13 -0
- package/templates/react-app/files/src/shared/auth/index.ts +20 -0
- package/templates/react-app/files/src/shared/auth/logout.ts +23 -0
- package/templates/react-app/files/src/shared/auth/provider.tsx +52 -0
- package/templates/react-app/files/src/shared/auth/redirect.ts +65 -0
- package/templates/react-app/files/src/shared/auth/slice.ts +54 -0
- package/templates/react-app/files/src/shared/hooks/index.ts +6 -0
- package/templates/react-app/files/src/shared/layouts/app-shell/app-shell.tsx +225 -0
- package/templates/react-app/files/src/shared/layouts/app-shell/user-menu.tsx +74 -0
- package/templates/react-app/files/src/shared/layouts/auth-layout.tsx +137 -0
- package/templates/react-app/files/src/shared/layouts/error-boundary.tsx +38 -0
- package/templates/react-app/files/src/shared/layouts/index.ts +23 -0
- package/templates/react-app/files/src/shared/layouts/marketing/marketing-layout.tsx +29 -0
- package/templates/react-app/files/src/shared/layouts/marketing/section-heading.tsx +38 -0
- package/templates/react-app/files/src/shared/layouts/marketing/section.tsx +30 -0
- package/templates/react-app/files/src/shared/layouts/states/app-shell-skeleton.tsx +47 -0
- package/templates/react-app/files/src/shared/layouts/states/empty.tsx +22 -0
- package/templates/react-app/files/src/shared/layouts/states/forbidden.tsx +14 -0
- package/templates/react-app/files/src/shared/layouts/states/loading.tsx +11 -0
- package/templates/react-app/files/src/shared/layouts/states/not-found.tsx +21 -0
- package/templates/react-app/files/src/shared/layouts/states/page-skeleton.tsx +39 -0
- package/templates/react-app/files/src/shared/layouts/states/route-fallback.tsx +26 -0
- package/templates/react-app/files/src/shared/layouts/states/state-screen.tsx +22 -0
- package/templates/react-app/files/src/shared/types/README.md +28 -0
- package/templates/react-app/files/src/shared/types/api/index.ts +9 -0
- package/templates/react-app/files/src/shared/types/api/zod.gen.ts +5 -0
- package/templates/react-app/files/src/shared/types/index.ts +4 -0
- package/templates/react-app/files/src/shared/ui/components/brand/logo.tsx +51 -0
- package/templates/react-app/files/src/shared/ui/components/brand/social-icons.tsx +37 -0
- package/templates/react-app/files/src/shared/ui/components/form/form.tsx +120 -0
- package/templates/react-app/files/src/shared/ui/components/ui/alert.tsx +25 -0
- package/templates/react-app/files/src/shared/ui/components/ui/button.tsx +43 -0
- package/templates/react-app/files/src/shared/ui/components/ui/calendar.tsx +78 -0
- package/templates/react-app/files/src/shared/ui/components/ui/card.tsx +44 -0
- package/templates/react-app/files/src/shared/ui/components/ui/checkbox.tsx +16 -0
- package/templates/react-app/files/src/shared/ui/components/ui/date-picker.tsx +76 -0
- package/templates/react-app/files/src/shared/ui/components/ui/input.tsx +22 -0
- package/templates/react-app/files/src/shared/ui/components/ui/label.tsx +19 -0
- package/templates/react-app/files/src/shared/ui/components/ui/modal.tsx +94 -0
- package/templates/react-app/files/src/shared/ui/components/ui/popover.tsx +31 -0
- package/templates/react-app/files/src/shared/ui/components/ui/progress.tsx +33 -0
- package/templates/react-app/files/src/shared/ui/components/ui/search-input.tsx +69 -0
- package/templates/react-app/files/src/shared/ui/components/ui/select.tsx +80 -0
- package/templates/react-app/files/src/shared/ui/components/ui/skeleton.tsx +12 -0
- package/templates/react-app/files/src/shared/ui/components/ui/sonner.tsx +23 -0
- package/templates/react-app/files/src/shared/ui/components/ui/spinner.tsx +8 -0
- package/templates/react-app/files/src/shared/ui/components/ui/textarea.tsx +22 -0
- package/templates/react-app/files/src/shared/ui/index.ts +45 -0
- package/templates/react-app/files/src/shared/ui/lib/utils.ts +7 -0
- package/templates/react-app/files/src/shared/ui/lib/zod-setup.ts +28 -0
- package/templates/react-app/files/src/shared/ui/meta/brand.ts +18 -0
- package/templates/react-app/files/src/shared/ui/meta/meta-context.ts +30 -0
- package/templates/react-app/files/src/shared/ui/meta/meta-provider.tsx +24 -0
- package/templates/react-app/files/src/shared/ui/meta/page-meta.tsx +69 -0
- package/templates/react-app/files/src/shared/ui/meta/use-meta-config.ts +11 -0
- package/templates/react-app/files/src/shared/ui/styles/globals.css +285 -0
- package/templates/react-app/files/src/shared/ui/styles/theme.css +48 -0
- package/templates/react-app/files/src/shared/ui/theme/init-script.ts +23 -0
- package/templates/react-app/files/src/shared/ui/theme/theme-colors.ts +14 -0
- package/templates/react-app/files/src/shared/ui/theme/theme-context.ts +60 -0
- package/templates/react-app/files/src/shared/ui/theme/theme-provider.tsx +101 -0
- package/templates/react-app/files/src/shared/ui/theme/theme-toggle.tsx +40 -0
- package/templates/react-app/files/src/shared/ui/theme/use-theme.ts +11 -0
- package/templates/react-app/files/src/vite-env.d.ts +13 -0
- package/templates/react-app/files/tsconfig.json +26 -0
- package/templates/react-app/files/tsconfig.node.json +25 -0
- package/templates/react-app/files/vite.config.ts +344 -0
- package/templates/react-app/overrides/src/routes/auth/forgot-password.tsx +93 -0
- package/templates/react-app/overrides/src/routes/auth/login.tsx +87 -0
- package/templates/react-app/overrides/src/routes/auth/signup.tsx +117 -0
- package/templates/react-app/overrides/src/routes/auth/verified.tsx +31 -0
- package/templates/react-app/overrides/src/routes/auth/verify-email.tsx +97 -0
- package/templates/react-app/overrides/src/shared/auth/config.ts +28 -0
- package/templates/react-app/overrides/src/shared/auth/guards.tsx +75 -0
- package/templates/react-app/overrides/src/shared/auth/index.ts +20 -0
- package/templates/react-app/overrides/src/shared/auth/redirect.ts +65 -0
- package/templates/react-app/overrides/src/shared/hooks/index.ts +6 -0
- package/templates/react-app/overrides/src/shared/types/README.md +28 -0
- package/templates/react-app/template.json +222 -0
- package/templates/react-monorepo/files/.dockerignore +19 -0
- package/templates/react-monorepo/files/.editorconfig +12 -0
- package/templates/react-monorepo/files/.forgejo/workflows/build-and-push.yml +98 -0
- package/templates/react-monorepo/files/.forgejo/workflows/ci.yml +35 -0
- package/templates/react-monorepo/files/.husky/pre-commit +1 -0
- package/templates/react-monorepo/files/.nvmrc +1 -0
- package/templates/react-monorepo/files/.prettierignore +6 -0
- package/templates/react-monorepo/files/.prettierrc +9 -0
- package/templates/react-monorepo/files/.yarnrc.yml +2 -0
- package/templates/react-monorepo/files/Dockerfile +90 -0
- package/templates/react-monorepo/files/_gitignore +35 -0
- package/templates/react-monorepo/files/apps/admin/.bin/secrets.js +57 -0
- package/templates/react-monorepo/files/apps/admin/.env.example +16 -0
- package/templates/react-monorepo/files/apps/admin/eslint.config.mjs +3 -0
- package/templates/react-monorepo/files/apps/admin/index.html +57 -0
- package/templates/react-monorepo/files/apps/admin/package.json +33 -0
- package/templates/react-monorepo/files/apps/admin/src/App.tsx +3 -0
- package/templates/react-monorepo/files/apps/admin/src/app/nav.tsx +14 -0
- package/templates/react-monorepo/files/apps/admin/src/app/providers.tsx +42 -0
- package/templates/react-monorepo/files/apps/admin/src/app/router.tsx +50 -0
- package/templates/react-monorepo/files/apps/admin/src/app/store.ts +15 -0
- package/templates/react-monorepo/files/apps/admin/src/lib/env.ts +12 -0
- package/templates/react-monorepo/files/apps/admin/src/main.tsx +14 -0
- package/templates/react-monorepo/files/apps/admin/src/routes/home.tsx +17 -0
- package/templates/react-monorepo/files/apps/admin/src/routes/settings.tsx +10 -0
- package/templates/react-monorepo/files/apps/admin/src/vite-env.d.ts +14 -0
- package/templates/react-monorepo/files/apps/admin/tsconfig.json +10 -0
- package/templates/react-monorepo/files/apps/admin/vite.config.ts +13 -0
- package/templates/react-monorepo/files/apps/auth/.bin/secrets.js +57 -0
- package/templates/react-monorepo/files/apps/auth/.env.example +16 -0
- package/templates/react-monorepo/files/apps/auth/eslint.config.mjs +3 -0
- package/templates/react-monorepo/files/apps/auth/index.html +57 -0
- package/templates/react-monorepo/files/apps/auth/package.json +32 -0
- package/templates/react-monorepo/files/apps/auth/src/App.tsx +3 -0
- package/templates/react-monorepo/files/apps/auth/src/app/providers.tsx +42 -0
- package/templates/react-monorepo/files/apps/auth/src/app/router.tsx +19 -0
- package/templates/react-monorepo/files/apps/auth/src/app/store.ts +15 -0
- package/templates/react-monorepo/files/apps/auth/src/components/auth-card.tsx +23 -0
- package/templates/react-monorepo/files/apps/auth/src/components/checkbox-field.tsx +32 -0
- package/templates/react-monorepo/files/apps/auth/src/components/google-button.tsx +41 -0
- package/templates/react-monorepo/files/apps/auth/src/components/or-divider.tsx +9 -0
- package/templates/react-monorepo/files/apps/auth/src/components/password-field.tsx +70 -0
- package/templates/react-monorepo/files/apps/auth/src/components/submit-button.tsx +16 -0
- package/templates/react-monorepo/files/apps/auth/src/lib/auth-actions.ts +68 -0
- package/templates/react-monorepo/files/apps/auth/src/lib/env.ts +8 -0
- package/templates/react-monorepo/files/apps/auth/src/lib/password-strength.ts +20 -0
- package/templates/react-monorepo/files/apps/auth/src/lib/redirect.ts +6 -0
- package/templates/react-monorepo/files/apps/auth/src/lib/schemas.ts +37 -0
- package/templates/react-monorepo/files/apps/auth/src/main.tsx +14 -0
- package/templates/react-monorepo/files/apps/auth/src/routes/forgot-password.tsx +91 -0
- package/templates/react-monorepo/files/apps/auth/src/routes/login.tsx +82 -0
- package/templates/react-monorepo/files/apps/auth/src/routes/reset-password.tsx +83 -0
- package/templates/react-monorepo/files/apps/auth/src/routes/signup.tsx +117 -0
- package/templates/react-monorepo/files/apps/auth/src/routes/verified.tsx +30 -0
- package/templates/react-monorepo/files/apps/auth/src/routes/verify-email.tsx +96 -0
- package/templates/react-monorepo/files/apps/auth/src/vite-env.d.ts +14 -0
- package/templates/react-monorepo/files/apps/auth/tsconfig.json +10 -0
- package/templates/react-monorepo/files/apps/auth/vite.config.ts +13 -0
- package/templates/react-monorepo/files/apps/client/.bin/secrets.js +57 -0
- package/templates/react-monorepo/files/apps/client/.env.example +16 -0
- package/templates/react-monorepo/files/apps/client/eslint.config.mjs +3 -0
- package/templates/react-monorepo/files/apps/client/index.html +57 -0
- package/templates/react-monorepo/files/apps/client/package.json +35 -0
- package/templates/react-monorepo/files/apps/client/src/App.tsx +3 -0
- package/templates/react-monorepo/files/apps/client/src/app/nav.tsx +14 -0
- package/templates/react-monorepo/files/apps/client/src/app/providers.tsx +42 -0
- package/templates/react-monorepo/files/apps/client/src/app/router.tsx +50 -0
- package/templates/react-monorepo/files/apps/client/src/app/store.ts +15 -0
- package/templates/react-monorepo/files/apps/client/src/lib/env.ts +12 -0
- package/templates/react-monorepo/files/apps/client/src/main.tsx +19 -0
- package/templates/react-monorepo/files/apps/client/src/routes/home.tsx +17 -0
- package/templates/react-monorepo/files/apps/client/src/routes/settings.tsx +10 -0
- package/templates/react-monorepo/files/apps/client/src/vite-env.d.ts +15 -0
- package/templates/react-monorepo/files/apps/client/tsconfig.json +10 -0
- package/templates/react-monorepo/files/apps/client/vite.config.ts +120 -0
- package/templates/react-monorepo/files/apps/landing/.bin/secrets.js +57 -0
- package/templates/react-monorepo/files/apps/landing/.env.example +20 -0
- package/templates/react-monorepo/files/apps/landing/eslint.config.mjs +3 -0
- package/templates/react-monorepo/files/apps/landing/index.html +51 -0
- package/templates/react-monorepo/files/apps/landing/package.json +33 -0
- package/templates/react-monorepo/files/apps/landing/src/App.tsx +3 -0
- package/templates/react-monorepo/files/apps/landing/src/app/providers.tsx +42 -0
- package/templates/react-monorepo/files/apps/landing/src/app/router.tsx +21 -0
- package/templates/react-monorepo/files/apps/landing/src/app/store.ts +18 -0
- package/templates/react-monorepo/files/apps/landing/src/features/seo/routes.ts +65 -0
- package/templates/react-monorepo/files/apps/landing/src/lib/env.ts +10 -0
- package/templates/react-monorepo/files/apps/landing/src/main.tsx +14 -0
- package/templates/react-monorepo/files/apps/landing/src/routes/home.tsx +18 -0
- package/templates/react-monorepo/files/apps/landing/src/vite-env.d.ts +15 -0
- package/templates/react-monorepo/files/apps/landing/tsconfig.json +10 -0
- package/templates/react-monorepo/files/apps/landing/vite.config.ts +169 -0
- package/templates/react-monorepo/files/build.sh +61 -0
- package/templates/react-monorepo/files/docker/nginx.conf +136 -0
- package/templates/react-monorepo/files/package.json +37 -0
- package/templates/react-monorepo/files/packages/.gitkeep +0 -0
- package/templates/react-monorepo/files/packages/api/eslint.config.mjs +3 -0
- package/templates/react-monorepo/files/packages/api/package.json +30 -0
- package/templates/react-monorepo/files/packages/api/src/base-api.ts +24 -0
- package/templates/react-monorepo/files/packages/api/src/base-query.ts +29 -0
- package/templates/react-monorepo/files/packages/api/src/config.ts +21 -0
- package/templates/react-monorepo/files/packages/api/src/index.ts +15 -0
- package/templates/react-monorepo/files/packages/api/src/realtime-events.ts +34 -0
- package/templates/react-monorepo/files/packages/api/src/socket.ts +41 -0
- package/templates/react-monorepo/files/packages/api/src/store.ts +39 -0
- package/templates/react-monorepo/files/packages/api/src/upload-query.ts +115 -0
- package/templates/react-monorepo/files/packages/api/tsconfig.json +4 -0
- package/templates/react-monorepo/files/packages/auth/eslint.config.mjs +3 -0
- package/templates/react-monorepo/files/packages/auth/package.json +33 -0
- package/templates/react-monorepo/files/packages/auth/src/client.ts +27 -0
- package/templates/react-monorepo/files/packages/auth/src/config.ts +22 -0
- package/templates/react-monorepo/files/packages/auth/src/guards.tsx +61 -0
- package/templates/react-monorepo/files/packages/auth/src/hooks.ts +13 -0
- package/templates/react-monorepo/files/packages/auth/src/index.ts +20 -0
- package/templates/react-monorepo/files/packages/auth/src/logout.ts +23 -0
- package/templates/react-monorepo/files/packages/auth/src/provider.tsx +52 -0
- package/templates/react-monorepo/files/packages/auth/src/redirect.ts +37 -0
- package/templates/react-monorepo/files/packages/auth/src/slice.ts +54 -0
- package/templates/react-monorepo/files/packages/auth/tsconfig.json +4 -0
- package/templates/react-monorepo/files/packages/config/README.md +47 -0
- package/templates/react-monorepo/files/packages/config/eslint/base.mjs +83 -0
- package/templates/react-monorepo/files/packages/config/package.json +37 -0
- package/templates/react-monorepo/files/packages/config/tailwind/theme.css +48 -0
- package/templates/react-monorepo/files/packages/config/tsconfig/base.json +22 -0
- package/templates/react-monorepo/files/packages/config/tsconfig/node.json +9 -0
- package/templates/react-monorepo/files/packages/config/tsconfig/react.json +9 -0
- package/templates/react-monorepo/files/packages/config/vite/index.d.ts +18 -0
- package/templates/react-monorepo/files/packages/config/vite/index.mjs +129 -0
- package/templates/react-monorepo/files/packages/hooks/eslint.config.mjs +3 -0
- package/templates/react-monorepo/files/packages/hooks/package.json +16 -0
- package/templates/react-monorepo/files/packages/hooks/src/index.ts +3 -0
- package/templates/react-monorepo/files/packages/hooks/tsconfig.json +4 -0
- package/templates/react-monorepo/files/packages/layouts/eslint.config.mjs +3 -0
- package/templates/react-monorepo/files/packages/layouts/package.json +30 -0
- package/templates/react-monorepo/files/packages/layouts/src/app-shell/app-shell.tsx +225 -0
- package/templates/react-monorepo/files/packages/layouts/src/app-shell/user-menu.tsx +74 -0
- package/templates/react-monorepo/files/packages/layouts/src/auth-layout.tsx +137 -0
- package/templates/react-monorepo/files/packages/layouts/src/error-boundary.tsx +38 -0
- package/templates/react-monorepo/files/packages/layouts/src/index.ts +23 -0
- package/templates/react-monorepo/files/packages/layouts/src/marketing/marketing-layout.tsx +29 -0
- package/templates/react-monorepo/files/packages/layouts/src/marketing/section-heading.tsx +38 -0
- package/templates/react-monorepo/files/packages/layouts/src/marketing/section.tsx +30 -0
- package/templates/react-monorepo/files/packages/layouts/src/states/app-shell-skeleton.tsx +47 -0
- package/templates/react-monorepo/files/packages/layouts/src/states/empty.tsx +22 -0
- package/templates/react-monorepo/files/packages/layouts/src/states/forbidden.tsx +14 -0
- package/templates/react-monorepo/files/packages/layouts/src/states/loading.tsx +11 -0
- package/templates/react-monorepo/files/packages/layouts/src/states/not-found.tsx +21 -0
- package/templates/react-monorepo/files/packages/layouts/src/states/page-skeleton.tsx +39 -0
- package/templates/react-monorepo/files/packages/layouts/src/states/route-fallback.tsx +26 -0
- package/templates/react-monorepo/files/packages/layouts/src/states/state-screen.tsx +22 -0
- package/templates/react-monorepo/files/packages/layouts/tsconfig.json +4 -0
- package/templates/react-monorepo/files/packages/types/.bin/openapi.js +32 -0
- package/templates/react-monorepo/files/packages/types/.bin/secrets.js +57 -0
- package/templates/react-monorepo/files/packages/types/README.md +28 -0
- package/templates/react-monorepo/files/packages/types/eslint.config.mjs +3 -0
- package/templates/react-monorepo/files/packages/types/openapi-ts.config.ts +22 -0
- package/templates/react-monorepo/files/packages/types/package.json +29 -0
- package/templates/react-monorepo/files/packages/types/src/index.ts +4 -0
- package/templates/react-monorepo/files/packages/types/src/types/api/index.ts +9 -0
- package/templates/react-monorepo/files/packages/types/src/types/api/zod.gen.ts +5 -0
- package/templates/react-monorepo/files/packages/types/tsconfig.json +7 -0
- package/templates/react-monorepo/files/packages/ui/components.json +21 -0
- package/templates/react-monorepo/files/packages/ui/eslint.config.mjs +13 -0
- package/templates/react-monorepo/files/packages/ui/package.json +44 -0
- package/templates/react-monorepo/files/packages/ui/src/components/brand/logo.tsx +51 -0
- package/templates/react-monorepo/files/packages/ui/src/components/brand/social-icons.tsx +37 -0
- package/templates/react-monorepo/files/packages/ui/src/components/form/form.tsx +120 -0
- package/templates/react-monorepo/files/packages/ui/src/components/ui/alert.tsx +25 -0
- package/templates/react-monorepo/files/packages/ui/src/components/ui/button.tsx +43 -0
- package/templates/react-monorepo/files/packages/ui/src/components/ui/calendar.tsx +78 -0
- package/templates/react-monorepo/files/packages/ui/src/components/ui/card.tsx +44 -0
- package/templates/react-monorepo/files/packages/ui/src/components/ui/checkbox.tsx +16 -0
- package/templates/react-monorepo/files/packages/ui/src/components/ui/date-picker.tsx +76 -0
- package/templates/react-monorepo/files/packages/ui/src/components/ui/input.tsx +22 -0
- package/templates/react-monorepo/files/packages/ui/src/components/ui/label.tsx +19 -0
- package/templates/react-monorepo/files/packages/ui/src/components/ui/modal.tsx +94 -0
- package/templates/react-monorepo/files/packages/ui/src/components/ui/popover.tsx +31 -0
- package/templates/react-monorepo/files/packages/ui/src/components/ui/progress.tsx +33 -0
- package/templates/react-monorepo/files/packages/ui/src/components/ui/search-input.tsx +69 -0
- package/templates/react-monorepo/files/packages/ui/src/components/ui/select.tsx +80 -0
- package/templates/react-monorepo/files/packages/ui/src/components/ui/skeleton.tsx +12 -0
- package/templates/react-monorepo/files/packages/ui/src/components/ui/sonner.tsx +23 -0
- package/templates/react-monorepo/files/packages/ui/src/components/ui/spinner.tsx +8 -0
- package/templates/react-monorepo/files/packages/ui/src/components/ui/textarea.tsx +22 -0
- package/templates/react-monorepo/files/packages/ui/src/index.ts +45 -0
- package/templates/react-monorepo/files/packages/ui/src/lib/utils.ts +7 -0
- package/templates/react-monorepo/files/packages/ui/src/lib/zod-setup.ts +28 -0
- package/templates/react-monorepo/files/packages/ui/src/meta/brand.ts +18 -0
- package/templates/react-monorepo/files/packages/ui/src/meta/meta-context.ts +30 -0
- package/templates/react-monorepo/files/packages/ui/src/meta/meta-provider.tsx +24 -0
- package/templates/react-monorepo/files/packages/ui/src/meta/page-meta.tsx +69 -0
- package/templates/react-monorepo/files/packages/ui/src/meta/use-meta-config.ts +11 -0
- package/templates/react-monorepo/files/packages/ui/src/styles/globals.css +285 -0
- package/templates/react-monorepo/files/packages/ui/src/theme/init-script.ts +23 -0
- package/templates/react-monorepo/files/packages/ui/src/theme/theme-colors.ts +14 -0
- package/templates/react-monorepo/files/packages/ui/src/theme/theme-context.ts +60 -0
- package/templates/react-monorepo/files/packages/ui/src/theme/theme-provider.tsx +101 -0
- package/templates/react-monorepo/files/packages/ui/src/theme/theme-toggle.tsx +40 -0
- package/templates/react-monorepo/files/packages/ui/src/theme/use-theme.ts +11 -0
- package/templates/react-monorepo/files/packages/ui/tsconfig.json +9 -0
- package/templates/react-monorepo/files/turbo.json +24 -0
- package/templates/react-monorepo/template.json +230 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type ReactNode, useEffect } from 'react';
|
|
2
|
+
import { Outlet } from 'react-router';
|
|
3
|
+
import { useAuth } from './hooks';
|
|
4
|
+
import { redirectToLogin } from './redirect';
|
|
5
|
+
|
|
6
|
+
type GuardProps = {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Shown while the session is resolving or a redirect is in flight.
|
|
10
|
+
*
|
|
11
|
+
* Required on purpose. This used to default to `null`, which meant the app
|
|
12
|
+
* rendered *nothing* for the entire cross-origin session round trip — ~880 ms
|
|
13
|
+
* measured against the deployed API, and worse on mobile. Pass the shell
|
|
14
|
+
* skeleton so the frame is on screen while the session resolves; there is no
|
|
15
|
+
* correct case for gating a whole app behind a blank screen.
|
|
16
|
+
*/
|
|
17
|
+
fallback: ReactNode;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** Requires any authenticated session; otherwise redirects to the Auth app. */
|
|
21
|
+
export function ProtectedRoute({ children, fallback }: GuardProps) {
|
|
22
|
+
const { status } = useAuth();
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (status === 'unauthenticated') redirectToLogin();
|
|
26
|
+
}, [status]);
|
|
27
|
+
|
|
28
|
+
if (status !== 'authenticated') return <>{fallback}</>;
|
|
29
|
+
return <>{children ?? <Outlet />}</>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type RoleRouteProps = GuardProps & {
|
|
33
|
+
/** Roles allowed to view (any match). Compared against session.user.role. */
|
|
34
|
+
allow: string[];
|
|
35
|
+
/** Rendered when authenticated but lacking a required role (403). Required for
|
|
36
|
+
* the same reason as `fallback` — a silent blank 403 looks like a broken app. */
|
|
37
|
+
forbidden: ReactNode;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Requires an authenticated session AND one of `allow` roles.
|
|
42
|
+
* 401 (no session) -> redirect to Auth; 403 (wrong role) -> forbidden UI.
|
|
43
|
+
*/
|
|
44
|
+
export function RoleRoute({ allow, children, fallback, forbidden }: RoleRouteProps) {
|
|
45
|
+
const { status, user } = useAuth();
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (status === 'unauthenticated') redirectToLogin();
|
|
49
|
+
}, [status]);
|
|
50
|
+
|
|
51
|
+
if (status !== 'authenticated') return <>{fallback}</>;
|
|
52
|
+
|
|
53
|
+
const roles = (user?.role ?? '')
|
|
54
|
+
.split(',')
|
|
55
|
+
.map((role) => role.trim())
|
|
56
|
+
.filter(Boolean);
|
|
57
|
+
const permitted = allow.some((role) => roles.includes(role));
|
|
58
|
+
if (!permitted) return <>{forbidden}</>;
|
|
59
|
+
|
|
60
|
+
return <>{children ?? <Outlet />}</>;
|
|
61
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useSelector } from 'react-redux';
|
|
2
|
+
import { selectAuth } from './slice';
|
|
3
|
+
|
|
4
|
+
/** Synchronous auth state for rendering/gating. Hydrated from Better Auth. */
|
|
5
|
+
export function useAuth() {
|
|
6
|
+
const { user, status } = useSelector(selectAuth);
|
|
7
|
+
return {
|
|
8
|
+
user,
|
|
9
|
+
status,
|
|
10
|
+
isAuthenticated: status === 'authenticated',
|
|
11
|
+
isLoading: status === 'loading'
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @acme/auth — centralized authentication on Better Auth.
|
|
2
|
+
export { configureAuth } from './config';
|
|
3
|
+
export { initAuthClient, getAuthClient } from './client';
|
|
4
|
+
export type { AuthClient } from './client';
|
|
5
|
+
export { AuthProvider } from './provider';
|
|
6
|
+
export { useAuth } from './hooks';
|
|
7
|
+
export { ProtectedRoute, RoleRoute } from './guards';
|
|
8
|
+
export { redirectToLogin, getSafeRedirect, configureRedirects } from './redirect';
|
|
9
|
+
export { signOut, broadcastAuthEvent, AUTH_BROADCAST_CHANNEL } from './logout';
|
|
10
|
+
export {
|
|
11
|
+
authReducer,
|
|
12
|
+
sessionLoading,
|
|
13
|
+
sessionLoaded,
|
|
14
|
+
sessionCleared,
|
|
15
|
+
selectAuth,
|
|
16
|
+
selectAuthUser,
|
|
17
|
+
selectAuthStatus,
|
|
18
|
+
selectIsAuthenticated
|
|
19
|
+
} from './slice';
|
|
20
|
+
export type { AuthUser, AuthStatus } from './slice';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getAuthClient } from './client';
|
|
2
|
+
|
|
3
|
+
export const AUTH_BROADCAST_CHANNEL = 'acme-auth';
|
|
4
|
+
|
|
5
|
+
/** Notify other tabs/apps of an auth event (e.g. logout) so stale UI can react. */
|
|
6
|
+
export function broadcastAuthEvent(type: 'login' | 'logout'): void {
|
|
7
|
+
try {
|
|
8
|
+
const channel = new BroadcastChannel(AUTH_BROADCAST_CHANNEL);
|
|
9
|
+
channel.postMessage({ type });
|
|
10
|
+
channel.close();
|
|
11
|
+
} catch {
|
|
12
|
+
/* BroadcastChannel unsupported — no-op */
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Sign out (clears the shared-domain cookie), broadcast, then optionally redirect. */
|
|
17
|
+
export async function signOut(options?: { redirectTo?: string }): Promise<void> {
|
|
18
|
+
await getAuthClient().signOut();
|
|
19
|
+
broadcastAuthEvent('logout');
|
|
20
|
+
if (options?.redirectTo) {
|
|
21
|
+
window.location.assign(options.redirectTo);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type ReactNode, useEffect } from 'react';
|
|
2
|
+
import { useDispatch } from 'react-redux';
|
|
3
|
+
import { getAuthClient } from './client';
|
|
4
|
+
import { sessionCleared, sessionLoaded, sessionLoading, type AuthUser } from './slice';
|
|
5
|
+
import { AUTH_BROADCAST_CHANNEL } from './logout';
|
|
6
|
+
|
|
7
|
+
function toAuthUser(user: Record<string, unknown> | null | undefined): AuthUser | null {
|
|
8
|
+
if (!user) return null;
|
|
9
|
+
return {
|
|
10
|
+
id: String(user.id),
|
|
11
|
+
email: String(user.email ?? ''),
|
|
12
|
+
name: (user.name as string | undefined) ?? null,
|
|
13
|
+
image: (user.image as string | undefined) ?? null,
|
|
14
|
+
role: (user.role as string | undefined) ?? null,
|
|
15
|
+
emailVerified: Boolean(user.emailVerified),
|
|
16
|
+
onboardingCompletedAt: (user.onboardingCompletedAt as string | undefined) ?? null
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Bootstraps the Better Auth session and hydrates the authSlice. Must render
|
|
22
|
+
* inside the Redux <Provider>. Guards read the resulting status for gating.
|
|
23
|
+
* Also syncs logout across tabs via BroadcastChannel.
|
|
24
|
+
*/
|
|
25
|
+
export function AuthProvider({ children }: { children: ReactNode }) {
|
|
26
|
+
const dispatch = useDispatch();
|
|
27
|
+
const session = getAuthClient().useSession();
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (session.isPending) {
|
|
31
|
+
dispatch(sessionLoading());
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const user = (session.data?.user as Record<string, unknown> | undefined) ?? null;
|
|
35
|
+
dispatch(sessionLoaded(toAuthUser(user)));
|
|
36
|
+
}, [session.isPending, session.data, dispatch]);
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
let channel: BroadcastChannel | null = null;
|
|
40
|
+
try {
|
|
41
|
+
channel = new BroadcastChannel(AUTH_BROADCAST_CHANNEL);
|
|
42
|
+
channel.onmessage = (event: MessageEvent<{ type?: string }>) => {
|
|
43
|
+
if (event.data?.type === 'logout') dispatch(sessionCleared());
|
|
44
|
+
};
|
|
45
|
+
} catch {
|
|
46
|
+
/* BroadcastChannel unsupported — no-op */
|
|
47
|
+
}
|
|
48
|
+
return () => channel?.close();
|
|
49
|
+
}, [dispatch]);
|
|
50
|
+
|
|
51
|
+
return <>{children}</>;
|
|
52
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Cross-app redirect helpers with open-redirect protection. The Auth app lives
|
|
2
|
+
// on its own origin; Client/Admin send unauthenticated users here and get them
|
|
3
|
+
// back to where they started. Redirect targets are validated against an
|
|
4
|
+
// allowlist so an attacker can't craft ?redirect=https://evil.example.
|
|
5
|
+
|
|
6
|
+
let authAppUrl = '';
|
|
7
|
+
let trustedOrigins: string[] = [];
|
|
8
|
+
let defaultRedirect = '';
|
|
9
|
+
|
|
10
|
+
export function configureRedirects(options: {
|
|
11
|
+
authAppUrl: string;
|
|
12
|
+
trustedOrigins: string[];
|
|
13
|
+
defaultRedirect?: string;
|
|
14
|
+
}): void {
|
|
15
|
+
authAppUrl = options.authAppUrl.replace(/\/$/, '');
|
|
16
|
+
trustedOrigins = options.trustedOrigins.map((origin) => origin.replace(/\/$/, ''));
|
|
17
|
+
defaultRedirect = options.defaultRedirect ?? '';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Validate a redirect target against the trusted-origin allowlist. */
|
|
21
|
+
export function getSafeRedirect(target: string | null | undefined, fallback: string = defaultRedirect): string {
|
|
22
|
+
if (!target) return fallback;
|
|
23
|
+
try {
|
|
24
|
+
const url = new URL(target, window.location.origin);
|
|
25
|
+
if (trustedOrigins.includes(url.origin)) return url.toString();
|
|
26
|
+
} catch {
|
|
27
|
+
/* not a valid URL — fall through to fallback */
|
|
28
|
+
}
|
|
29
|
+
return fallback;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Send an unauthenticated user to the Auth app, preserving where they were. */
|
|
33
|
+
export function redirectToLogin(returnTo: string = window.location.href): void {
|
|
34
|
+
const url = new URL('/login', authAppUrl || window.location.origin);
|
|
35
|
+
url.searchParams.set('redirect', returnTo);
|
|
36
|
+
window.location.assign(url.toString());
|
|
37
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { createSlice, type PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
+
|
|
3
|
+
export type AuthUser = {
|
|
4
|
+
id: string;
|
|
5
|
+
email: string;
|
|
6
|
+
name?: string | null;
|
|
7
|
+
image?: string | null;
|
|
8
|
+
role?: string | null;
|
|
9
|
+
emailVerified: boolean;
|
|
10
|
+
/** ISO timestamp set when onboarding is finished/skipped; null = not yet onboarded. */
|
|
11
|
+
onboardingCompletedAt?: string | null;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type AuthStatus = 'loading' | 'authenticated' | 'unauthenticated';
|
|
15
|
+
|
|
16
|
+
type AuthState = {
|
|
17
|
+
user: AuthUser | null;
|
|
18
|
+
status: AuthStatus;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const initialState: AuthState = {
|
|
22
|
+
user: null,
|
|
23
|
+
status: 'loading'
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// Minimal projection of the Better Auth session for synchronous, app-wide reads.
|
|
27
|
+
// Better Auth remains the source of truth; this slice is hydrated FROM it (AuthProvider).
|
|
28
|
+
const authSlice = createSlice({
|
|
29
|
+
name: 'auth',
|
|
30
|
+
initialState,
|
|
31
|
+
reducers: {
|
|
32
|
+
sessionLoading(state) {
|
|
33
|
+
state.status = 'loading';
|
|
34
|
+
},
|
|
35
|
+
sessionLoaded(state, action: PayloadAction<AuthUser | null>) {
|
|
36
|
+
state.user = action.payload;
|
|
37
|
+
state.status = action.payload ? 'authenticated' : 'unauthenticated';
|
|
38
|
+
},
|
|
39
|
+
sessionCleared(state) {
|
|
40
|
+
state.user = null;
|
|
41
|
+
state.status = 'unauthenticated';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export const { sessionLoading, sessionLoaded, sessionCleared } = authSlice.actions;
|
|
47
|
+
export const authReducer = authSlice.reducer;
|
|
48
|
+
|
|
49
|
+
type WithAuth = { auth: AuthState };
|
|
50
|
+
|
|
51
|
+
export const selectAuth = (state: WithAuth) => state.auth;
|
|
52
|
+
export const selectAuthUser = (state: WithAuth) => state.auth.user;
|
|
53
|
+
export const selectAuthStatus = (state: WithAuth) => state.auth.status;
|
|
54
|
+
export const selectIsAuthenticated = (state: WithAuth) => state.auth.status === 'authenticated';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @acme/config
|
|
2
|
+
|
|
3
|
+
Shared tooling for the Acme frontend monorepo. Not a runtime package — it exports config assets other packages/apps extend.
|
|
4
|
+
|
|
5
|
+
## Exports
|
|
6
|
+
|
|
7
|
+
| Import | What |
|
|
8
|
+
| ------------------------------------ | ------------------------------------------------------------------------------------------------ |
|
|
9
|
+
| `@acme/config/eslint` | Flat ESLint config (React 19 + TS). Default-export an array. |
|
|
10
|
+
| `@acme/config/tsconfig/base.json` | Base TS compiler options (strict, bundler, es2023). |
|
|
11
|
+
| `@acme/config/tsconfig/react.json` | Extends base + DOM libs + `react-jsx`. For apps/UI packages. |
|
|
12
|
+
| `@acme/config/tsconfig/node.json` | Extends base + node types. For `vite.config.ts` / scripts. |
|
|
13
|
+
| `@acme/config/vite` | `defineAppConfig({ rootDir })` Vite factory (React + Tailwind v4, `@`→`src`, env-driven server). |
|
|
14
|
+
| `@acme/config/tailwind.css` | Shared Tailwind v4 `@theme` design tokens. |
|
|
15
|
+
|
|
16
|
+
## Consumption
|
|
17
|
+
|
|
18
|
+
**ESLint** (`eslint.config.mjs`):
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
import config from '@acme/config/eslint';
|
|
22
|
+
export default config;
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**tsconfig** (`tsconfig.json`):
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"extends": "@acme/config/tsconfig/react.json",
|
|
30
|
+
"compilerOptions": { "paths": { "@/*": ["./src/*"] } },
|
|
31
|
+
"include": ["src"]
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Vite** (`vite.config.ts`):
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { defineAppConfig } from '@acme/config/vite';
|
|
39
|
+
export default defineAppConfig({ rootDir: import.meta.dirname });
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Tailwind** (`src/index.css`):
|
|
43
|
+
|
|
44
|
+
```css
|
|
45
|
+
@import 'tailwindcss';
|
|
46
|
+
@import '@acme/config/tailwind.css';
|
|
47
|
+
```
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
import reactHooks from 'eslint-plugin-react-hooks';
|
|
4
|
+
import reactRefresh from 'eslint-plugin-react-refresh';
|
|
5
|
+
import tseslint from 'typescript-eslint';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Shared flat ESLint config for Acme React 19 + TypeScript apps and packages.
|
|
9
|
+
*
|
|
10
|
+
* Usage in a consumer's `eslint.config.mjs`:
|
|
11
|
+
* import config from '@acme/config/eslint';
|
|
12
|
+
* export default config;
|
|
13
|
+
*
|
|
14
|
+
* To extend:
|
|
15
|
+
* import config from '@acme/config/eslint';
|
|
16
|
+
* export default [...config, { rules: { ... } }];
|
|
17
|
+
*/
|
|
18
|
+
export default tseslint.config(
|
|
19
|
+
// `dev-dist` is vite-plugin-pwa's dev output (Workbox sources). Generated, and
|
|
20
|
+
// gitignored — linting it only produced "rule not found" noise that made
|
|
21
|
+
// `yarn lint` fail permanently on the client app, hiding real findings.
|
|
22
|
+
{ ignores: ['dist', 'dev-dist', 'node_modules', '.turbo', 'src/types/api'] },
|
|
23
|
+
{
|
|
24
|
+
files: ['**/*.{ts,tsx}'],
|
|
25
|
+
extends: [
|
|
26
|
+
js.configs.recommended,
|
|
27
|
+
tseslint.configs.recommended,
|
|
28
|
+
reactHooks.configs.flat.recommended,
|
|
29
|
+
reactRefresh.configs.vite
|
|
30
|
+
],
|
|
31
|
+
languageOptions: {
|
|
32
|
+
ecmaVersion: 2023,
|
|
33
|
+
globals: globals.browser
|
|
34
|
+
},
|
|
35
|
+
rules: {
|
|
36
|
+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
|
|
37
|
+
'@typescript-eslint/no-empty-object-type': 'off',
|
|
38
|
+
|
|
39
|
+
// The shadcn primitives export their cva variants next to the component
|
|
40
|
+
// (`buttonVariants`), which is what `allowConstantExport` exists for.
|
|
41
|
+
// Left as a warning rather than an error: a fast-refresh hint should not
|
|
42
|
+
// be able to fail CI on a file that works.
|
|
43
|
+
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
|
|
44
|
+
|
|
45
|
+
// iOS auto-zooms a focused text control whose font-size is under 16px and
|
|
46
|
+
// never restores the zoom on blur, so one tap leaves the user zoomed for
|
|
47
|
+
// the session — in the installed PWA too. `text-sm` is 14px.
|
|
48
|
+
//
|
|
49
|
+
// The lookbehind lets `sm:text-sm` through: `text-base sm:text-sm` is the
|
|
50
|
+
// correct fix (16px on mobile, the intended density from `sm` up).
|
|
51
|
+
//
|
|
52
|
+
// Only catches literal className strings on raw `<input>`/`<textarea>`/
|
|
53
|
+
// `<select>` — that is exactly how this regressed before. Prefer
|
|
54
|
+
// `SearchInput`/`ComboboxFilter`/`Input` from `@acme/ui`, which already
|
|
55
|
+
// handle it.
|
|
56
|
+
'no-restricted-syntax': [
|
|
57
|
+
'error',
|
|
58
|
+
{
|
|
59
|
+
selector:
|
|
60
|
+
"JSXOpeningElement[name.name=/^(input|textarea|select)$/] JSXAttribute[name.name='className'] Literal[value=/(?<![:-])(text-xs|text-sm)(?![a-zA-Z0-9-])/]",
|
|
61
|
+
message:
|
|
62
|
+
'A text input under 16px makes iOS zoom in on focus and never zoom back out. Use `text-base sm:text-sm`, or the SearchInput / ComboboxFilter / Input components from @acme/ui.'
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
// `router.tsx` exports the router object alongside the shell components it
|
|
69
|
+
// mounts. Splitting them would mean a second file existing only to satisfy a
|
|
70
|
+
// heuristic — the router is not a component and is never hot-swapped.
|
|
71
|
+
files: ['**/app/router.tsx'],
|
|
72
|
+
rules: { 'react-refresh/only-export-components': 'off' }
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
// The shadcn primitives export their cva variants beside the component
|
|
76
|
+
// (`buttonVariants`, `alertVariants`) — that is how the upstream components
|
|
77
|
+
// are written, and it is why consumers can compose them. `allowConstantExport`
|
|
78
|
+
// does not cover a `cva()` call, so without this the rule warns permanently on
|
|
79
|
+
// unmodified upstream code, which is how a lint report stops being read.
|
|
80
|
+
files: ['**/components/ui/**'],
|
|
81
|
+
rules: { 'react-refresh/only-export-components': 'off' }
|
|
82
|
+
}
|
|
83
|
+
);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@acme/config",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
"./eslint": "./eslint/base.mjs",
|
|
8
|
+
"./tailwind.css": "./tailwind/theme.css",
|
|
9
|
+
"./vite": {
|
|
10
|
+
"types": "./vite/index.d.ts",
|
|
11
|
+
"default": "./vite/index.mjs"
|
|
12
|
+
},
|
|
13
|
+
"./tsconfig/base.json": "./tsconfig/base.json",
|
|
14
|
+
"./tsconfig/react.json": "./tsconfig/react.json",
|
|
15
|
+
"./tsconfig/node.json": "./tsconfig/node.json"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"eslint",
|
|
19
|
+
"tailwind",
|
|
20
|
+
"vite",
|
|
21
|
+
"tsconfig"
|
|
22
|
+
],
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@eslint/js": "^10.0.1",
|
|
25
|
+
"@tailwindcss/vite": "^4.3.0",
|
|
26
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
27
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
28
|
+
"eslint-plugin-react-refresh": "^0.5.2",
|
|
29
|
+
"globals": "^17.6.0",
|
|
30
|
+
"typescript-eslint": "^8.59.2"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"eslint": ">=10",
|
|
34
|
+
"typescript": ">=6",
|
|
35
|
+
"vite": ">=8"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Acme Corp — shared Tailwind v4 brand tokens (Wise-derived design system).
|
|
3
|
+
* Source of truth: Claude Design "Acme Corp Design System" (colors_and_type.css).
|
|
4
|
+
*
|
|
5
|
+
* Consume in an app's main CSS entry (via @acme/ui/globals.css):
|
|
6
|
+
* @import 'tailwindcss';
|
|
7
|
+
* @import '@acme/config/tailwind.css';
|
|
8
|
+
*
|
|
9
|
+
* These are the BRAND tokens (palette shades, ink, semantic, fonts). The shadcn
|
|
10
|
+
* semantic layer (--background/--foreground/--primary/...) is layered on top by
|
|
11
|
+
* @acme/ui/globals.css, which owns light/dark theming.
|
|
12
|
+
*
|
|
13
|
+
* Brand rule: Wise Green (#9fe870) is the CTA accent ONLY — never a success color.
|
|
14
|
+
*/
|
|
15
|
+
@theme {
|
|
16
|
+
/* Brand green shades (primary itself is owned by the shadcn layer) */
|
|
17
|
+
--color-primary-active: #cdffad;
|
|
18
|
+
--color-primary-neutral: #c5edab;
|
|
19
|
+
--color-primary-pale: #e2f6d5;
|
|
20
|
+
--color-on-primary: #0e0f0c;
|
|
21
|
+
|
|
22
|
+
/* Surfaces & ink */
|
|
23
|
+
--color-sage: #e8ebe6;
|
|
24
|
+
--color-ink: #0e0f0c;
|
|
25
|
+
--color-ink-deep: #163300;
|
|
26
|
+
--color-body: #454745;
|
|
27
|
+
--color-mute: #868685;
|
|
28
|
+
|
|
29
|
+
/* Semantic — status only, never the brand green */
|
|
30
|
+
--color-positive: #2ead4b;
|
|
31
|
+
--color-positive-deep: #054d28;
|
|
32
|
+
--color-warning: #ffd11a;
|
|
33
|
+
--color-warning-deep: #b86700;
|
|
34
|
+
--color-negative: #d03238;
|
|
35
|
+
--color-negative-deep: #a72027;
|
|
36
|
+
|
|
37
|
+
/* Illustrative accents (inside illustrations only, never UI fills) */
|
|
38
|
+
--color-accent-orange: #ffc091;
|
|
39
|
+
--color-accent-cyan: #38c8ff;
|
|
40
|
+
|
|
41
|
+
/* Typography — Inter stands in for proprietary Wise Sans */
|
|
42
|
+
/* 'Manrope' was listed here but never loaded — and sat *after* Inter, so it
|
|
43
|
+
could never have been used even if it were. Removed as dead. If the design
|
|
44
|
+
really wants Manrope for display type it needs its own @font-face AND to be
|
|
45
|
+
ordered ahead of Inter — a deliberate visual change, not a cleanup. */
|
|
46
|
+
--font-display: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
47
|
+
--font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
48
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"display": "Acme base",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"target": "es2023",
|
|
6
|
+
"module": "esnext",
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"lib": ["ES2023"],
|
|
9
|
+
"types": [],
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"verbatimModuleSyntax": true,
|
|
13
|
+
"moduleDetection": "force",
|
|
14
|
+
"isolatedModules": true,
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
"strict": true,
|
|
17
|
+
"noUnusedLocals": true,
|
|
18
|
+
"noUnusedParameters": true,
|
|
19
|
+
"noFallthroughCasesInSwitch": true,
|
|
20
|
+
"erasableSyntaxOnly": true
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PluginOption, UserConfig, UserConfigExport } from 'vite';
|
|
2
|
+
|
|
3
|
+
export interface DefineAppConfigOptions {
|
|
4
|
+
/** The app root directory. Pass `import.meta.dirname`. */
|
|
5
|
+
rootDir: string;
|
|
6
|
+
/**
|
|
7
|
+
* Theme background colours, used to substitute `%THEME_LIGHT%` / `%THEME_DARK%`
|
|
8
|
+
* in `index.html`. Pass `THEME_COLORS` from `@acme/ui/theme-colors`; omitting
|
|
9
|
+
* it leaves the placeholders in the markup.
|
|
10
|
+
*/
|
|
11
|
+
themeColors?: { light: string; dark: string };
|
|
12
|
+
/** Extra plugins appended after the base React + Tailwind plugins. */
|
|
13
|
+
plugins?: PluginOption[];
|
|
14
|
+
/** Optional Vite config overrides merged into the base config. */
|
|
15
|
+
overrides?: UserConfig;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function defineAppConfig(options: DefineAppConfigOptions): UserConfigExport;
|