@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,452 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nest-api",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"title": "NestJS API",
|
|
5
|
+
"description": "NestJS 12 + Prisma (Postgres) + Redis + BullMQ + better-auth + Vitest, with Docker Compose for local Postgres/Redis and a Scalar API reference.",
|
|
6
|
+
"defaults": {
|
|
7
|
+
"port": 5000
|
|
8
|
+
},
|
|
9
|
+
"replacements": [
|
|
10
|
+
{
|
|
11
|
+
"from": "@starter/backend",
|
|
12
|
+
"to": "@{{scope}}/api"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"from": "Acme Corp",
|
|
16
|
+
"to": "{{Name}}"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"from": "AcmeCorp",
|
|
20
|
+
"to": "{{pascal}}"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"from": "acme-corp",
|
|
24
|
+
"to": "{{name}}"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"from": "acmecorp",
|
|
28
|
+
"to": "{{name}}"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"from": "acme",
|
|
32
|
+
"to": "{{name}}"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"from": "\\bnum\\(\\)\\.default\\(5000\\)",
|
|
36
|
+
"to": "num().default({{port}})",
|
|
37
|
+
"regex": true
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"from": "Number\\(env\\.PORT\\) \\|\\| 5000",
|
|
41
|
+
"to": "Number(env.PORT) || {{port}}",
|
|
42
|
+
"regex": true
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"from": "^PORT='5000'$",
|
|
46
|
+
"to": "PORT='{{port}}'",
|
|
47
|
+
"regex": true,
|
|
48
|
+
"flags": "gm"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"from": "^EXPOSE 5000$",
|
|
52
|
+
"to": "EXPOSE {{port}}",
|
|
53
|
+
"regex": true,
|
|
54
|
+
"flags": "gm"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"features": {
|
|
58
|
+
"prisma": {
|
|
59
|
+
"title": "Prisma ORM + Postgres",
|
|
60
|
+
"description": "PrismaService, multi-file schema, the .bin/db.ts env-aware wrapper, and the Prisma exception filters.",
|
|
61
|
+
"core": true
|
|
62
|
+
},
|
|
63
|
+
"config": {
|
|
64
|
+
"title": "Zod-validated config service",
|
|
65
|
+
"description": "CustomConfigService wrapping @nestjs/config; app code never reads process.env directly.",
|
|
66
|
+
"core": true
|
|
67
|
+
},
|
|
68
|
+
"auth": {
|
|
69
|
+
"title": "better-auth (email/password, OAuth, roles)",
|
|
70
|
+
"description": "Global AuthGuard so every route is authenticated by default, @AllowAnonymous to opt out, access-control statements and roles in lib/access.ts.",
|
|
71
|
+
"core": true,
|
|
72
|
+
"requires": [
|
|
73
|
+
"prisma"
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"cache": {
|
|
77
|
+
"title": "Redis cache",
|
|
78
|
+
"description": "CacheService on ioredis, plus the key-namespacing helpers. Required by the queue, throttler and realtime layers.",
|
|
79
|
+
"default": true,
|
|
80
|
+
"files": [
|
|
81
|
+
"src/common/services/cache.service.ts",
|
|
82
|
+
"src/common/utils/redis.keys.ts",
|
|
83
|
+
"src/common/__tests__/cache.service.spec.ts"
|
|
84
|
+
],
|
|
85
|
+
"packageJson": {
|
|
86
|
+
"dependencies": [
|
|
87
|
+
"ioredis"
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"queue": {
|
|
92
|
+
"title": "BullMQ background jobs",
|
|
93
|
+
"description": "QueueModule.register(), the Bull Board dashboard at /dashboard behind basic auth.",
|
|
94
|
+
"default": true,
|
|
95
|
+
"requires": [
|
|
96
|
+
"cache"
|
|
97
|
+
],
|
|
98
|
+
"files": [
|
|
99
|
+
"src/common/modules/queue.module.ts"
|
|
100
|
+
],
|
|
101
|
+
"packageJson": {
|
|
102
|
+
"dependencies": [
|
|
103
|
+
"@nestjs/bullmq",
|
|
104
|
+
"bullmq",
|
|
105
|
+
"@bull-board/api",
|
|
106
|
+
"@bull-board/express",
|
|
107
|
+
"@bull-board/nestjs"
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"mail": {
|
|
112
|
+
"title": "Transactional email",
|
|
113
|
+
"description": "MailService enqueuing onto the `mail` queue, a MailProcessor consumer, and React Email templates with a dev preview server.",
|
|
114
|
+
"default": true,
|
|
115
|
+
"requires": [
|
|
116
|
+
"queue"
|
|
117
|
+
],
|
|
118
|
+
"files": [
|
|
119
|
+
"src/common/services/mail.service.ts",
|
|
120
|
+
"src/common/processors/**",
|
|
121
|
+
"src/common/types/email.ts",
|
|
122
|
+
"emails/**",
|
|
123
|
+
"__mocks__/**",
|
|
124
|
+
"src/common/__tests__/mail.service.spec.ts"
|
|
125
|
+
],
|
|
126
|
+
"packageJson": {
|
|
127
|
+
"dependencies": [
|
|
128
|
+
"@nestjs-modules/mailer",
|
|
129
|
+
"nodemailer",
|
|
130
|
+
"react",
|
|
131
|
+
"react-email",
|
|
132
|
+
"@react-email/components",
|
|
133
|
+
"@react-email/render"
|
|
134
|
+
],
|
|
135
|
+
"devDependencies": [
|
|
136
|
+
"@types/nodemailer",
|
|
137
|
+
"@types/react"
|
|
138
|
+
],
|
|
139
|
+
"scripts": [
|
|
140
|
+
"email:dev"
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"rate-limit": {
|
|
145
|
+
"title": "Two-layer rate limiting",
|
|
146
|
+
"description": "ThrottlerGuard on a Redis Lua storage for app routes, plus better-auth's own limiter for /auth/* with per-endpoint rules.",
|
|
147
|
+
"default": true,
|
|
148
|
+
"requires": [
|
|
149
|
+
"cache"
|
|
150
|
+
],
|
|
151
|
+
"files": [
|
|
152
|
+
"src/common/services/throttler-storage.service.ts",
|
|
153
|
+
"src/common/services/auth-rate-limit.storage.ts",
|
|
154
|
+
"src/lib/rate-limit.ts",
|
|
155
|
+
"src/common/utils/ip.ts",
|
|
156
|
+
"src/common/__tests__/throttler-storage.service.spec.ts",
|
|
157
|
+
"test/rate-limit.spec.ts"
|
|
158
|
+
],
|
|
159
|
+
"packageJson": {
|
|
160
|
+
"dependencies": [
|
|
161
|
+
"@nestjs/throttler"
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"openapi": {
|
|
166
|
+
"title": "OpenAPI + Scalar reference",
|
|
167
|
+
"description": "Swagger document at /openapi and a Scalar UI at /docs (auth + main API), both behind basic auth. Core rather than optional: @ApiTags/@ApiProperty decorators are pervasive in the controller and entity conventions, so removing @nestjs/swagger would mean annotating hundreds of lines.",
|
|
168
|
+
"core": true
|
|
169
|
+
},
|
|
170
|
+
"observability": {
|
|
171
|
+
"title": "Metrics and health checks",
|
|
172
|
+
"description": "A Prometheus /metrics endpoint and Terminus health checks, including a Prisma indicator. Structured pino logging is always included.",
|
|
173
|
+
"default": true,
|
|
174
|
+
"files": [
|
|
175
|
+
"src/common/modules/metrics.module.ts",
|
|
176
|
+
"src/common/controllers/metrics.controller.ts",
|
|
177
|
+
"src/common/controllers/health.controller.ts",
|
|
178
|
+
"src/common/interceptors/metrics.interceptor.ts",
|
|
179
|
+
"src/common/misc/prisma.indicator.ts",
|
|
180
|
+
"src/common/__tests__/health.controller.spec.ts",
|
|
181
|
+
"src/common/__tests__/prisma.indicator.spec.ts"
|
|
182
|
+
],
|
|
183
|
+
"packageJson": {
|
|
184
|
+
"dependencies": [
|
|
185
|
+
"prom-client",
|
|
186
|
+
"@willsoto/nestjs-prometheus",
|
|
187
|
+
"@nestjs/terminus"
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"users": {
|
|
192
|
+
"title": "Users module",
|
|
193
|
+
"description": "Admin-style user listing/lookup gated by permissions, plus the authenticated user's own /me resource and avatar upload.",
|
|
194
|
+
"default": true,
|
|
195
|
+
"requires": [
|
|
196
|
+
"auth"
|
|
197
|
+
],
|
|
198
|
+
"files": [
|
|
199
|
+
"src/users/**",
|
|
200
|
+
"test/users.spec.ts",
|
|
201
|
+
"test/current-user.spec.ts"
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
"media": {
|
|
205
|
+
"title": "File uploads (S3)",
|
|
206
|
+
"description": "MediaService and S3Service for public and private uploads, with multipart decorators.",
|
|
207
|
+
"default": true,
|
|
208
|
+
"requires": [
|
|
209
|
+
"auth"
|
|
210
|
+
],
|
|
211
|
+
"files": [
|
|
212
|
+
"src/media/**",
|
|
213
|
+
"src/users/dto/avatar.dto.ts"
|
|
214
|
+
],
|
|
215
|
+
"packageJson": {
|
|
216
|
+
"dependencies": [
|
|
217
|
+
"@aws-sdk/client-s3"
|
|
218
|
+
],
|
|
219
|
+
"devDependencies": [
|
|
220
|
+
"@types/multer"
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
"scheduler": {
|
|
225
|
+
"title": "Cron / interval scheduling",
|
|
226
|
+
"description": "@nestjs/schedule wired at the root so modules can declare @Cron and @Interval jobs.",
|
|
227
|
+
"default": true,
|
|
228
|
+
"packageJson": {
|
|
229
|
+
"dependencies": [
|
|
230
|
+
"@nestjs/schedule"
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
"http-client": {
|
|
235
|
+
"title": "Outbound HTTP client",
|
|
236
|
+
"description": "@nestjs/axios registered with a default timeout, for calling third-party APIs.",
|
|
237
|
+
"default": true,
|
|
238
|
+
"packageJson": {
|
|
239
|
+
"dependencies": [
|
|
240
|
+
"@nestjs/axios",
|
|
241
|
+
"axios"
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
"realtime": {
|
|
246
|
+
"title": "Socket.IO realtime layer",
|
|
247
|
+
"description": "An authenticated gateway, Redis-backed presence, a Redis Socket.IO adapter for horizontal scale, and WS auth/permission guards. Opt-in.",
|
|
248
|
+
"requires": [
|
|
249
|
+
"cache",
|
|
250
|
+
"auth"
|
|
251
|
+
],
|
|
252
|
+
"files": [
|
|
253
|
+
"src/realtime/**"
|
|
254
|
+
],
|
|
255
|
+
"packageJson": {
|
|
256
|
+
"dependencies": [
|
|
257
|
+
"@nestjs/websockets",
|
|
258
|
+
"@nestjs/platform-socket.io",
|
|
259
|
+
"socket.io",
|
|
260
|
+
"@socket.io/redis-adapter"
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
"notifications": {
|
|
265
|
+
"title": "Persistent user notifications",
|
|
266
|
+
"description": "A Notification model plus dispatch/read endpoints. Emits over the realtime layer when that feature is also on, and persists either way.",
|
|
267
|
+
"requires": [
|
|
268
|
+
"auth"
|
|
269
|
+
],
|
|
270
|
+
"files": [
|
|
271
|
+
"src/notifications/**",
|
|
272
|
+
"prisma/schema/notification.prisma",
|
|
273
|
+
"test/notifications.spec.ts"
|
|
274
|
+
]
|
|
275
|
+
},
|
|
276
|
+
"feature-flags": {
|
|
277
|
+
"title": "GrowthBook feature flags",
|
|
278
|
+
"description": "A session-aware FeatureFlagGuard and FeatureFlagService for gating routes on flags.",
|
|
279
|
+
"requires": [
|
|
280
|
+
"cache",
|
|
281
|
+
"auth"
|
|
282
|
+
],
|
|
283
|
+
"files": [
|
|
284
|
+
"src/common/services/feature-flag.service.ts",
|
|
285
|
+
"src/common/guards/feature-flag.guard.ts"
|
|
286
|
+
],
|
|
287
|
+
"packageJson": {
|
|
288
|
+
"dependencies": [
|
|
289
|
+
"@growthbook/growthbook"
|
|
290
|
+
]
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
"graphql": {
|
|
294
|
+
"title": "GraphQL endpoint",
|
|
295
|
+
"description": "Code-first GraphQL via Apollo, registered alongside the REST controllers. Resolvers in any feature module are picked up automatically.",
|
|
296
|
+
"files": [
|
|
297
|
+
"src/app.resolver.ts"
|
|
298
|
+
],
|
|
299
|
+
"packageJson": {
|
|
300
|
+
"dependencies": [
|
|
301
|
+
"@nestjs/graphql",
|
|
302
|
+
"@nestjs/apollo",
|
|
303
|
+
"@apollo/server",
|
|
304
|
+
"@as-integrations/express5",
|
|
305
|
+
"graphql"
|
|
306
|
+
]
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
"testing": {
|
|
310
|
+
"title": "Vitest unit + e2e suites",
|
|
311
|
+
"description": "Two Vitest projects, an AppFactory that boots the real app against real Postgres and Redis, and a test Docker stack.",
|
|
312
|
+
"default": true,
|
|
313
|
+
"requires": [
|
|
314
|
+
"docker"
|
|
315
|
+
],
|
|
316
|
+
"files": [
|
|
317
|
+
"test/**",
|
|
318
|
+
"src/**/__tests__/**",
|
|
319
|
+
"vitest.config.ts",
|
|
320
|
+
"compose.test.yml",
|
|
321
|
+
".env.test.example"
|
|
322
|
+
],
|
|
323
|
+
"packageJson": {
|
|
324
|
+
"devDependencies": [
|
|
325
|
+
"vitest",
|
|
326
|
+
"@vitest/coverage-v8",
|
|
327
|
+
"@vitest/ui",
|
|
328
|
+
"@suites/di.nestjs",
|
|
329
|
+
"@suites/doubles.vitest",
|
|
330
|
+
"@suites/unit",
|
|
331
|
+
"@golevelup/ts-vitest",
|
|
332
|
+
"@nestjs/testing",
|
|
333
|
+
"supertest",
|
|
334
|
+
"@types/supertest",
|
|
335
|
+
"fishery",
|
|
336
|
+
"unplugin-swc",
|
|
337
|
+
"dotenv-cli"
|
|
338
|
+
],
|
|
339
|
+
"scripts": [
|
|
340
|
+
"test",
|
|
341
|
+
"test:watch",
|
|
342
|
+
"test:ui",
|
|
343
|
+
"test:e2e",
|
|
344
|
+
"test:e2e:watch",
|
|
345
|
+
"test:e2e:ui",
|
|
346
|
+
"test:cov",
|
|
347
|
+
"test:all",
|
|
348
|
+
"test:all:ui",
|
|
349
|
+
"test:db:generate",
|
|
350
|
+
"test:db:push",
|
|
351
|
+
"test:db:seed",
|
|
352
|
+
"test:dc:up",
|
|
353
|
+
"test:dc:wait",
|
|
354
|
+
"test:dc:down",
|
|
355
|
+
"test:dc:recreate",
|
|
356
|
+
"test:dc:reinstall"
|
|
357
|
+
]
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
"docker": {
|
|
361
|
+
"title": "Docker Compose + image",
|
|
362
|
+
"description": "compose.yml running Postgres and Redis for local dev, a production Dockerfile, and the .bin/dc.ts stack wrapper.",
|
|
363
|
+
"default": true,
|
|
364
|
+
"files": [
|
|
365
|
+
"Dockerfile",
|
|
366
|
+
".dockerignore",
|
|
367
|
+
"compose.yml",
|
|
368
|
+
".bin/dc.ts"
|
|
369
|
+
],
|
|
370
|
+
"packageJson": {
|
|
371
|
+
"scripts": [
|
|
372
|
+
"dc:up",
|
|
373
|
+
"dc:down",
|
|
374
|
+
"dc:wait",
|
|
375
|
+
"dc:recreate",
|
|
376
|
+
"dc:reinstall",
|
|
377
|
+
"down",
|
|
378
|
+
"reinstall"
|
|
379
|
+
]
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
"ci": {
|
|
383
|
+
"title": "Forgejo Actions CI",
|
|
384
|
+
"description": "A workflow that spins up the test stack and runs both Vitest projects on pull requests.",
|
|
385
|
+
"default": true,
|
|
386
|
+
"files": [
|
|
387
|
+
".forgejo/**"
|
|
388
|
+
]
|
|
389
|
+
},
|
|
390
|
+
"secrets": {
|
|
391
|
+
"title": "Infisical secret sync",
|
|
392
|
+
"description": "`yarn secrets -e <env>` pulls the matching .env file instead of passing secrets around by hand.",
|
|
393
|
+
"default": true,
|
|
394
|
+
"files": [
|
|
395
|
+
".bin/secrets.ts"
|
|
396
|
+
],
|
|
397
|
+
"packageJson": {
|
|
398
|
+
"scripts": [
|
|
399
|
+
"secrets"
|
|
400
|
+
]
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
"hooks": [
|
|
405
|
+
{
|
|
406
|
+
"title": "seed .env from .env.example",
|
|
407
|
+
"run": "cp -n .env.example .env || true",
|
|
408
|
+
"optional": true
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
"title": "seed .env.test from .env.test.example",
|
|
412
|
+
"run": "cp -n .env.test.example .env.test || true",
|
|
413
|
+
"when": "testing",
|
|
414
|
+
"optional": true
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
"title": "yarn install",
|
|
418
|
+
"run": "yarn install",
|
|
419
|
+
"optional": true
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"title": "format (the feature strip leaves valid but unformatted code)",
|
|
423
|
+
"run": "yarn format",
|
|
424
|
+
"optional": true
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"title": "prisma generate",
|
|
428
|
+
"run": "yarn db:generate",
|
|
429
|
+
"optional": true
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
"title": "git init",
|
|
433
|
+
"run": "git init -q && git add -A && git commit -qm 'chore: scaffold {{name}} from the nest-api template'",
|
|
434
|
+
"optional": true
|
|
435
|
+
}
|
|
436
|
+
],
|
|
437
|
+
"nextSteps": [
|
|
438
|
+
"Edit .env — DATABASE_URL, REDIS_*, BETTER_AUTH_SECRET and SMTP_* have placeholder values.",
|
|
439
|
+
"yarn dc:up # start Postgres + Redis",
|
|
440
|
+
"yarn db:migrate # create the initial migration",
|
|
441
|
+
"yarn start # http://localhost:{{port}}/docs"
|
|
442
|
+
],
|
|
443
|
+
"aliasRoots": {
|
|
444
|
+
"@db/": null,
|
|
445
|
+
"@test/": "test/",
|
|
446
|
+
"@emails/": "emails/",
|
|
447
|
+
"@seeders/": "seeders/"
|
|
448
|
+
},
|
|
449
|
+
"generatedPaths": [
|
|
450
|
+
"prisma/generated/**"
|
|
451
|
+
]
|
|
452
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { Argv, Env } from './helpers.js';
|
|
2
|
+
|
|
3
|
+
interface ArgsResponse {
|
|
4
|
+
cmd: string;
|
|
5
|
+
env: Env;
|
|
6
|
+
name?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
class CommandBuilder {
|
|
10
|
+
private command: string[];
|
|
11
|
+
|
|
12
|
+
private constructor(private env: Env = 'dev') {
|
|
13
|
+
if (env === 'prod') {
|
|
14
|
+
this.command = ['dotenv -e .env.production --', 'prisma'];
|
|
15
|
+
} else if (env === 'test') {
|
|
16
|
+
this.command = ['dotenv -e .env.test --', 'prisma'];
|
|
17
|
+
} else {
|
|
18
|
+
this.command = ['prisma'];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static init(env: Env) {
|
|
23
|
+
return new CommandBuilder(env);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
generate() {
|
|
27
|
+
this.command.push('generate');
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
push() {
|
|
32
|
+
// push targets test/prod (reseeded), so accept column drops non-interactively.
|
|
33
|
+
this.command.push('db push --accept-data-loss');
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
reset() {
|
|
38
|
+
this.command.push('migrate reset --force');
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
studio() {
|
|
43
|
+
this.command.push('studio --browser none --port 5025');
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
seed() {
|
|
48
|
+
this.command.push('db seed');
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
build() {
|
|
53
|
+
return this.command.join(' ');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
class Database extends Argv {
|
|
58
|
+
private async getArgs(): Promise<ArgsResponse> {
|
|
59
|
+
const argv = await this.args
|
|
60
|
+
.option('command', {
|
|
61
|
+
type: 'string',
|
|
62
|
+
description: 'Specify the command to run',
|
|
63
|
+
choices: ['generate', 'push', 'seed', 'reset', 'studio'],
|
|
64
|
+
default: 'generate',
|
|
65
|
+
alias: 'c'
|
|
66
|
+
})
|
|
67
|
+
.option('name', {
|
|
68
|
+
type: 'string',
|
|
69
|
+
description:
|
|
70
|
+
'Use a specific name for the migration (only for migrate or migrate:create command)',
|
|
71
|
+
alias: 'n'
|
|
72
|
+
}).argv;
|
|
73
|
+
return {
|
|
74
|
+
cmd: argv.command,
|
|
75
|
+
env: this.getEnv(argv.env),
|
|
76
|
+
name: argv.name
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private async getCommand() {
|
|
81
|
+
const { env, cmd, name } = await this.getArgs();
|
|
82
|
+
const command = CommandBuilder.init(env);
|
|
83
|
+
if (cmd === 'push') {
|
|
84
|
+
return command.push().build();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (cmd === 'seed') {
|
|
88
|
+
return command.seed().build();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (cmd === 'reset') {
|
|
92
|
+
if (['test', 'prod'].includes(env)) {
|
|
93
|
+
this.err(
|
|
94
|
+
'Reset command is not allowed in test or production environment'
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
return command.reset().build();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (cmd === 'studio') {
|
|
101
|
+
if (env === 'prod') {
|
|
102
|
+
this.err('Studio command is not allowed in production environment');
|
|
103
|
+
}
|
|
104
|
+
return command.studio().build();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return command.generate().build();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async run() {
|
|
111
|
+
this.clear();
|
|
112
|
+
const command = await this.getCommand();
|
|
113
|
+
this.exec(command);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
static init() {
|
|
117
|
+
return new Database();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
Database.init()
|
|
122
|
+
.run()
|
|
123
|
+
.catch((e) => console.error(e.message));
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import shell from 'shelljs';
|
|
2
|
+
import yargs, { Argv as IArgv } from 'yargs';
|
|
3
|
+
import { hideBin } from 'yargs/helpers';
|
|
4
|
+
|
|
5
|
+
export type Env = 'dev' | 'prod' | 'test';
|
|
6
|
+
|
|
7
|
+
export abstract class Argv {
|
|
8
|
+
protected args: IArgv<any>;
|
|
9
|
+
|
|
10
|
+
constructor() {
|
|
11
|
+
this.args = yargs(hideBin(process.argv))
|
|
12
|
+
.help('help')
|
|
13
|
+
.alias('help', 'h')
|
|
14
|
+
.option('env', {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Specify the environment to use',
|
|
17
|
+
choices: [
|
|
18
|
+
'dev',
|
|
19
|
+
'development',
|
|
20
|
+
'prod',
|
|
21
|
+
'production',
|
|
22
|
+
'test',
|
|
23
|
+
'testing'
|
|
24
|
+
],
|
|
25
|
+
default: 'dev',
|
|
26
|
+
alias: 'e'
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
getEnv(env: string): Env {
|
|
31
|
+
return ['test', 'testing'].includes(env)
|
|
32
|
+
? 'test'
|
|
33
|
+
: ['prod', 'production'].includes(env)
|
|
34
|
+
? 'prod'
|
|
35
|
+
: 'dev';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
clear() {
|
|
39
|
+
console.clear();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
err(message: string) {
|
|
43
|
+
throw new Error(`❌ ${message}`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
exec(command: string) {
|
|
47
|
+
shell.exec(command);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import shell from 'shelljs';
|
|
2
|
+
import yargs from 'yargs';
|
|
3
|
+
import { hideBin } from 'yargs/helpers';
|
|
4
|
+
|
|
5
|
+
const getArg = async () => {
|
|
6
|
+
const argv = await yargs(hideBin(process.argv))
|
|
7
|
+
.option('env', {
|
|
8
|
+
alias: 'e',
|
|
9
|
+
description: 'The environment [dev, test, prod, etc.]',
|
|
10
|
+
type: 'string',
|
|
11
|
+
choices: [
|
|
12
|
+
'dev',
|
|
13
|
+
'development',
|
|
14
|
+
'test',
|
|
15
|
+
'testing',
|
|
16
|
+
'staging',
|
|
17
|
+
'prod',
|
|
18
|
+
'production'
|
|
19
|
+
],
|
|
20
|
+
default: 'development'
|
|
21
|
+
})
|
|
22
|
+
.help()
|
|
23
|
+
.alias('help', 'h').argv;
|
|
24
|
+
|
|
25
|
+
return ['dev', 'development'].includes(argv.env)
|
|
26
|
+
? 'dev'
|
|
27
|
+
: ['test', 'testing'].includes(argv.env)
|
|
28
|
+
? 'test'
|
|
29
|
+
: ['prod', 'production'].includes(argv.env)
|
|
30
|
+
? 'prod'
|
|
31
|
+
: 'staging';
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const getEnvFile = (env: string) => {
|
|
35
|
+
const envMap: Record<string, string> = {
|
|
36
|
+
dev: '.env',
|
|
37
|
+
test: '.env.test',
|
|
38
|
+
staging: '.env.staging',
|
|
39
|
+
prod: '.env.production'
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return envMap[env];
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// The project ID identifies one organisation's vault, so it is read from the
|
|
46
|
+
// environment rather than baked in — a hardcoded value would follow every copy
|
|
47
|
+
// of this scaffold to projects it has nothing to do with.
|
|
48
|
+
const PROJECT_ID = process.env.INFISICAL_PROJECT_ID;
|
|
49
|
+
const SECRET_PATH = process.env.INFISICAL_PATH ?? '/';
|
|
50
|
+
|
|
51
|
+
const getCmd = (env: string) => {
|
|
52
|
+
if (!PROJECT_ID) {
|
|
53
|
+
throw new Error('INFISICAL_PROJECT_ID is not set — nothing to fetch from.');
|
|
54
|
+
}
|
|
55
|
+
return `infisical export --projectId="${PROJECT_ID}" --path=${SECRET_PATH} --env=${env} > ${getEnvFile(
|
|
56
|
+
env
|
|
57
|
+
)}`;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const log = (env: string) => console.log(`Fetching secrets for '${env}'...`);
|
|
61
|
+
|
|
62
|
+
(async () => {
|
|
63
|
+
const env = await getArg();
|
|
64
|
+
const command = getCmd(env);
|
|
65
|
+
log(env);
|
|
66
|
+
shell.exec(command);
|
|
67
|
+
process.exit(0);
|
|
68
|
+
})().catch(console.error);
|