@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,21 @@
|
|
|
1
|
+
# Copy to .env.
|
|
2
|
+
|
|
3
|
+
APP_ENV='development'
|
|
4
|
+
LOG_LEVEL='debug'
|
|
5
|
+
|
|
6
|
+
# The same database your API uses — this worker talks to it directly rather
|
|
7
|
+
# than over HTTP, so the schema must match.
|
|
8
|
+
DATABASE_URL='postgresql://root:postgres@localhost:5432/main'
|
|
9
|
+
|
|
10
|
+
# The same Redis your API produces jobs to. A mismatch here is silent: the
|
|
11
|
+
# worker connects fine and simply never receives anything.
|
|
12
|
+
REDIS_HOST='localhost'
|
|
13
|
+
REDIS_PORT='6379'
|
|
14
|
+
REDIS_USER=''
|
|
15
|
+
REDIS_PASSWORD=''
|
|
16
|
+
|
|
17
|
+
# @feature:start browser
|
|
18
|
+
# Empty = use Puppeteer's bundled Chromium. Set this in a slim container image
|
|
19
|
+
# where Chromium is installed separately.
|
|
20
|
+
PUPPETEER_EXECUTABLE_PATH=''
|
|
21
|
+
# @feature:end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Build and Push
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
jobs:
|
|
8
|
+
build-and-push:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- name: Checkout repository
|
|
13
|
+
uses: actions/checkout@v4
|
|
14
|
+
with:
|
|
15
|
+
submodules: recursive
|
|
16
|
+
|
|
17
|
+
- name: Setup Docker Buildx
|
|
18
|
+
uses: docker/setup-buildx-action@v1
|
|
19
|
+
|
|
20
|
+
- name: Login to Registry
|
|
21
|
+
uses: docker/login-action@v3
|
|
22
|
+
with:
|
|
23
|
+
registry: ${{ secrets.REGISTRY_URL }}
|
|
24
|
+
username: ${{ secrets.DK_USER }}
|
|
25
|
+
password: ${{ secrets.DK_ACCESS_TOKEN }}
|
|
26
|
+
|
|
27
|
+
- name: Generate image tag
|
|
28
|
+
id: meta
|
|
29
|
+
run: |
|
|
30
|
+
DATE=$(date +'%y_%m_%d')
|
|
31
|
+
RAND=$(printf '%05d' "$((RANDOM % 100000))")
|
|
32
|
+
echo "TAG=${DATE}_${RAND}" >> "$GITHUB_OUTPUT"
|
|
33
|
+
|
|
34
|
+
- name: Build and Push
|
|
35
|
+
uses: docker/build-push-action@v6
|
|
36
|
+
with:
|
|
37
|
+
push: true
|
|
38
|
+
context: .
|
|
39
|
+
tags: |
|
|
40
|
+
${{ secrets.REGISTRY }}/${{ github.repository }}:latest
|
|
41
|
+
${{ secrets.REGISTRY }}/${{ github.repository }}:${{ steps.meta.outputs.TAG }}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
24.16
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Prisma places its engine binaries inside node_modules and cannot do so under
|
|
2
|
+
# Yarn's default PnP linker — `prisma generate` fails with EROFS on a path
|
|
3
|
+
# outside the project. Everything else here works under PnP; this one does not.
|
|
4
|
+
nodeLinker: node-modules
|
|
5
|
+
enableTelemetry: false
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Stage 1: Build
|
|
2
|
+
FROM aurostack.dev/wesnetech/nodejs:24 AS build
|
|
3
|
+
|
|
4
|
+
# @feature:start browser
|
|
5
|
+
# Chromium comes from apk in the runtime stage; don't download a second copy.
|
|
6
|
+
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
|
7
|
+
# @feature:end
|
|
8
|
+
|
|
9
|
+
WORKDIR /app
|
|
10
|
+
|
|
11
|
+
# The image bundles Yarn 1.x; corepack switches to the Yarn 4 release pinned by
|
|
12
|
+
# package.json's `packageManager`, which is what can read yarn.lock.
|
|
13
|
+
RUN corepack enable
|
|
14
|
+
|
|
15
|
+
# yarn.lock and .yarnrc.yml must both land here: --immutable requires a lockfile,
|
|
16
|
+
# and without .yarnrc.yml Yarn uses PnP, which Prisma cannot generate under.
|
|
17
|
+
COPY package.json yarn.lock .yarnrc.yml ./
|
|
18
|
+
# Long timeout, one request at a time: tolerant of a slow or flaky registry.
|
|
19
|
+
RUN YARN_HTTP_TIMEOUT=300000 YARN_NETWORK_CONCURRENCY=1 yarn install --immutable
|
|
20
|
+
|
|
21
|
+
COPY tsconfig*.json prisma.config.ts ./
|
|
22
|
+
COPY .bin ./.bin
|
|
23
|
+
COPY prisma ./prisma
|
|
24
|
+
RUN yarn db:generate
|
|
25
|
+
|
|
26
|
+
COPY src ./src
|
|
27
|
+
RUN yarn build
|
|
28
|
+
|
|
29
|
+
# Remove dev dependencies after build is done. Yarn 4 has no
|
|
30
|
+
# `install --production`; focusing the root workspace is its equivalent.
|
|
31
|
+
RUN yarn workspaces focus --all --production
|
|
32
|
+
|
|
33
|
+
# Stage 2: Production
|
|
34
|
+
FROM aurostack.dev/wesnetech/nodejs:24
|
|
35
|
+
WORKDIR /app
|
|
36
|
+
|
|
37
|
+
# @feature:start browser
|
|
38
|
+
RUN apk add --no-cache \
|
|
39
|
+
chromium \
|
|
40
|
+
nss \
|
|
41
|
+
freetype \
|
|
42
|
+
harfbuzz \
|
|
43
|
+
ca-certificates \
|
|
44
|
+
ttf-freefont \
|
|
45
|
+
udev
|
|
46
|
+
|
|
47
|
+
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
|
|
48
|
+
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
|
49
|
+
# @feature:end
|
|
50
|
+
|
|
51
|
+
COPY package.json ./
|
|
52
|
+
# @feature:start pm2
|
|
53
|
+
COPY ecosystem.config.cjs ./
|
|
54
|
+
# @feature:end
|
|
55
|
+
COPY --from=build /app/node_modules ./node_modules
|
|
56
|
+
COPY --from=build /app/dist ./dist
|
|
57
|
+
|
|
58
|
+
# @feature:start pm2
|
|
59
|
+
# pm2-runtime ships in the base image.
|
|
60
|
+
CMD [ "pm2-runtime", "start", "ecosystem.config.cjs" ]
|
|
61
|
+
# @feature:else
|
|
62
|
+
CMD [ "node", "dist/src/index.js" ]
|
|
63
|
+
# @feature:end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Stage 1: Build
|
|
2
|
+
FROM aurostack.dev/wesnetech/nodejs:24 AS build
|
|
3
|
+
|
|
4
|
+
# @feature:start browser
|
|
5
|
+
# Chromium comes from apk in the runtime stage; don't download a second copy.
|
|
6
|
+
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
|
7
|
+
# @feature:end
|
|
8
|
+
|
|
9
|
+
WORKDIR /app
|
|
10
|
+
|
|
11
|
+
# The image bundles Yarn 1.x; corepack switches to the Yarn 4 release pinned by
|
|
12
|
+
# package.json's `packageManager`, which is what can read yarn.lock.
|
|
13
|
+
RUN corepack enable
|
|
14
|
+
|
|
15
|
+
# yarn.lock and .yarnrc.yml must both land here: --immutable requires a lockfile,
|
|
16
|
+
# and without .yarnrc.yml Yarn uses PnP, which Prisma cannot generate under.
|
|
17
|
+
COPY package.json yarn.lock .yarnrc.yml ./
|
|
18
|
+
# Long timeout, one request at a time: tolerant of a slow or flaky registry.
|
|
19
|
+
RUN YARN_HTTP_TIMEOUT=300000 YARN_NETWORK_CONCURRENCY=1 yarn install --immutable
|
|
20
|
+
|
|
21
|
+
COPY tsconfig*.json prisma.config.ts ./
|
|
22
|
+
COPY .bin ./.bin
|
|
23
|
+
COPY prisma ./prisma
|
|
24
|
+
RUN yarn db:generate
|
|
25
|
+
|
|
26
|
+
COPY src ./src
|
|
27
|
+
RUN yarn build
|
|
28
|
+
|
|
29
|
+
# Stage 2: Production
|
|
30
|
+
FROM aurostack.dev/wesnetech/nodejs:24
|
|
31
|
+
WORKDIR /app
|
|
32
|
+
|
|
33
|
+
# @feature:start browser
|
|
34
|
+
RUN apk add --no-cache \
|
|
35
|
+
chromium \
|
|
36
|
+
nss \
|
|
37
|
+
freetype \
|
|
38
|
+
harfbuzz \
|
|
39
|
+
ca-certificates \
|
|
40
|
+
ttf-freefont \
|
|
41
|
+
udev
|
|
42
|
+
|
|
43
|
+
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
|
|
44
|
+
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
|
45
|
+
# @feature:end
|
|
46
|
+
|
|
47
|
+
COPY package.json ./
|
|
48
|
+
# @feature:start pm2
|
|
49
|
+
COPY ecosystem.config.cjs ./
|
|
50
|
+
# @feature:end
|
|
51
|
+
COPY --from=build /app/node_modules ./node_modules
|
|
52
|
+
COPY --from=build /app/dist ./dist
|
|
53
|
+
|
|
54
|
+
# @feature:start pm2
|
|
55
|
+
# pm2-runtime ships in the base image.
|
|
56
|
+
CMD [ "pm2-runtime", "start", "ecosystem.config.cjs" ]
|
|
57
|
+
# @feature:else
|
|
58
|
+
CMD [ "node", "dist/src/index.js" ]
|
|
59
|
+
# @feature:end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# compiled output
|
|
2
|
+
/dist
|
|
3
|
+
/node_modules
|
|
4
|
+
|
|
5
|
+
# Logs
|
|
6
|
+
logs
|
|
7
|
+
*.log
|
|
8
|
+
npm-debug.log*
|
|
9
|
+
pnpm-debug.log*
|
|
10
|
+
yarn-debug.log*
|
|
11
|
+
yarn-error.log*
|
|
12
|
+
lerna-debug.log*
|
|
13
|
+
|
|
14
|
+
# OS
|
|
15
|
+
.DS_Store
|
|
16
|
+
|
|
17
|
+
# Tests
|
|
18
|
+
/coverage
|
|
19
|
+
/.nyc_output
|
|
20
|
+
|
|
21
|
+
# IDEs and editors
|
|
22
|
+
/.idea
|
|
23
|
+
.project
|
|
24
|
+
.classpath
|
|
25
|
+
.c9/
|
|
26
|
+
*.launch
|
|
27
|
+
.settings/
|
|
28
|
+
*.sublime-workspace
|
|
29
|
+
|
|
30
|
+
# IDE - VSCode
|
|
31
|
+
.vscode/*
|
|
32
|
+
!.vscode/settings.json
|
|
33
|
+
!.vscode/tasks.json
|
|
34
|
+
!.vscode/launch.json
|
|
35
|
+
!.vscode/extensions.json
|
|
36
|
+
|
|
37
|
+
.env
|
|
38
|
+
.env.test
|
|
39
|
+
.env.production
|
|
40
|
+
.npmrc
|
|
41
|
+
docker-compose.dev.yaml
|
|
42
|
+
|
|
43
|
+
package-lock.json
|
|
44
|
+
|
|
45
|
+
docs/
|
|
46
|
+
prisma/schema.dbml
|
|
47
|
+
|
|
48
|
+
tmp/
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import tseslint from 'typescript-eslint';
|
|
3
|
+
import prettier from 'eslint-config-prettier';
|
|
4
|
+
import globals from 'globals';
|
|
5
|
+
|
|
6
|
+
export default tseslint.config(
|
|
7
|
+
{
|
|
8
|
+
ignores: ['node_modules/', 'dist/', 'tmp/', 'ecosystem.config.cjs'],
|
|
9
|
+
},
|
|
10
|
+
js.configs.recommended,
|
|
11
|
+
...tseslint.configs.recommendedTypeChecked.map((config) => ({
|
|
12
|
+
...config,
|
|
13
|
+
files: ['src/**/*.ts'],
|
|
14
|
+
})),
|
|
15
|
+
{
|
|
16
|
+
files: ['src/**/*.ts'],
|
|
17
|
+
languageOptions: {
|
|
18
|
+
globals: globals.node,
|
|
19
|
+
parserOptions: {
|
|
20
|
+
projectService: true,
|
|
21
|
+
tsconfigRootDir: import.meta.dirname,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
rules: {
|
|
25
|
+
'@typescript-eslint/no-unused-vars': ['warn'],
|
|
26
|
+
'@typescript-eslint/no-explicit-any': ['off'],
|
|
27
|
+
'@typescript-eslint/no-unsafe-call': ['off'],
|
|
28
|
+
'@typescript-eslint/no-unsafe-member-access': ['off'],
|
|
29
|
+
'@typescript-eslint/no-unsafe-argument': ['off'],
|
|
30
|
+
'@typescript-eslint/no-unsafe-enum-comparison': ['off'],
|
|
31
|
+
'@typescript-eslint/no-unsafe-return': ['off'],
|
|
32
|
+
'@typescript-eslint/no-unsafe-assignment': ['off'],
|
|
33
|
+
'@typescript-eslint/no-redundant-type-constituents': ['off'],
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
prettier,
|
|
37
|
+
);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "collector",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/src/index.js",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"packageManager": "yarn@4.14.1",
|
|
8
|
+
"imports": {
|
|
9
|
+
"#app/*": {
|
|
10
|
+
"development": "./src/*",
|
|
11
|
+
"default": "./dist/src/*"
|
|
12
|
+
},
|
|
13
|
+
"#prisma/*": {
|
|
14
|
+
"development": "./prisma/generated/*",
|
|
15
|
+
"default": "./dist/prisma/generated/*"
|
|
16
|
+
},
|
|
17
|
+
"#utils/*": {
|
|
18
|
+
"development": "./src/utils/*",
|
|
19
|
+
"default": "./dist/src/utils/*"
|
|
20
|
+
},
|
|
21
|
+
"#lib/*": {
|
|
22
|
+
"development": "./src/lib/*",
|
|
23
|
+
"default": "./dist/src/lib/*"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"dev": "tsx --conditions=development src/index.ts",
|
|
28
|
+
"dev:watch": "tsx watch --conditions=development src/index.ts",
|
|
29
|
+
"build": "tsc",
|
|
30
|
+
"start": "node dist/src/index.js",
|
|
31
|
+
"secrets": "tsx --conditions=development .bin/secrets",
|
|
32
|
+
"db:generate": "tsx --conditions=development ./.bin/db.ts",
|
|
33
|
+
"typecheck": "tsc --noEmit",
|
|
34
|
+
"lint": "eslint .",
|
|
35
|
+
"lint:fix": "eslint . --fix",
|
|
36
|
+
"format": "prettier --write .",
|
|
37
|
+
"format:check": "prettier --check ."
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@paralleldrive/cuid2": "^3.3.0",
|
|
41
|
+
"@prisma/adapter-pg": "^7.8.0",
|
|
42
|
+
"@prisma/client": "^7.8.0",
|
|
43
|
+
"bullmq": "^5.79.2",
|
|
44
|
+
"dotenv": "^17.4.2",
|
|
45
|
+
"moment": "^2.30.1",
|
|
46
|
+
"pino": "^10.3.1",
|
|
47
|
+
"puppeteer": "^25.3.0",
|
|
48
|
+
"shelljs": "^0.10.0",
|
|
49
|
+
"yargs": "^18.0.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@eslint/js": "^10.0.1",
|
|
53
|
+
"@types/node": "^26.1.0",
|
|
54
|
+
"@types/shelljs": "^0.10.0",
|
|
55
|
+
"@types/yargs": "^17.0.35",
|
|
56
|
+
"eslint": "^10.6.0",
|
|
57
|
+
"eslint-config-prettier": "^10.1.8",
|
|
58
|
+
"globals": "^17.7.0",
|
|
59
|
+
"pino-pretty": "^13.1.3",
|
|
60
|
+
"prettier": "^3.9.4",
|
|
61
|
+
"prisma": "^7.8.0",
|
|
62
|
+
"prisma-dbml-generator": "^0.12.0",
|
|
63
|
+
"tsx": "^4.22.4",
|
|
64
|
+
"typescript": "^6.0.3",
|
|
65
|
+
"typescript-eslint": "^8.62.1"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
generated/
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Datasource + generators only.
|
|
2
|
+
//
|
|
3
|
+
// This worker ships a single placeholder model (below). It reads and writes the same
|
|
4
|
+
// database your API owns, so the schema belongs there — copy the API's
|
|
5
|
+
// `prisma/schema/*.prisma` in beside this file, or (better) point both repos at
|
|
6
|
+
// one shared schema via a git submodule, so a migration on one side cannot
|
|
7
|
+
// leave the other compiling against columns that no longer exist.
|
|
8
|
+
//
|
|
9
|
+
// `yarn db:generate` writes the client to `prisma/generated`, which the
|
|
10
|
+
// `#prisma/*` subpath import in package.json resolves to.
|
|
11
|
+
|
|
12
|
+
datasource db {
|
|
13
|
+
provider = "postgresql"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
generator client {
|
|
17
|
+
provider = "prisma-client"
|
|
18
|
+
output = "../generated"
|
|
19
|
+
moduleFormat = "esm"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/// Placeholder so `prisma generate` emits a usable client on a fresh scaffold —
|
|
23
|
+
/// a model-less schema generates nothing, and every `#prisma/client.js` import
|
|
24
|
+
/// then fails to resolve.
|
|
25
|
+
///
|
|
26
|
+
/// It is `User` with an `email` specifically because `src/db.ts` ships
|
|
27
|
+
/// `findById` / `findByEmail` client extensions typed against this model.
|
|
28
|
+
/// Replace it with the API's real `User` (and the rest of its schema) rather
|
|
29
|
+
/// than deleting it outright, or those extensions stop compiling.
|
|
30
|
+
model User {
|
|
31
|
+
id String @id @default(cuid())
|
|
32
|
+
email String @unique
|
|
33
|
+
createdAt DateTime @default(now()) @map("created_at")
|
|
34
|
+
|
|
35
|
+
@@map("user")
|
|
36
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import { defineConfig } from 'prisma/config';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
schema: 'prisma/schema',
|
|
6
|
+
// migrations: {
|
|
7
|
+
// path: 'prisma/migrations',
|
|
8
|
+
// seed: 'ts-node prisma/seeders'
|
|
9
|
+
// },
|
|
10
|
+
datasource: {
|
|
11
|
+
url: process.env['DATABASE_URL'] || ''
|
|
12
|
+
}
|
|
13
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
|
|
3
|
+
interface App {
|
|
4
|
+
env: string;
|
|
5
|
+
logLevel: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface Database {
|
|
9
|
+
url: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface Redis {
|
|
13
|
+
host: string;
|
|
14
|
+
port: number;
|
|
15
|
+
user?: string | undefined;
|
|
16
|
+
password?: string | undefined;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// @feature:start browser
|
|
20
|
+
interface Puppeteer {
|
|
21
|
+
executablePath: string;
|
|
22
|
+
}
|
|
23
|
+
// @feature:end
|
|
24
|
+
|
|
25
|
+
interface Config {
|
|
26
|
+
app: App;
|
|
27
|
+
database: Database;
|
|
28
|
+
redis: Redis;
|
|
29
|
+
puppeteer: Puppeteer; // @feature browser
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const config: Config = {
|
|
33
|
+
app: {
|
|
34
|
+
env: process.env.APP_ENV ?? 'development',
|
|
35
|
+
logLevel: process.env.LOG_LEVEL ?? 'debug'
|
|
36
|
+
},
|
|
37
|
+
database: {
|
|
38
|
+
url: process.env.DATABASE_URL ?? ''
|
|
39
|
+
},
|
|
40
|
+
redis: {
|
|
41
|
+
host: process.env.REDIS_HOST ?? 'localhost',
|
|
42
|
+
port: parseInt(process.env.REDIS_PORT ?? '6379', 10),
|
|
43
|
+
user: process.env.REDIS_USER,
|
|
44
|
+
password: process.env.REDIS_PASSWORD
|
|
45
|
+
},
|
|
46
|
+
// @feature:start browser
|
|
47
|
+
// Empty means "let Puppeteer use its bundled Chromium". In a slim container
|
|
48
|
+
// image you install Chromium separately and point this at it.
|
|
49
|
+
puppeteer: {
|
|
50
|
+
executablePath: process.env.PUPPETEER_EXECUTABLE_PATH ?? ''
|
|
51
|
+
}
|
|
52
|
+
// @feature:end
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default config;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { PrismaPg } from '@prisma/adapter-pg';
|
|
2
|
+
import config from '#app/config.js';
|
|
3
|
+
import { Prisma, PrismaClient } from '#prisma/client.js';
|
|
4
|
+
import type { PaginationOptions, PaginationMetaData } from '#app/types.js';
|
|
5
|
+
import { getPaginationInfo } from '#app/utils/helpers.js';
|
|
6
|
+
|
|
7
|
+
interface FindByEmailOptions {
|
|
8
|
+
email: string;
|
|
9
|
+
mode?: 'default' | 'insensitive' | undefined;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const setupExtensions = (db: PrismaClient) =>
|
|
13
|
+
db.$extends({
|
|
14
|
+
model: {
|
|
15
|
+
$allModels: {
|
|
16
|
+
async exists<
|
|
17
|
+
Type,
|
|
18
|
+
Arguments,
|
|
19
|
+
Result extends Prisma.Result<Type, Arguments, 'count'>
|
|
20
|
+
>(this: Type, where: Prisma.Args<Type, 'count'>['where']) {
|
|
21
|
+
const ctx = Prisma.getExtensionContext(this) as any;
|
|
22
|
+
const counts: Result = await ctx.count({ where });
|
|
23
|
+
return Boolean(counts);
|
|
24
|
+
},
|
|
25
|
+
async paginate<
|
|
26
|
+
Type,
|
|
27
|
+
Args extends Omit<
|
|
28
|
+
Prisma.Args<Type, 'findMany'>,
|
|
29
|
+
'skip' | 'take' | 'cursor'
|
|
30
|
+
>,
|
|
31
|
+
Result extends Prisma.Result<Type, Args, 'findMany'>
|
|
32
|
+
>(this: Type, args: Args & PaginationOptions) {
|
|
33
|
+
const { limit, page, where, ...rest } = args;
|
|
34
|
+
const {
|
|
35
|
+
skip,
|
|
36
|
+
take,
|
|
37
|
+
page: currentPage
|
|
38
|
+
} = getPaginationInfo({
|
|
39
|
+
limit,
|
|
40
|
+
page
|
|
41
|
+
});
|
|
42
|
+
const ctx = Prisma.getExtensionContext(this) as any;
|
|
43
|
+
const [list, total]: [Result, number] = await Promise.all([
|
|
44
|
+
ctx.findMany({ ...rest, skip, take, where }),
|
|
45
|
+
ctx.count({ where })
|
|
46
|
+
]);
|
|
47
|
+
const meta: PaginationMetaData = {
|
|
48
|
+
total,
|
|
49
|
+
currentPage,
|
|
50
|
+
pageSize: list.length,
|
|
51
|
+
lastPage: Math.ceil(total / take) || 1
|
|
52
|
+
};
|
|
53
|
+
const result: [Result, PaginationMetaData] = [list, meta];
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
user: {
|
|
58
|
+
async findById<
|
|
59
|
+
Type,
|
|
60
|
+
Args extends Omit<Prisma.UserFindUniqueArgs, 'where'>,
|
|
61
|
+
Result extends Prisma.Result<Type, Args, 'findUnique'>
|
|
62
|
+
>(this: Type, id: string, args?: Args): Promise<Result> {
|
|
63
|
+
const ctx = Prisma.getExtensionContext(this) as any;
|
|
64
|
+
return await ctx.findUnique({
|
|
65
|
+
where: { id },
|
|
66
|
+
...args
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
async findByEmail<
|
|
70
|
+
Type,
|
|
71
|
+
Args extends Omit<Prisma.UserFindFirstArgs, 'where'>,
|
|
72
|
+
Result extends Prisma.Result<Type, Args, 'findFirst'>
|
|
73
|
+
>(
|
|
74
|
+
this: Type,
|
|
75
|
+
{ email, mode }: FindByEmailOptions,
|
|
76
|
+
args?: Args
|
|
77
|
+
): Promise<Result> {
|
|
78
|
+
const ctx = Prisma.getExtensionContext(this) as any;
|
|
79
|
+
return await ctx.findFirst({
|
|
80
|
+
where: { email: { equals: email, mode: mode || 'default' } },
|
|
81
|
+
...args
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
export class DB extends PrismaClient {
|
|
89
|
+
static #instance: DB | null = null;
|
|
90
|
+
|
|
91
|
+
private constructor() {
|
|
92
|
+
const connectionString = config.database.url;
|
|
93
|
+
const adapter = new PrismaPg({ connectionString });
|
|
94
|
+
super({ adapter });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public static getInstance(): DB {
|
|
98
|
+
if (!DB.#instance) {
|
|
99
|
+
DB.#instance = new DB();
|
|
100
|
+
}
|
|
101
|
+
return DB.#instance;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
public static get instance() {
|
|
105
|
+
return DB.getInstance();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Extended version of client with custom methods, etc.
|
|
110
|
+
*/
|
|
111
|
+
get $() {
|
|
112
|
+
return setupExtensions(this);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async disconnect() {
|
|
116
|
+
await this.$disconnect();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import pino, { stdTimeFunctions, levels } from 'pino';
|
|
2
|
+
import config from '#app/config.js';
|
|
3
|
+
|
|
4
|
+
const PINO_CONSOLE_TARGET = {
|
|
5
|
+
target: 'pino-pretty',
|
|
6
|
+
options: {
|
|
7
|
+
ignore: 'pid,hostname',
|
|
8
|
+
translateTime: 'SYS:dd-mm-yyyy HH:MM:ss',
|
|
9
|
+
singleLine: true,
|
|
10
|
+
colorize: true
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const PINO_FILE_TARGET = {
|
|
15
|
+
target: 'pino/file',
|
|
16
|
+
options: {
|
|
17
|
+
destination: 'logs/collector.log',
|
|
18
|
+
mkdir: true
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const PINO_CONSOLE_TARGET_PROD = {
|
|
23
|
+
target: 'pino/file',
|
|
24
|
+
options: {
|
|
25
|
+
destination: 1
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const logger = pino({
|
|
30
|
+
level: config.app.logLevel,
|
|
31
|
+
transport:
|
|
32
|
+
config.app.env === 'production'
|
|
33
|
+
? { targets: [PINO_CONSOLE_TARGET_PROD, PINO_FILE_TARGET] }
|
|
34
|
+
: { targets: [PINO_CONSOLE_TARGET, PINO_FILE_TARGET] },
|
|
35
|
+
base: {
|
|
36
|
+
service: 'collector',
|
|
37
|
+
env: config.app.env
|
|
38
|
+
},
|
|
39
|
+
timestamp: stdTimeFunctions.isoTime,
|
|
40
|
+
mixin(_mergeObject, level) {
|
|
41
|
+
return { levelLabel: levels.labels[level] };
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export default logger;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface PaginationOptions {
|
|
2
|
+
page?: number | undefined;
|
|
3
|
+
limit?: number | undefined;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface PaginationInfo {
|
|
7
|
+
skip: number;
|
|
8
|
+
take: number;
|
|
9
|
+
page: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface PaginationMetaData {
|
|
13
|
+
total: number;
|
|
14
|
+
pageSize: number;
|
|
15
|
+
currentPage: number;
|
|
16
|
+
lastPage: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface Paginated<T> extends PaginationMetaData {
|
|
20
|
+
list: T[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type RawValue = string | number | null | undefined;
|