@kabyeon/nexusjs 0.6.5
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 +860 -0
- package/dist/auth/auth.controller.d.ts +175 -0
- package/dist/auth/auth.controller.d.ts.map +1 -0
- package/dist/auth/auth.d.ts +47 -0
- package/dist/auth/auth.d.ts.map +1 -0
- package/dist/auth/auth.module.d.ts +34 -0
- package/dist/auth/auth.module.d.ts.map +1 -0
- package/dist/auth/auth.service.d.ts +192 -0
- package/dist/auth/auth.service.d.ts.map +1 -0
- package/dist/auth/decorators/current-user.d.ts +58 -0
- package/dist/auth/decorators/current-user.d.ts.map +1 -0
- package/dist/auth/index.d.ts +43 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +730 -0
- package/dist/auth/index.js.map +25 -0
- package/dist/auth/middleware.d.ts +50 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/types.d.ts +135 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/cache/cache.module.d.ts +22 -0
- package/dist/cache/cache.module.d.ts.map +1 -0
- package/dist/cache/cache.service.d.ts +37 -0
- package/dist/cache/cache.service.d.ts.map +1 -0
- package/dist/cache/index.d.ts +9 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +814 -0
- package/dist/cache/index.js.map +25 -0
- package/dist/cache/stores/drizzle.d.ts +76 -0
- package/dist/cache/stores/drizzle.d.ts.map +1 -0
- package/dist/cache/stores/index.d.ts +10 -0
- package/dist/cache/stores/index.d.ts.map +1 -0
- package/dist/cache/stores/memory.d.ts +34 -0
- package/dist/cache/stores/memory.d.ts.map +1 -0
- package/dist/cache/stores/redis.d.ts +46 -0
- package/dist/cache/stores/redis.d.ts.map +1 -0
- package/dist/cache/types.d.ts +88 -0
- package/dist/cache/types.d.ts.map +1 -0
- package/dist/cli/commands/config.d.ts +44 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/db-generate.d.ts +20 -0
- package/dist/cli/commands/db-generate.d.ts.map +1 -0
- package/dist/cli/commands/db-migrate.d.ts +33 -0
- package/dist/cli/commands/db-migrate.d.ts.map +1 -0
- package/dist/cli/commands/db-seed.d.ts +43 -0
- package/dist/cli/commands/db-seed.d.ts.map +1 -0
- package/dist/cli/commands/index.d.ts +11 -0
- package/dist/cli/commands/index.d.ts.map +1 -0
- package/dist/cli/commands/info.d.ts +11 -0
- package/dist/cli/commands/info.d.ts.map +1 -0
- package/dist/cli/commands/init.d.ts +38 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/make-auth.d.ts +17 -0
- package/dist/cli/commands/make-auth.d.ts.map +1 -0
- package/dist/cli/commands/make-controller.d.ts +16 -0
- package/dist/cli/commands/make-controller.d.ts.map +1 -0
- package/dist/cli/commands/make-crud.d.ts +28 -0
- package/dist/cli/commands/make-crud.d.ts.map +1 -0
- package/dist/cli/commands/make-listener.d.ts +15 -0
- package/dist/cli/commands/make-listener.d.ts.map +1 -0
- package/dist/cli/commands/make-middleware.d.ts +7 -0
- package/dist/cli/commands/make-middleware.d.ts.map +1 -0
- package/dist/cli/commands/make-migration.d.ts +21 -0
- package/dist/cli/commands/make-migration.d.ts.map +1 -0
- package/dist/cli/commands/make-model.d.ts +22 -0
- package/dist/cli/commands/make-model.d.ts.map +1 -0
- package/dist/cli/commands/make-module.d.ts +11 -0
- package/dist/cli/commands/make-module.d.ts.map +1 -0
- package/dist/cli/commands/make-queue.d.ts +17 -0
- package/dist/cli/commands/make-queue.d.ts.map +1 -0
- package/dist/cli/commands/make-schedule.d.ts +17 -0
- package/dist/cli/commands/make-schedule.d.ts.map +1 -0
- package/dist/cli/commands/make-service.d.ts +7 -0
- package/dist/cli/commands/make-service.d.ts.map +1 -0
- package/dist/cli/commands/make-session.d.ts +15 -0
- package/dist/cli/commands/make-session.d.ts.map +1 -0
- package/dist/cli/commands/make-validator.d.ts +7 -0
- package/dist/cli/commands/make-validator.d.ts.map +1 -0
- package/dist/cli/commands/new.d.ts +14 -0
- package/dist/cli/commands/new.d.ts.map +1 -0
- package/dist/cli/commands/repl.d.ts +42 -0
- package/dist/cli/commands/repl.d.ts.map +1 -0
- package/dist/cli/commands/route-list.d.ts +12 -0
- package/dist/cli/commands/route-list.d.ts.map +1 -0
- package/dist/cli/core/args.d.ts +29 -0
- package/dist/cli/core/args.d.ts.map +1 -0
- package/dist/cli/core/config.d.ts +137 -0
- package/dist/cli/core/config.d.ts.map +1 -0
- package/dist/cli/core/fs.d.ts +38 -0
- package/dist/cli/core/fs.d.ts.map +1 -0
- package/dist/cli/core/index.d.ts +42 -0
- package/dist/cli/core/index.d.ts.map +1 -0
- package/dist/cli/core/logger.d.ts +46 -0
- package/dist/cli/core/logger.d.ts.map +1 -0
- package/dist/cli/core/loose-json.d.ts +26 -0
- package/dist/cli/core/loose-json.d.ts.map +1 -0
- package/dist/cli/core/prompts.d.ts +22 -0
- package/dist/cli/core/prompts.d.ts.map +1 -0
- package/dist/cli/core/template.d.ts +26 -0
- package/dist/cli/core/template.d.ts.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +6136 -0
- package/dist/cli/index.js.map +91 -0
- package/dist/cli/templates/controller/adonis.d.ts +10 -0
- package/dist/cli/templates/controller/adonis.d.ts.map +1 -0
- package/dist/cli/templates/controller/functional.d.ts +9 -0
- package/dist/cli/templates/controller/functional.d.ts.map +1 -0
- package/dist/cli/templates/controller/nest.d.ts +17 -0
- package/dist/cli/templates/controller/nest.d.ts.map +1 -0
- package/dist/cli/templates/crud/controller.d.ts +8 -0
- package/dist/cli/templates/crud/controller.d.ts.map +1 -0
- package/dist/cli/templates/crud/dto.d.ts +8 -0
- package/dist/cli/templates/crud/dto.d.ts.map +1 -0
- package/dist/cli/templates/crud/index.d.ts +33 -0
- package/dist/cli/templates/crud/index.d.ts.map +1 -0
- package/dist/cli/templates/crud/module.d.ts +6 -0
- package/dist/cli/templates/crud/module.d.ts.map +1 -0
- package/dist/cli/templates/crud/test.d.ts +10 -0
- package/dist/cli/templates/crud/test.d.ts.map +1 -0
- package/dist/cli/templates/index.d.ts +39 -0
- package/dist/cli/templates/index.d.ts.map +1 -0
- package/dist/cli/templates/middleware/middleware.d.ts +8 -0
- package/dist/cli/templates/middleware/middleware.d.ts.map +1 -0
- package/dist/cli/templates/migration/drizzle.d.ts +12 -0
- package/dist/cli/templates/migration/drizzle.d.ts.map +1 -0
- package/dist/cli/templates/migration/sql.d.ts +10 -0
- package/dist/cli/templates/migration/sql.d.ts.map +1 -0
- package/dist/cli/templates/model/drizzle-dialect.d.ts +29 -0
- package/dist/cli/templates/model/drizzle-dialect.d.ts.map +1 -0
- package/dist/cli/templates/model/drizzle.d.ts +14 -0
- package/dist/cli/templates/model/drizzle.d.ts.map +1 -0
- package/dist/cli/templates/model/kysely.d.ts +12 -0
- package/dist/cli/templates/model/kysely.d.ts.map +1 -0
- package/dist/cli/templates/model/prisma.d.ts +12 -0
- package/dist/cli/templates/model/prisma.d.ts.map +1 -0
- package/dist/cli/templates/module/module.d.ts +16 -0
- package/dist/cli/templates/module/module.d.ts.map +1 -0
- package/dist/cli/templates/project/drizzle.config.d.ts +12 -0
- package/dist/cli/templates/project/drizzle.config.d.ts.map +1 -0
- package/dist/cli/templates/project/nx.config.d.ts +7 -0
- package/dist/cli/templates/project/nx.config.d.ts.map +1 -0
- package/dist/cli/templates/repository/repository.d.ts +13 -0
- package/dist/cli/templates/repository/repository.d.ts.map +1 -0
- package/dist/cli/templates/service/service.d.ts +12 -0
- package/dist/cli/templates/service/service.d.ts.map +1 -0
- package/dist/cli/templates/validator/validator.d.ts +8 -0
- package/dist/cli/templates/validator/validator.d.ts.map +1 -0
- package/dist/config/config.module.d.ts +39 -0
- package/dist/config/config.module.d.ts.map +1 -0
- package/dist/config/config.service.d.ts +47 -0
- package/dist/config/config.service.d.ts.map +1 -0
- package/dist/config/index.d.ts +39 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +436 -0
- package/dist/config/index.js.map +21 -0
- package/dist/config/types.d.ts +78 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/core/application.d.ts +77 -0
- package/dist/core/application.d.ts.map +1 -0
- package/dist/core/constants.d.ts +48 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/decorators/controller.d.ts +21 -0
- package/dist/core/decorators/controller.d.ts.map +1 -0
- package/dist/core/decorators/http-methods.d.ts +33 -0
- package/dist/core/decorators/http-methods.d.ts.map +1 -0
- package/dist/core/decorators/index.d.ts +12 -0
- package/dist/core/decorators/index.d.ts.map +1 -0
- package/dist/core/decorators/injectable.d.ts +42 -0
- package/dist/core/decorators/injectable.d.ts.map +1 -0
- package/dist/core/decorators/metadata.d.ts +7 -0
- package/dist/core/decorators/metadata.d.ts.map +1 -0
- package/dist/core/decorators/module.d.ts +23 -0
- package/dist/core/decorators/module.d.ts.map +1 -0
- package/dist/core/decorators/params.d.ts +33 -0
- package/dist/core/decorators/params.d.ts.map +1 -0
- package/dist/core/decorators/repository.d.ts +24 -0
- package/dist/core/decorators/repository.d.ts.map +1 -0
- package/dist/core/decorators/validate.d.ts +21 -0
- package/dist/core/decorators/validate.d.ts.map +1 -0
- package/dist/core/di/container.d.ts +70 -0
- package/dist/core/di/container.d.ts.map +1 -0
- package/dist/core/di/index.d.ts +9 -0
- package/dist/core/di/index.d.ts.map +1 -0
- package/dist/core/di/request-middleware.d.ts +36 -0
- package/dist/core/di/request-middleware.d.ts.map +1 -0
- package/dist/core/di/request-scope.d.ts +45 -0
- package/dist/core/di/request-scope.d.ts.map +1 -0
- package/dist/core/di/scanner.d.ts +36 -0
- package/dist/core/di/scanner.d.ts.map +1 -0
- package/dist/core/di/tokens.d.ts +98 -0
- package/dist/core/di/tokens.d.ts.map +1 -0
- package/dist/core/http/context.d.ts +30 -0
- package/dist/core/http/context.d.ts.map +1 -0
- package/dist/core/http/index.d.ts +8 -0
- package/dist/core/http/index.d.ts.map +1 -0
- package/dist/core/http/middleware.d.ts +31 -0
- package/dist/core/http/middleware.d.ts.map +1 -0
- package/dist/core/http/router.d.ts +46 -0
- package/dist/core/http/router.d.ts.map +1 -0
- package/dist/core/http/server.d.ts +58 -0
- package/dist/core/http/server.d.ts.map +1 -0
- package/dist/core/index.d.ts +20 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/orm/drizzle-adapter.d.ts +73 -0
- package/dist/core/orm/drizzle-adapter.d.ts.map +1 -0
- package/dist/core/orm/index.d.ts +5 -0
- package/dist/core/orm/index.d.ts.map +1 -0
- package/dist/core/runtime/bun.d.ts +13 -0
- package/dist/core/runtime/bun.d.ts.map +1 -0
- package/dist/core/runtime/cloudflare.d.ts +18 -0
- package/dist/core/runtime/cloudflare.d.ts.map +1 -0
- package/dist/core/runtime/index.d.ts +11 -0
- package/dist/core/runtime/index.d.ts.map +1 -0
- package/dist/core/runtime/node.d.ts +10 -0
- package/dist/core/runtime/node.d.ts.map +1 -0
- package/dist/core/validation/index.d.ts +5 -0
- package/dist/core/validation/index.d.ts.map +1 -0
- package/dist/core/validation/validator.d.ts +46 -0
- package/dist/core/validation/validator.d.ts.map +1 -0
- package/dist/crypto/encryption.d.ts +71 -0
- package/dist/crypto/encryption.d.ts.map +1 -0
- package/dist/crypto/hash.d.ts +52 -0
- package/dist/crypto/hash.d.ts.map +1 -0
- package/dist/crypto/index.d.ts +49 -0
- package/dist/crypto/index.d.ts.map +1 -0
- package/dist/crypto/index.js +533 -0
- package/dist/crypto/index.js.map +14 -0
- package/dist/crypto/module.d.ts +28 -0
- package/dist/crypto/module.d.ts.map +1 -0
- package/dist/crypto/types.d.ts +81 -0
- package/dist/crypto/types.d.ts.map +1 -0
- package/dist/drive/drive.module.d.ts +20 -0
- package/dist/drive/drive.module.d.ts.map +1 -0
- package/dist/drive/drive.service.d.ts +21 -0
- package/dist/drive/drive.service.d.ts.map +1 -0
- package/dist/drive/drivers/index.d.ts +9 -0
- package/dist/drive/drivers/index.d.ts.map +1 -0
- package/dist/drive/drivers/local.d.ts +24 -0
- package/dist/drive/drivers/local.d.ts.map +1 -0
- package/dist/drive/drivers/memory.d.ts +19 -0
- package/dist/drive/drivers/memory.d.ts.map +1 -0
- package/dist/drive/drivers/s3.d.ts +44 -0
- package/dist/drive/drivers/s3.d.ts.map +1 -0
- package/dist/drive/index.d.ts +9 -0
- package/dist/drive/index.d.ts.map +1 -0
- package/dist/drive/index.js +714 -0
- package/dist/drive/index.js.map +25 -0
- package/dist/drive/types.d.ts +97 -0
- package/dist/drive/types.d.ts.map +1 -0
- package/dist/drizzle/decorators/columns.d.ts +16 -0
- package/dist/drizzle/decorators/columns.d.ts.map +1 -0
- package/dist/drizzle/decorators/index.d.ts +6 -0
- package/dist/drizzle/decorators/index.d.ts.map +1 -0
- package/dist/drizzle/drivers/base.d.ts +32 -0
- package/dist/drizzle/drivers/base.d.ts.map +1 -0
- package/dist/drizzle/drivers/bun-sqlite.d.ts +6 -0
- package/dist/drizzle/drivers/bun-sqlite.d.ts.map +1 -0
- package/dist/drizzle/drivers/d1.d.ts +7 -0
- package/dist/drizzle/drivers/d1.d.ts.map +1 -0
- package/dist/drizzle/drivers/index.d.ts +14 -0
- package/dist/drizzle/drivers/index.d.ts.map +1 -0
- package/dist/drizzle/drivers/mysql.d.ts +6 -0
- package/dist/drizzle/drivers/mysql.d.ts.map +1 -0
- package/dist/drizzle/drivers/postgres.d.ts +12 -0
- package/dist/drizzle/drivers/postgres.d.ts.map +1 -0
- package/dist/drizzle/drivers/sqlite.d.ts +8 -0
- package/dist/drizzle/drivers/sqlite.d.ts.map +1 -0
- package/dist/drizzle/drizzle.module.d.ts +29 -0
- package/dist/drizzle/drizzle.module.d.ts.map +1 -0
- package/dist/drizzle/drizzle.service.d.ts +52 -0
- package/dist/drizzle/drizzle.service.d.ts.map +1 -0
- package/dist/drizzle/index.d.ts +13 -0
- package/dist/drizzle/index.d.ts.map +1 -0
- package/dist/drizzle/index.js +979 -0
- package/dist/drizzle/index.js.map +32 -0
- package/dist/drizzle/model.d.ts +26 -0
- package/dist/drizzle/model.d.ts.map +1 -0
- package/dist/drizzle/raw-query.d.ts +41 -0
- package/dist/drizzle/raw-query.d.ts.map +1 -0
- package/dist/drizzle/repository/index.d.ts +6 -0
- package/dist/drizzle/repository/index.d.ts.map +1 -0
- package/dist/drizzle/repository/repository.d.ts +60 -0
- package/dist/drizzle/repository/repository.d.ts.map +1 -0
- package/dist/drizzle/types.d.ts +160 -0
- package/dist/drizzle/types.d.ts.map +1 -0
- package/dist/events/decorators/on-event.d.ts +49 -0
- package/dist/events/decorators/on-event.d.ts.map +1 -0
- package/dist/events/emitter.d.ts +52 -0
- package/dist/events/emitter.d.ts.map +1 -0
- package/dist/events/event.service.d.ts +27 -0
- package/dist/events/event.service.d.ts.map +1 -0
- package/dist/events/events.module.d.ts +35 -0
- package/dist/events/events.module.d.ts.map +1 -0
- package/dist/events/index.d.ts +43 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +646 -0
- package/dist/events/index.js.map +23 -0
- package/dist/events/types.d.ts +120 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/grpc/decorators.d.ts +34 -0
- package/dist/grpc/decorators.d.ts.map +1 -0
- package/dist/grpc/index.d.ts +70 -0
- package/dist/grpc/index.d.ts.map +1 -0
- package/dist/grpc/index.js +528 -0
- package/dist/grpc/index.js.map +22 -0
- package/dist/grpc/module.d.ts +32 -0
- package/dist/grpc/module.d.ts.map +1 -0
- package/dist/grpc/service.d.ts +60 -0
- package/dist/grpc/service.d.ts.map +1 -0
- package/dist/grpc/types.d.ts +79 -0
- package/dist/grpc/types.d.ts.map +1 -0
- package/dist/health/health.controller.d.ts +61 -0
- package/dist/health/health.controller.d.ts.map +1 -0
- package/dist/health/health.module.d.ts +29 -0
- package/dist/health/health.module.d.ts.map +1 -0
- package/dist/health/health.service.d.ts +34 -0
- package/dist/health/health.service.d.ts.map +1 -0
- package/dist/health/index.d.ts +38 -0
- package/dist/health/index.d.ts.map +1 -0
- package/dist/health/index.js +599 -0
- package/dist/health/index.js.map +25 -0
- package/dist/health/indicators/drizzle.d.ts +18 -0
- package/dist/health/indicators/drizzle.d.ts.map +1 -0
- package/dist/health/indicators/index.d.ts +59 -0
- package/dist/health/indicators/index.d.ts.map +1 -0
- package/dist/health/types.d.ts +105 -0
- package/dist/health/types.d.ts.map +1 -0
- package/dist/i18n/decorators.d.ts +14 -0
- package/dist/i18n/decorators.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +48 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +589 -0
- package/dist/i18n/index.js.map +17 -0
- package/dist/i18n/middleware.d.ts +26 -0
- package/dist/i18n/middleware.d.ts.map +1 -0
- package/dist/i18n/module.d.ts +39 -0
- package/dist/i18n/module.d.ts.map +1 -0
- package/dist/i18n/service.d.ts +130 -0
- package/dist/i18n/service.d.ts.map +1 -0
- package/dist/i18n/types.d.ts +65 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2056 -0
- package/dist/index.js.map +53 -0
- package/dist/limiter/backends/drizzle.d.ts +40 -0
- package/dist/limiter/backends/drizzle.d.ts.map +1 -0
- package/dist/limiter/backends/index.d.ts +6 -0
- package/dist/limiter/backends/index.d.ts.map +1 -0
- package/dist/limiter/backends/memory.d.ts +28 -0
- package/dist/limiter/backends/memory.d.ts.map +1 -0
- package/dist/limiter/index.d.ts +9 -0
- package/dist/limiter/index.d.ts.map +1 -0
- package/dist/limiter/index.js +640 -0
- package/dist/limiter/index.js.map +25 -0
- package/dist/limiter/limiter.middleware.d.ts +11 -0
- package/dist/limiter/limiter.middleware.d.ts.map +1 -0
- package/dist/limiter/limiter.module.d.ts +23 -0
- package/dist/limiter/limiter.module.d.ts.map +1 -0
- package/dist/limiter/limiter.service.d.ts +18 -0
- package/dist/limiter/limiter.service.d.ts.map +1 -0
- package/dist/limiter/types.d.ts +99 -0
- package/dist/limiter/types.d.ts.map +1 -0
- package/dist/logger/index.d.ts +36 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/index.js +538 -0
- package/dist/logger/index.js.map +22 -0
- package/dist/logger/logger.module.d.ts +35 -0
- package/dist/logger/logger.module.d.ts.map +1 -0
- package/dist/logger/logger.service.d.ts +55 -0
- package/dist/logger/logger.service.d.ts.map +1 -0
- package/dist/logger/transports/index.d.ts +35 -0
- package/dist/logger/transports/index.d.ts.map +1 -0
- package/dist/logger/types.d.ts +58 -0
- package/dist/logger/types.d.ts.map +1 -0
- package/dist/mail/index.d.ts +9 -0
- package/dist/mail/index.d.ts.map +1 -0
- package/dist/mail/index.js +479 -0
- package/dist/mail/index.js.map +25 -0
- package/dist/mail/mail.module.d.ts +21 -0
- package/dist/mail/mail.module.d.ts.map +1 -0
- package/dist/mail/mail.service.d.ts +18 -0
- package/dist/mail/mail.service.d.ts.map +1 -0
- package/dist/mail/transports/file.d.ts +19 -0
- package/dist/mail/transports/file.d.ts.map +1 -0
- package/dist/mail/transports/index.d.ts +9 -0
- package/dist/mail/transports/index.d.ts.map +1 -0
- package/dist/mail/transports/null.d.ts +11 -0
- package/dist/mail/transports/null.d.ts.map +1 -0
- package/dist/mail/transports/smtp.d.ts +40 -0
- package/dist/mail/transports/smtp.d.ts.map +1 -0
- package/dist/mail/types.d.ts +73 -0
- package/dist/mail/types.d.ts.map +1 -0
- package/dist/metrics/controller.d.ts +27 -0
- package/dist/metrics/controller.d.ts.map +1 -0
- package/dist/metrics/counter.d.ts +36 -0
- package/dist/metrics/counter.d.ts.map +1 -0
- package/dist/metrics/decorators/counted.d.ts +26 -0
- package/dist/metrics/decorators/counted.d.ts.map +1 -0
- package/dist/metrics/decorators/index.d.ts +3 -0
- package/dist/metrics/decorators/index.d.ts.map +1 -0
- package/dist/metrics/decorators/timed.d.ts +25 -0
- package/dist/metrics/decorators/timed.d.ts.map +1 -0
- package/dist/metrics/gauge.d.ts +38 -0
- package/dist/metrics/gauge.d.ts.map +1 -0
- package/dist/metrics/histogram.d.ts +52 -0
- package/dist/metrics/histogram.d.ts.map +1 -0
- package/dist/metrics/index.d.ts +35 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +1033 -0
- package/dist/metrics/index.js.map +21 -0
- package/dist/metrics/module.d.ts +33 -0
- package/dist/metrics/module.d.ts.map +1 -0
- package/dist/metrics/registry.d.ts +52 -0
- package/dist/metrics/registry.d.ts.map +1 -0
- package/dist/metrics/service.d.ts +42 -0
- package/dist/metrics/service.d.ts.map +1 -0
- package/dist/metrics/summary.d.ts +50 -0
- package/dist/metrics/summary.d.ts.map +1 -0
- package/dist/metrics/types.d.ts +115 -0
- package/dist/metrics/types.d.ts.map +1 -0
- package/dist/openapi/decorators/body.d.ts +9 -0
- package/dist/openapi/decorators/body.d.ts.map +1 -0
- package/dist/openapi/decorators/index.d.ts +11 -0
- package/dist/openapi/decorators/index.d.ts.map +1 -0
- package/dist/openapi/decorators/operation.d.ts +9 -0
- package/dist/openapi/decorators/operation.d.ts.map +1 -0
- package/dist/openapi/decorators/param.d.ts +17 -0
- package/dist/openapi/decorators/param.d.ts.map +1 -0
- package/dist/openapi/decorators/property.d.ts +24 -0
- package/dist/openapi/decorators/property.d.ts.map +1 -0
- package/dist/openapi/decorators/response.d.ts +10 -0
- package/dist/openapi/decorators/response.d.ts.map +1 -0
- package/dist/openapi/decorators/security.d.ts +9 -0
- package/dist/openapi/decorators/security.d.ts.map +1 -0
- package/dist/openapi/decorators/tags.d.ts +2 -0
- package/dist/openapi/decorators/tags.d.ts.map +1 -0
- package/dist/openapi/index.d.ts +10 -0
- package/dist/openapi/index.d.ts.map +1 -0
- package/dist/openapi/index.js +974 -0
- package/dist/openapi/index.js.map +31 -0
- package/dist/openapi/openapi.module.d.ts +46 -0
- package/dist/openapi/openapi.module.d.ts.map +1 -0
- package/dist/openapi/openapi.service.d.ts +55 -0
- package/dist/openapi/openapi.service.d.ts.map +1 -0
- package/dist/openapi/scalar.d.ts +16 -0
- package/dist/openapi/scalar.d.ts.map +1 -0
- package/dist/openapi/types.d.ts +266 -0
- package/dist/openapi/types.d.ts.map +1 -0
- package/dist/openapi/zod-to-json-schema.d.ts +34 -0
- package/dist/openapi/zod-to-json-schema.d.ts.map +1 -0
- package/dist/package.json +59 -0
- package/dist/queue/backends/bullmq.d.ts +41 -0
- package/dist/queue/backends/bullmq.d.ts.map +1 -0
- package/dist/queue/backends/cloudflare.d.ts +84 -0
- package/dist/queue/backends/cloudflare.d.ts.map +1 -0
- package/dist/queue/backends/index.d.ts +7 -0
- package/dist/queue/backends/index.d.ts.map +1 -0
- package/dist/queue/backends/memory.d.ts +24 -0
- package/dist/queue/backends/memory.d.ts.map +1 -0
- package/dist/queue/decorators/on-queue-ready.d.ts +43 -0
- package/dist/queue/decorators/on-queue-ready.d.ts.map +1 -0
- package/dist/queue/index.d.ts +57 -0
- package/dist/queue/index.d.ts.map +1 -0
- package/dist/queue/index.js +961 -0
- package/dist/queue/index.js.map +25 -0
- package/dist/queue/queue.module.d.ts +46 -0
- package/dist/queue/queue.module.d.ts.map +1 -0
- package/dist/queue/queue.service.d.ts +61 -0
- package/dist/queue/queue.service.d.ts.map +1 -0
- package/dist/queue/types.d.ts +204 -0
- package/dist/queue/types.d.ts.map +1 -0
- package/dist/redis/adapters/bun.d.ts +27 -0
- package/dist/redis/adapters/bun.d.ts.map +1 -0
- package/dist/redis/adapters/cloudflare.d.ts +51 -0
- package/dist/redis/adapters/cloudflare.d.ts.map +1 -0
- package/dist/redis/adapters/index.d.ts +29 -0
- package/dist/redis/adapters/index.d.ts.map +1 -0
- package/dist/redis/adapters/memory.d.ts +28 -0
- package/dist/redis/adapters/memory.d.ts.map +1 -0
- package/dist/redis/adapters/node.d.ts +36 -0
- package/dist/redis/adapters/node.d.ts.map +1 -0
- package/dist/redis/index.d.ts +33 -0
- package/dist/redis/index.d.ts.map +1 -0
- package/dist/redis/index.js +667 -0
- package/dist/redis/index.js.map +25 -0
- package/dist/redis/module.d.ts +32 -0
- package/dist/redis/module.d.ts.map +1 -0
- package/dist/redis/types.d.ts +146 -0
- package/dist/redis/types.d.ts.map +1 -0
- package/dist/schedule/backends/cloudflare.d.ts +55 -0
- package/dist/schedule/backends/cloudflare.d.ts.map +1 -0
- package/dist/schedule/backends/index.d.ts +3 -0
- package/dist/schedule/backends/index.d.ts.map +1 -0
- package/dist/schedule/backends/memory.d.ts +39 -0
- package/dist/schedule/backends/memory.d.ts.map +1 -0
- package/dist/schedule/cron-parser.d.ts +48 -0
- package/dist/schedule/cron-parser.d.ts.map +1 -0
- package/dist/schedule/decorators/cron.d.ts +71 -0
- package/dist/schedule/decorators/cron.d.ts.map +1 -0
- package/dist/schedule/index.d.ts +51 -0
- package/dist/schedule/index.d.ts.map +1 -0
- package/dist/schedule/index.js +1108 -0
- package/dist/schedule/index.js.map +25 -0
- package/dist/schedule/schedule.module.d.ts +44 -0
- package/dist/schedule/schedule.module.d.ts.map +1 -0
- package/dist/schedule/schedule.service.d.ts +51 -0
- package/dist/schedule/schedule.service.d.ts.map +1 -0
- package/dist/schedule/types.d.ts +150 -0
- package/dist/schedule/types.d.ts.map +1 -0
- package/dist/session/backends/cookie.d.ts +56 -0
- package/dist/session/backends/cookie.d.ts.map +1 -0
- package/dist/session/backends/drizzle.d.ts +65 -0
- package/dist/session/backends/drizzle.d.ts.map +1 -0
- package/dist/session/backends/index.d.ts +6 -0
- package/dist/session/backends/index.d.ts.map +1 -0
- package/dist/session/backends/memory.d.ts +32 -0
- package/dist/session/backends/memory.d.ts.map +1 -0
- package/dist/session/backends/redis.d.ts +53 -0
- package/dist/session/backends/redis.d.ts.map +1 -0
- package/dist/session/decorators/current-session.d.ts +56 -0
- package/dist/session/decorators/current-session.d.ts.map +1 -0
- package/dist/session/index.d.ts +42 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +1498 -0
- package/dist/session/index.js.map +28 -0
- package/dist/session/session-middleware.d.ts +29 -0
- package/dist/session/session-middleware.d.ts.map +1 -0
- package/dist/session/session.module.d.ts +35 -0
- package/dist/session/session.module.d.ts.map +1 -0
- package/dist/session/session.service.d.ts +49 -0
- package/dist/session/session.service.d.ts.map +1 -0
- package/dist/session/types.d.ts +201 -0
- package/dist/session/types.d.ts.map +1 -0
- package/dist/shield/guards/csrf.d.ts +33 -0
- package/dist/shield/guards/csrf.d.ts.map +1 -0
- package/dist/shield/guards/headers.d.ts +22 -0
- package/dist/shield/guards/headers.d.ts.map +1 -0
- package/dist/shield/guards/index.d.ts +6 -0
- package/dist/shield/guards/index.d.ts.map +1 -0
- package/dist/shield/index.d.ts +8 -0
- package/dist/shield/index.d.ts.map +1 -0
- package/dist/shield/index.js +728 -0
- package/dist/shield/index.js.map +25 -0
- package/dist/shield/shield.module.d.ts +25 -0
- package/dist/shield/shield.module.d.ts.map +1 -0
- package/dist/shield/shield.service.d.ts +21 -0
- package/dist/shield/shield.service.d.ts.map +1 -0
- package/dist/shield/types.d.ts +95 -0
- package/dist/shield/types.d.ts.map +1 -0
- package/dist/sse/index.d.ts +7 -0
- package/dist/sse/index.d.ts.map +1 -0
- package/dist/sse/index.js +214 -0
- package/dist/sse/index.js.map +13 -0
- package/dist/sse/sse-stream.d.ts +46 -0
- package/dist/sse/sse-stream.d.ts.map +1 -0
- package/dist/sse/sse.d.ts +24 -0
- package/dist/sse/sse.d.ts.map +1 -0
- package/dist/sse/types.d.ts +84 -0
- package/dist/sse/types.d.ts.map +1 -0
- package/dist/static/index.d.ts +41 -0
- package/dist/static/index.d.ts.map +1 -0
- package/dist/static/index.js +313 -0
- package/dist/static/index.js.map +13 -0
- package/dist/static/static.module.d.ts +41 -0
- package/dist/static/static.module.d.ts.map +1 -0
- package/dist/static/static.service.d.ts +38 -0
- package/dist/static/static.service.d.ts.map +1 -0
- package/dist/tracing/decorators/index.d.ts +2 -0
- package/dist/tracing/decorators/index.d.ts.map +1 -0
- package/dist/tracing/decorators/trace.d.ts +37 -0
- package/dist/tracing/decorators/trace.d.ts.map +1 -0
- package/dist/tracing/hono-instrumentation.d.ts +21 -0
- package/dist/tracing/hono-instrumentation.d.ts.map +1 -0
- package/dist/tracing/index.d.ts +29 -0
- package/dist/tracing/index.d.ts.map +1 -0
- package/dist/tracing/index.js +782 -0
- package/dist/tracing/index.js.map +24 -0
- package/dist/tracing/module.d.ts +45 -0
- package/dist/tracing/module.d.ts.map +1 -0
- package/dist/tracing/propagation.d.ts +53 -0
- package/dist/tracing/propagation.d.ts.map +1 -0
- package/dist/tracing/service.d.ts +95 -0
- package/dist/tracing/service.d.ts.map +1 -0
- package/dist/tracing/types.d.ts +90 -0
- package/dist/tracing/types.d.ts.map +1 -0
- package/dist/upload/decorators/index.d.ts +6 -0
- package/dist/upload/decorators/index.d.ts.map +1 -0
- package/dist/upload/decorators/upload.d.ts +16 -0
- package/dist/upload/decorators/upload.d.ts.map +1 -0
- package/dist/upload/decorators/uploaded-file.d.ts +10 -0
- package/dist/upload/decorators/uploaded-file.d.ts.map +1 -0
- package/dist/upload/index.d.ts +9 -0
- package/dist/upload/index.d.ts.map +1 -0
- package/dist/upload/index.js +553 -0
- package/dist/upload/index.js.map +25 -0
- package/dist/upload/types.d.ts +103 -0
- package/dist/upload/types.d.ts.map +1 -0
- package/dist/upload/upload.middleware.d.ts +15 -0
- package/dist/upload/upload.middleware.d.ts.map +1 -0
- package/dist/upload/upload.module.d.ts +33 -0
- package/dist/upload/upload.module.d.ts.map +1 -0
- package/dist/upload/upload.service.d.ts +29 -0
- package/dist/upload/upload.service.d.ts.map +1 -0
- package/dist/view/edge.d.ts +23 -0
- package/dist/view/edge.d.ts.map +1 -0
- package/dist/view/eta.d.ts +30 -0
- package/dist/view/eta.d.ts.map +1 -0
- package/dist/view/index.d.ts +34 -0
- package/dist/view/index.d.ts.map +1 -0
- package/dist/view/index.js +240 -0
- package/dist/view/index.js.map +14 -0
- package/dist/view/inertia/default-ssr.d.ts +15 -0
- package/dist/view/inertia/default-ssr.d.ts.map +1 -0
- package/dist/view/inertia/form-helper.d.ts +102 -0
- package/dist/view/inertia/form-helper.d.ts.map +1 -0
- package/dist/view/inertia/form-middleware.d.ts +53 -0
- package/dist/view/inertia/form-middleware.d.ts.map +1 -0
- package/dist/view/inertia/helpers.d.ts +149 -0
- package/dist/view/inertia/helpers.d.ts.map +1 -0
- package/dist/view/inertia/index.d.ts +18 -0
- package/dist/view/inertia/index.d.ts.map +1 -0
- package/dist/view/inertia/inertia-adapter.d.ts +93 -0
- package/dist/view/inertia/inertia-adapter.d.ts.map +1 -0
- package/dist/view/inertia/inertia-response.d.ts +51 -0
- package/dist/view/inertia/inertia-response.d.ts.map +1 -0
- package/dist/view/inertia/ssr/index.d.ts +13 -0
- package/dist/view/inertia/ssr/index.d.ts.map +1 -0
- package/dist/view/inertia/ssr/react-adapter.d.ts +33 -0
- package/dist/view/inertia/ssr/react-adapter.d.ts.map +1 -0
- package/dist/view/inertia/ssr/registry.d.ts +42 -0
- package/dist/view/inertia/ssr/registry.d.ts.map +1 -0
- package/dist/view/inertia/ssr/solid-adapter.d.ts +31 -0
- package/dist/view/inertia/ssr/solid-adapter.d.ts.map +1 -0
- package/dist/view/inertia/ssr/svelte-adapter.d.ts +31 -0
- package/dist/view/inertia/ssr/svelte-adapter.d.ts.map +1 -0
- package/dist/view/inertia/ssr/vue-adapter.d.ts +26 -0
- package/dist/view/inertia/ssr/vue-adapter.d.ts.map +1 -0
- package/dist/view/inertia/types.d.ts +131 -0
- package/dist/view/inertia/types.d.ts.map +1 -0
- package/dist/view/rendu.d.ts +11 -0
- package/dist/view/rendu.d.ts.map +1 -0
- package/dist/view/types.d.ts +52 -0
- package/dist/view/types.d.ts.map +1 -0
- package/dist/view/view-engine.d.ts +28 -0
- package/dist/view/view-engine.d.ts.map +1 -0
- package/dist/ws/client.d.ts +42 -0
- package/dist/ws/client.d.ts.map +1 -0
- package/dist/ws/decorators.d.ts +44 -0
- package/dist/ws/decorators.d.ts.map +1 -0
- package/dist/ws/index.d.ts +57 -0
- package/dist/ws/index.d.ts.map +1 -0
- package/dist/ws/index.js +796 -0
- package/dist/ws/index.js.map +26 -0
- package/dist/ws/module.d.ts +48 -0
- package/dist/ws/module.d.ts.map +1 -0
- package/dist/ws/runtime/bun.d.ts +41 -0
- package/dist/ws/runtime/bun.d.ts.map +1 -0
- package/dist/ws/runtime/index.d.ts +14 -0
- package/dist/ws/runtime/index.d.ts.map +1 -0
- package/dist/ws/runtime/node.d.ts +46 -0
- package/dist/ws/runtime/node.d.ts.map +1 -0
- package/dist/ws/runtime/types.d.ts +18 -0
- package/dist/ws/runtime/types.d.ts.map +1 -0
- package/dist/ws/service.d.ts +65 -0
- package/dist/ws/service.d.ts.map +1 -0
- package/dist/ws/types.d.ts +77 -0
- package/dist/ws/types.d.ts.map +1 -0
- package/package.json +262 -0
package/README.md
ADDED
|
@@ -0,0 +1,860 @@
|
|
|
1
|
+
# NexusJS
|
|
2
|
+
|
|
3
|
+
**Bun Native Fullstack Framework** — NestJS structure × Adonis productivity × Hono edge performance.
|
|
4
|
+
|
|
5
|
+
> **v0.6.5 — env-aware config + db:generate.** All 27 modules ship. Tier 1 and
|
|
6
|
+
> Tier 2 gaps from the NestJS / AdonisJS gap analyses are now fully
|
|
7
|
+
> closed. The view engine has moved to `nexusjs/view` as its own bundle
|
|
8
|
+
> entry point, with Rendu (default), Edge, and Eta adapters. See
|
|
9
|
+
> [CHANGELOG.md](./CHANGELOG.md) for the full v0.6 release notes.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## What's in v0.6
|
|
14
|
+
|
|
15
|
+
The framework now ships **27 independent modules** — every one is
|
|
16
|
+
its own bundle entry point, so you install only what you use. Tier 1
|
|
17
|
+
and Tier 2 gaps from the NestJS / AdonisJS gap analyses are now
|
|
18
|
+
fully closed.
|
|
19
|
+
|
|
20
|
+
| Module | Purpose |
|
|
21
|
+
| ------ | ------- |
|
|
22
|
+
| `nexusjs` (core) | MVC + DI + validation + 3 routing styles + view engines + Inertia.js |
|
|
23
|
+
| `nexusjs/cli` (`nx`) | Adonis ACE-style command runner — `new`, `init`, `make:*`, `migrate`, `info` |
|
|
24
|
+
| `nexusjs/auth` | better-auth integration with `@CurrentUser` and `authMiddleware` |
|
|
25
|
+
| `nexusjs/queue` | BullMQ + Cloudflare Queues + memory backends. `@OnQueueReady` decorator |
|
|
26
|
+
| `nexusjs/schedule` | Custom cron parser. `@Cron` / `@Interval` / `@Timeout` decorators |
|
|
27
|
+
| `nexusjs/events` | `NexusEventEmitter` with wildcards, priorities, guards. `@OnEvent` decorator |
|
|
28
|
+
| `nexusjs/session` | Cookie (HMAC) + memory + **Drizzle** backends. Sliding expiry, rotation |
|
|
29
|
+
| `nexusjs/health` | `/health/live` · `/health/ready` · `/health/startup`. Built-in indicators |
|
|
30
|
+
| `nexusjs/config` | Zod-validated configuration. Layered loading from env, `.env`, `load()` |
|
|
31
|
+
| `nexusjs/logger` | Pino-backed structured logging. Pretty-print in dev, JSON in prod |
|
|
32
|
+
| `nexusjs/static` | Static file serving with ETag, Range, path-traversal protection |
|
|
33
|
+
| `nexusjs/limiter` | Rate limiting. 3 strategies × memory / **Drizzle** storage |
|
|
34
|
+
| `nexusjs/shield` | Security suite: CSRF + HSTS + CSP + X-Frame-Options + Referrer-Policy |
|
|
35
|
+
| `nexusjs/cache` | Application cache. Memory (LRU) / **Drizzle** backends. Tag invalidation |
|
|
36
|
+
| `nexusjs/drive` | File storage abstraction. Memory / Local / S3 / R2 drivers |
|
|
37
|
+
| `nexusjs/mail` | Outbound email. Null / File / SMTP transports. MJML rendering |
|
|
38
|
+
| `nexusjs/drizzle` | **Default ORM.** 5 dialects, `DrizzleModel`, `DrizzleRepository`, migrations, raw SQL (injection-safe) |
|
|
39
|
+
| `nexusjs/openapi` | OpenAPI 3.1 spec generation + Scalar UI. Auto-derives from Zod validation schemas |
|
|
40
|
+
| `nexusjs/upload` | Multipart file upload. `@Upload()` / `@UploadedFile()` decorators. Size, MIME, count validation |
|
|
41
|
+
| `nexusjs/sse` | Server-Sent Events. `SseStream` with pending-write tracking. `sse(c, handler)` helper |
|
|
42
|
+
| `nexusjs/tracing` | OpenTelemetry distributed tracing. Lazy SDK loading. `@Trace()` decorator. W3C + B3 propagation |
|
|
43
|
+
| `nexusjs/metrics` | Prometheus / OpenMetrics. Counter / Gauge / Histogram / Summary. `@Counted()` / `@Timed()` decorators |
|
|
44
|
+
| **Request-scoped DI** *(core)* | `@Injectable({ scope: 'request' })` for per-request provider lifetime via `AsyncLocalStorage` |
|
|
45
|
+
| `nexusjs/ws` | WebSockets on Bun (primary) and Node (via `ws`). `@WebSocketGateway()`, `@OnWebSocketMessage()`, rooms, broadcast |
|
|
46
|
+
| `nexusjs/crypto` | AES-256-GCM encryption + HMAC + scrypt/argon2 password hashing. Single APP_KEY for sessions, CSRF, encrypted data |
|
|
47
|
+
| `nexusjs/i18n` | Locale-aware translations + date/number/currency formatters via `Intl`. `I18nService`, `@CurrentLocale()`, JSON message catalogs |
|
|
48
|
+
| `nexusjs/redis` | Runtime-aware Redis client (Bun / Node / Workers KV). Powers `redis` / `cloudflare-kv` session & cache backends |
|
|
49
|
+
| `nexusjs/grpc` | Reflection-based gRPC server + typed client. Loads `.proto` files at runtime via `@grpc/proto-loader`. Unary methods (streaming deferred to v2) |
|
|
50
|
+
| **`nexusjs/view`** *(extracted in v0.6.3)* | View engine with 3 adapters: Rendu (default, every runtime), Edge (Adonis-style `.edge`), Eta (EJS-style `.eta`). Auto-detects adapter by file extension. `setViewPaths()` for file-based templates |
|
|
51
|
+
|
|
52
|
+
See [docs/user-guide/drizzle.md](./docs/user-guide/drizzle.md) for the
|
|
53
|
+
Drizzle integration guide, [docs/user-guide/tracing.md](./docs/user-guide/tracing.md)
|
|
54
|
+
for OpenTelemetry, [docs/user-guide/metrics.md](./docs/user-guide/metrics.md)
|
|
55
|
+
for Prometheus, and [CHANGELOG.md](./CHANGELOG.md) for the detailed
|
|
56
|
+
v0.4 release notes.
|
|
57
|
+
|
|
58
|
+
> The module table now includes `nexusjs/grpc` and `nexusjs/view`,
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Why Nexus?
|
|
63
|
+
|
|
64
|
+
| Capability | NestJS | Adonis | Hono | **Nexus** |
|
|
65
|
+
| -------------------------------- | :----: | :----: | :---: | :-------: |
|
|
66
|
+
| Bun-native runtime | ❌ | △ | ✅ | ✅ |
|
|
67
|
+
| Cloudflare Workers / Edge | △ | ❌ | ✅ | ✅ |
|
|
68
|
+
| MVC + Service + Repository | △ | ✅ | ❌ | ✅ |
|
|
69
|
+
| Class decorators (Nest style) | ✅ | ❌ | ❌ | ✅ |
|
|
70
|
+
| Adonis-style router | ❌ | ✅ | ❌ | ✅ |
|
|
71
|
+
| Functional handler (Hono style) | △ | ❌ | ✅ | ✅ |
|
|
72
|
+
| Zod validation pipeline | △ | ✅ | ❌ | ✅ |
|
|
73
|
+
| Three view engines (Rendu/Edge/Inertia) | ❌ | ✅ | ❌ | ✅ |
|
|
74
|
+
| **Default ORM (Drizzle, 5 dialects)** | △ | Lucid | ❌ | ✅ |
|
|
75
|
+
| **Multi-pod session, cache, limiter via Drizzle** | △ | ✅ | ❌ | **✅** |
|
|
76
|
+
| **26 independent bundle entry points** | ❌ | △ | ❌ | ✅ |
|
|
77
|
+
| **SQL-injection-safe raw queries by construction** | △ | △ | ❌ | ✅ |
|
|
78
|
+
| **Migrations + autoMigrate on boot** | △ | ✅ | ❌ | ✅ |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Install
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
bunx create-nexus my-app # scaffold a new project
|
|
86
|
+
cd my-app
|
|
87
|
+
bun install
|
|
88
|
+
bun run dev
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Or use it as a library in an existing project:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
bun add nexus reflect-metadata zod hono
|
|
95
|
+
# Add the modules you need:
|
|
96
|
+
bun add nexus/auth nexus/queue nexus/drizzle
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Every module is its own bundle entry point — install only what you
|
|
100
|
+
use. The CLI (`nx`) is shipped as the `nx` bin and the `nexusjs/cli`
|
|
101
|
+
import:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
bun add nexus/cli # optional — for the `nx` command runner
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Quick start
|
|
110
|
+
|
|
111
|
+
A minimal app with the **default ORM (Drizzle)** and the most
|
|
112
|
+
common modules:
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
// src/db/schema.ts
|
|
116
|
+
import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';
|
|
117
|
+
|
|
118
|
+
export const users = pgTable('users', {
|
|
119
|
+
id: serial('id').primaryKey(),
|
|
120
|
+
email: text('email').notNull().unique(),
|
|
121
|
+
createdAt: timestamp('created_at').defaultNow().notNull(),
|
|
122
|
+
});
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
// app/app.module.ts
|
|
127
|
+
import { Module } from 'nexusjs';
|
|
128
|
+
import { DrizzleModule } from 'nexusjs/drizzle';
|
|
129
|
+
import { ConfigModule } from 'nexusjs/config';
|
|
130
|
+
import { LoggerModule } from 'nexusjs/logger';
|
|
131
|
+
import { HealthModule } from 'nexusjs/health';
|
|
132
|
+
import { LimiterModule } from 'nexusjs/limiter';
|
|
133
|
+
import { SessionModule } from 'nexusjs/session';
|
|
134
|
+
import { CacheModule } from 'nexusjs/cache';
|
|
135
|
+
import { DriveModule } from 'nexusjs/drive';
|
|
136
|
+
import { MailModule } from 'nexusjs/mail';
|
|
137
|
+
import { ShieldModule } from 'nexusjs/shield';
|
|
138
|
+
import { AuthModule } from 'nexusjs/auth';
|
|
139
|
+
import { OpenAPIModule } from 'nexusjs/openapi';
|
|
140
|
+
import { UploadModule } from 'nexusjs/upload';
|
|
141
|
+
import { TracingModule } from 'nexusjs/tracing';
|
|
142
|
+
import { MetricsModule } from 'nexusjs/metrics';
|
|
143
|
+
import { UserModule } from './modules/user.module.js';
|
|
144
|
+
import { configSchema } from './config/schema.js';
|
|
145
|
+
|
|
146
|
+
@Module({
|
|
147
|
+
imports: [
|
|
148
|
+
ConfigModule.forRoot({ schema: configSchema, exitOnError: true }),
|
|
149
|
+
LoggerModule.forRoot({ pretty: process.env.NODE_ENV !== 'production' }),
|
|
150
|
+
HealthModule.forRoot({ builtIn: { memory: true, disk: { threshold: 0.1 } } }),
|
|
151
|
+
DrizzleModule.forRoot({
|
|
152
|
+
dialect: 'postgres',
|
|
153
|
+
connection: { url: process.env.DATABASE_URL! },
|
|
154
|
+
}),
|
|
155
|
+
SessionModule.forRoot({ backend: 'cookie', cookie: { secret: process.env.SESSION_SECRET! } }),
|
|
156
|
+
CacheModule.forRoot({ defaultTtl: 300 }),
|
|
157
|
+
DriveModule.forRoot({ driver: new LocalDriver({ root: '/var/data' }) }),
|
|
158
|
+
MailModule.forRoot({ defaultFrom: 'no-reply@example.com' }),
|
|
159
|
+
LimiterModule.forRoot({ rules: [{ path: '/api/*', points: 100, duration: '1m' }] }),
|
|
160
|
+
ShieldModule.forRoot({ csrf: { enabled: true }, hsts: { maxAge: 31_536_000 } }),
|
|
161
|
+
AuthModule.forRoot({ /* better-auth config */ }),
|
|
162
|
+
OpenAPIModule.forRoot({ title: 'My App', version: '1.0.0', path: '/docs' }),
|
|
163
|
+
UploadModule.forRoot({ maxFileSize: 10 * 1024 * 1024 }),
|
|
164
|
+
TracingModule.forRoot({ serviceName: 'my-app', exporter: 'otlp-http' }),
|
|
165
|
+
MetricsModule.forRoot({ path: '/metrics' }),
|
|
166
|
+
UserModule,
|
|
167
|
+
],
|
|
168
|
+
})
|
|
169
|
+
export class AppModule {}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
// app/main.ts
|
|
174
|
+
import 'reflect-metadata';
|
|
175
|
+
import { Application } from 'nexusjs';
|
|
176
|
+
import { AppModule } from './app.module.js';
|
|
177
|
+
|
|
178
|
+
const app = new Application(AppModule);
|
|
179
|
+
await app.listen(3000);
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
// app/modules/user/user.module.ts
|
|
184
|
+
import { Module } from 'nexusjs';
|
|
185
|
+
import { UserController } from './user.controller.js';
|
|
186
|
+
import { UserService } from './user.service.js';
|
|
187
|
+
import { UserRepository } from './user.repository.js';
|
|
188
|
+
|
|
189
|
+
@Module({
|
|
190
|
+
controllers: [UserController],
|
|
191
|
+
providers: [UserService, UserRepository],
|
|
192
|
+
})
|
|
193
|
+
export class UserModule {}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
// app/modules/user/user.service.ts
|
|
198
|
+
import { Inject, Injectable } from 'nexusjs';
|
|
199
|
+
import { DrizzleService } from 'nexusjs/drizzle';
|
|
200
|
+
import { eq } from 'drizzle-orm';
|
|
201
|
+
import { users } from '../../db/schema.js';
|
|
202
|
+
|
|
203
|
+
@Injectable()
|
|
204
|
+
export class UserService {
|
|
205
|
+
constructor(@Inject(DrizzleService.TOKEN) private db: DrizzleService) {}
|
|
206
|
+
|
|
207
|
+
findAll() { return this.db.select().from(users).all(); }
|
|
208
|
+
findById(id: number) { return this.db.select().from(users).where(eq(users.id, id)).get(); }
|
|
209
|
+
async create(email: string) {
|
|
210
|
+
return (await this.db.insert(users).values({ email }).returning())[0];
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
```ts
|
|
216
|
+
// app/modules/user/user.controller.ts
|
|
217
|
+
import { z } from 'zod';
|
|
218
|
+
import { Body, Controller, Delete, Get, Inject, Param, Post, Query, Validate } from 'nexusjs';
|
|
219
|
+
import { UserService } from './user.service.js';
|
|
220
|
+
|
|
221
|
+
const CreateUserSchema = z.object({
|
|
222
|
+
email: z.string().email(),
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
@Controller('/users')
|
|
226
|
+
export class UserController {
|
|
227
|
+
constructor(@Inject(UserService) private users: UserService) {}
|
|
228
|
+
|
|
229
|
+
@Get('/') async index() { return this.users.findAll(); }
|
|
230
|
+
@Get('/:id') async show(@Param('id') id: string) { return this.users.findById(Number(id)); }
|
|
231
|
+
@Post('/') @Validate({ body: CreateUserSchema }) async create(@Body() body: z.infer<typeof CreateUserSchema>) { return this.users.create(body.email); }
|
|
232
|
+
@Delete('/:id') async destroy(@Param('id') id: string) { /* ... */ }
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
$ bun run dev
|
|
238
|
+
[nexus] Routes registered. Listening on :3000
|
|
239
|
+
[nexus] Listening on http://localhost:3000
|
|
240
|
+
|
|
241
|
+
$ curl http://localhost:3000/users
|
|
242
|
+
[{"id":1,"email":"alice@example.com", ...}]
|
|
243
|
+
|
|
244
|
+
$ curl -X POST http://localhost:3000/users \
|
|
245
|
+
-H "Content-Type: application/json" \
|
|
246
|
+
-d '{"email":"bob@example.com"}'
|
|
247
|
+
{"id":2,"email":"bob@example.com"}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Generate the schema with the CLI
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
# Initialise nx.config.ts + drizzle.config.ts
|
|
254
|
+
nx init --orm drizzle --db postgres
|
|
255
|
+
|
|
256
|
+
# Generate a model
|
|
257
|
+
nx make:model User --columns 'email:text,status:boolean' --dialect postgres
|
|
258
|
+
|
|
259
|
+
# Generate a migration
|
|
260
|
+
nx make:migration create_users_table --dialect postgres --columns 'email:text'
|
|
261
|
+
|
|
262
|
+
# Apply pending migrations
|
|
263
|
+
nx db:migrate
|
|
264
|
+
|
|
265
|
+
# Inspect migration state
|
|
266
|
+
nx db:migrate --status
|
|
267
|
+
|
|
268
|
+
# Run database seeds
|
|
269
|
+
nx db:seed
|
|
270
|
+
|
|
271
|
+
# Scaffold a new seed file
|
|
272
|
+
nx db:seed --create users
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
See [docs/user-guide/drizzle.md](./docs/user-guide/drizzle.md) for the
|
|
276
|
+
full Drizzle integration guide.
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## Three routing styles
|
|
281
|
+
|
|
282
|
+
### 1. Nest style (class decorators)
|
|
283
|
+
|
|
284
|
+
```ts
|
|
285
|
+
@Controller('/users')
|
|
286
|
+
class UserController {
|
|
287
|
+
constructor(@Inject(UserService) private users: UserService) {}
|
|
288
|
+
|
|
289
|
+
@Get('/') list() {}
|
|
290
|
+
@Get('/:id') show(@Param('id') id: string) {}
|
|
291
|
+
@Post('/') create(@Body() body: CreateUserDto) {}
|
|
292
|
+
@Put('/:id') update(@Param('id') id: string, @Body() body: UpdateUserDto) {}
|
|
293
|
+
@Delete('/:id') destroy(@Param('id') id: string) {}
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### 2. Adonis style
|
|
298
|
+
|
|
299
|
+
```ts
|
|
300
|
+
app.server.router.add('GET', '/users', UserController, 'list');
|
|
301
|
+
app.server.router.add('POST', '/users', UserController, 'create');
|
|
302
|
+
app.server.router.add('GET', '/users/:id', UserController, 'show');
|
|
303
|
+
app.server.router.add('DELETE', '/users/:id', UserController, 'destroy');
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### 3. Functional style (Hono-native)
|
|
307
|
+
|
|
308
|
+
```ts
|
|
309
|
+
app.server.router.raw('GET', '/health', (c) => c.json({ ok: true }));
|
|
310
|
+
app.server.router.raw('POST', '/webhooks/stripe', async (c) => {
|
|
311
|
+
const event = await c.req.json();
|
|
312
|
+
// ...
|
|
313
|
+
});
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Parameter decorators
|
|
319
|
+
|
|
320
|
+
| Decorator | Reads |
|
|
321
|
+
| ------------ | --------------------------------------------- |
|
|
322
|
+
| `@Body(key?)`| Parsed request body (JSON / form / multipart) |
|
|
323
|
+
| `@Query(k?)` | URL query string |
|
|
324
|
+
| `@Param(k?)` | Path parameters |
|
|
325
|
+
| `@Headers(k?)`| Request headers |
|
|
326
|
+
| `@Req()` / `@Ctx()` | Hono context |
|
|
327
|
+
| `@Res()` | Hono response |
|
|
328
|
+
| `@Next()` | next() callback (for middleware-style) |
|
|
329
|
+
| `@User()` | Authenticated user (set by auth middleware) |
|
|
330
|
+
|
|
331
|
+
When a parameter has no key argument (e.g. `@Body()`), the full parsed
|
|
332
|
+
object is injected. With a key (e.g. `@Param('id')`), only that property
|
|
333
|
+
is injected.
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## Validation with Zod
|
|
338
|
+
|
|
339
|
+
```ts
|
|
340
|
+
@Post('/')
|
|
341
|
+
@Validate({
|
|
342
|
+
body: z.object({ name: z.string(), email: z.string().email() }),
|
|
343
|
+
query: z.object({ dryRun: z.coerce.boolean().optional() }),
|
|
344
|
+
params: z.object({ id: z.coerce.number() }),
|
|
345
|
+
})
|
|
346
|
+
async create(@Body() body, @Query() query, @Param() params) { ... }
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
Failed validation returns a 400 with details:
|
|
350
|
+
|
|
351
|
+
```json
|
|
352
|
+
{
|
|
353
|
+
"error": "Validation failed",
|
|
354
|
+
"issues": [
|
|
355
|
+
{ "code": "invalid_string", "validation": "email", "path": ["email"], "message": "Invalid email" }
|
|
356
|
+
]
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## Dependency injection
|
|
363
|
+
|
|
364
|
+
NestJS-style constructor injection via the `@Inject(Token)` parameter
|
|
365
|
+
decorator. Use `@Injectable()` on services and repositories, and the
|
|
366
|
+
container resolves the dependency graph automatically.
|
|
367
|
+
|
|
368
|
+
```ts
|
|
369
|
+
@Injectable()
|
|
370
|
+
class UserService {
|
|
371
|
+
constructor(@Inject('DB') private db: DrizzleLike) {}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
@Injectable()
|
|
375
|
+
class UserRepository {
|
|
376
|
+
constructor(@Inject('DB') private db: DrizzleLike) {}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
@Module({
|
|
380
|
+
providers: [
|
|
381
|
+
UserService,
|
|
382
|
+
UserRepository,
|
|
383
|
+
{ provide: 'DB', useValue: drizzleInstance },
|
|
384
|
+
],
|
|
385
|
+
exports: [UserService],
|
|
386
|
+
})
|
|
387
|
+
class UserModule {}
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
> **Why `@Inject(Token)`?** Bun's native TypeScript transformer does not
|
|
391
|
+
> emit `design:paramtypes` metadata. The framework falls back to
|
|
392
|
+
> explicit `@Inject()` tokens for portability. If you build with `tsc`
|
|
393
|
+
> first and run with `node` or `bun src/...`, the bare-type form works.
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
## Inertia.js adapter
|
|
398
|
+
|
|
399
|
+
Single-page-app UX without writing an API. The framework ships a
|
|
400
|
+
server-side [Inertia.js v2/v3 protocol](https://inertiajs.com/the-protocol)
|
|
401
|
+
adapter that returns either JSON (XHR) or a full HTML shell (first
|
|
402
|
+
load) depending on the request.
|
|
403
|
+
|
|
404
|
+
### Enable it
|
|
405
|
+
|
|
406
|
+
```ts
|
|
407
|
+
const app = new Application(AppModule, {
|
|
408
|
+
inertia: {
|
|
409
|
+
version: '1.0.0', // asset version for 409 on mismatch
|
|
410
|
+
title: 'My App',
|
|
411
|
+
sharedProps: () => ({ // per-request global props
|
|
412
|
+
appName: 'My App',
|
|
413
|
+
currentUser: await getCurrentUser(),
|
|
414
|
+
}),
|
|
415
|
+
},
|
|
416
|
+
});
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### Render a page
|
|
420
|
+
|
|
421
|
+
```ts
|
|
422
|
+
@Controller('/users')
|
|
423
|
+
class UserController {
|
|
424
|
+
constructor(@Inject(Inertia.TOKEN) private inertia: Inertia) {}
|
|
425
|
+
|
|
426
|
+
@Get('/')
|
|
427
|
+
index() {
|
|
428
|
+
return this.inertia.render('Users/Index', {
|
|
429
|
+
users: this.userService.findAll(),
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
The router detects the response (via a discriminator tag) and emits:
|
|
436
|
+
|
|
437
|
+
- **First load (no `X-Inertia` header)** — full HTML page with the page
|
|
438
|
+
object embedded as `data-page` JSON.
|
|
439
|
+
- **Subsequent visits (`X-Inertia: true`)** — JSON page object only.
|
|
440
|
+
|
|
441
|
+
### Lazy-evaluation helpers
|
|
442
|
+
|
|
443
|
+
Wrap a callback in one of these helpers to control *when* it resolves
|
|
444
|
+
and how the client merges the value:
|
|
445
|
+
|
|
446
|
+
| Helper | Behaviour |
|
|
447
|
+
| --------------------- | ------------------------------------------------------ |
|
|
448
|
+
| `defer(fn, group?)` | Send `null` placeholder; client refetches later |
|
|
449
|
+
| `always(fn)` | Include on every partial reload, even if filtered out |
|
|
450
|
+
| `optional(fn, n?)` | Skip on partial reloads when length ≤ threshold |
|
|
451
|
+
| `merge(fn, ids?)` | Client merges new value with previous (pagination) |
|
|
452
|
+
| `deepMerge(fn)` | Client deep-merges new value with previous |
|
|
453
|
+
| `once(fn)` | Include only on the first (HTML) load |
|
|
454
|
+
|
|
455
|
+
```ts
|
|
456
|
+
@Get('/dashboard')
|
|
457
|
+
dashboard() {
|
|
458
|
+
return this.inertia.render('Dashboard', {
|
|
459
|
+
// Always included, even when the client only fetches one prop.
|
|
460
|
+
currentUser: always(() => ({ id: 1, name: 'Alice' })),
|
|
461
|
+
|
|
462
|
+
// Deferred — placeholder, then a follow-up partial reload.
|
|
463
|
+
stats: defer(async () => ({ visits: 1234 }), 'metrics'),
|
|
464
|
+
|
|
465
|
+
// Pagination — the client appends to its existing array.
|
|
466
|
+
users: merge(() => this.userService.page(1), [['id']]),
|
|
467
|
+
|
|
468
|
+
// Only on first page load (HTML).
|
|
469
|
+
featureFlags: once(() => ({ newDashboard: true })),
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### Asset versioning
|
|
475
|
+
|
|
476
|
+
When `version` is configured and the client's `X-Inertia-Version`
|
|
477
|
+
header doesn't match, the adapter responds with **409 Conflict** and
|
|
478
|
+
the `X-Inertia-Location` header pointing at the same URL — the client
|
|
479
|
+
then does a full page reload (refetching CSS/JS bundles).
|
|
480
|
+
|
|
481
|
+
```http
|
|
482
|
+
GET /dashboard
|
|
483
|
+
X-Inertia: true
|
|
484
|
+
X-Inertia-Version: 0.9.0
|
|
485
|
+
|
|
486
|
+
HTTP/1.1 409 Conflict
|
|
487
|
+
X-Inertia-Location: /dashboard
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
### Full-page navigation and history
|
|
491
|
+
|
|
492
|
+
Force the client to bypass Inertia's client-side history (useful for
|
|
493
|
+
logout or any flow where you want a clean reload):
|
|
494
|
+
|
|
495
|
+
```ts
|
|
496
|
+
@Post('/logout')
|
|
497
|
+
logout() {
|
|
498
|
+
// 303-style redirect — full page reload to /login.
|
|
499
|
+
return this.inertia.location('/login');
|
|
500
|
+
}
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
`inertia.back()` returns a 302 with `Location: back` — the client
|
|
504
|
+
steps back in its history.
|
|
505
|
+
|
|
506
|
+
### Shared data
|
|
507
|
+
|
|
508
|
+
```ts
|
|
509
|
+
app.inertia.share('flash', { type: 'success', message: 'Saved!' });
|
|
510
|
+
// or
|
|
511
|
+
app.inertia.share({ csrfToken: '...', currentUser: { id: 1 } });
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
Shared props appear in every page response and survive partial reloads.
|
|
515
|
+
|
|
516
|
+
### SSR
|
|
517
|
+
|
|
518
|
+
Plug in a server-side renderer for React, Vue, Svelte, or Solid:
|
|
519
|
+
|
|
520
|
+
```ts
|
|
521
|
+
import { reactSsr } from '@nexus/inertia-react';
|
|
522
|
+
|
|
523
|
+
app.inertia.setSsrAdapter(reactSsr());
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
Without an adapter the framework falls back to a minimal HTML shell —
|
|
527
|
+
the client hydrates from `data-page` after JS loads. (This is the
|
|
528
|
+
recommended starting point.)
|
|
529
|
+
|
|
530
|
+
### Protocol reference
|
|
531
|
+
|
|
532
|
+
- **Response headers**
|
|
533
|
+
- `Vary: X-Inertia` — every response
|
|
534
|
+
- `X-Inertia: true` — JSON responses only
|
|
535
|
+
- `X-Inertia-Location: <url>` — on 409 (asset version mismatch) and
|
|
536
|
+
`inertia.location(...)`
|
|
537
|
+
- **Request headers** (sent by the client)
|
|
538
|
+
- `X-Inertia: true` — marks an XHR visit
|
|
539
|
+
- `X-Inertia-Version: <string>` — for asset mismatch checks
|
|
540
|
+
- `X-Inertia-Partial-Component: <name>` — for partial reloads
|
|
541
|
+
- `X-Inertia-Partial-Data: a,b,c` — `only` filter
|
|
542
|
+
- `X-Inertia-Partial-Except: a,b,c` — `except` filter
|
|
543
|
+
- `X-Inertia-Reset: a,b,c` — client-discard markers
|
|
544
|
+
|
|
545
|
+
---
|
|
546
|
+
|
|
547
|
+
### Forms (`<Form>` server-side helper)
|
|
548
|
+
|
|
549
|
+
Inertia v3's `<Form>` component pairs with this server-side helper to
|
|
550
|
+
keep form submissions out of the controller's hot path. The pattern
|
|
551
|
+
is the classic **Post/Redirect/Get**:
|
|
552
|
+
|
|
553
|
+
```ts
|
|
554
|
+
import { z } from 'zod';
|
|
555
|
+
import { Body, Controller, Post } from 'nexusjs';
|
|
556
|
+
import { Inertia } from 'nexusjs/view/inertia';
|
|
557
|
+
|
|
558
|
+
const UserSchema = z.object({
|
|
559
|
+
name: z.string().min(2),
|
|
560
|
+
email: z.string().email(),
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
@Controller('/users')
|
|
564
|
+
class UserController {
|
|
565
|
+
constructor(@Inject(Inertia.TOKEN) private inertia: Inertia) {}
|
|
566
|
+
|
|
567
|
+
@Post('/')
|
|
568
|
+
async store(@Body() input: Record<string, any>) {
|
|
569
|
+
const form = this.inertia.form('Users/Create');
|
|
570
|
+
const result = UserSchema.safeParse(input);
|
|
571
|
+
|
|
572
|
+
if (!result.success) {
|
|
573
|
+
const errors: Record<string, string[]> = {};
|
|
574
|
+
for (const issue of result.error.issues) {
|
|
575
|
+
const path = issue.path.join('.');
|
|
576
|
+
(errors[path] ??= []).push(issue.message);
|
|
577
|
+
}
|
|
578
|
+
return form
|
|
579
|
+
.withErrorBag('createUser')
|
|
580
|
+
.withErrors(errors)
|
|
581
|
+
.withValues(input) // re-populate the form
|
|
582
|
+
.render();
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
return form.redirect('/users'); // 303 (PRG pattern)
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
| Builder method | Effect |
|
|
591
|
+
| ---------------- | ---------------------------------------------------------- |
|
|
592
|
+
| `withProps()` | Merge a batch of props at once |
|
|
593
|
+
| `with(k, v)` | Set a single prop |
|
|
594
|
+
| `withErrors()` | Attach validation errors (string or string[]) per field |
|
|
595
|
+
| `withError()` | Add a single error to a field |
|
|
596
|
+
| `withErrorBag()` | Name the form's error namespace (multiple forms / page) |
|
|
597
|
+
| `withValues()` | Re-populate the form inputs after a failed submission |
|
|
598
|
+
| `render()` | Emit the page (with errors + values injected) |
|
|
599
|
+
| `redirect(url)` | 303 redirect (PRG — prevents double-submit) |
|
|
600
|
+
| `back(to?)` | 303 redirect to `back` (or a specific URL) |
|
|
601
|
+
|
|
602
|
+
### Lazy props
|
|
603
|
+
|
|
604
|
+
`lazy(fn, tag?)` wraps a callback so its result is computed **once
|
|
605
|
+
per request** and shared across every key that points at the same
|
|
606
|
+
tag. Useful for any expensive computation that doesn't need to wait
|
|
607
|
+
for a partial reload but shouldn't repeat within the same response:
|
|
608
|
+
|
|
609
|
+
```ts
|
|
610
|
+
return this.inertia.render('Dashboard', {
|
|
611
|
+
a: lazy(() => this.computeA(), 'stats'),
|
|
612
|
+
b: lazy(() => this.computeB(), 'stats'),
|
|
613
|
+
});
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
### SSR adapters
|
|
617
|
+
|
|
618
|
+
The framework ships first-class adapters for React, Vue, Svelte,
|
|
619
|
+
and Solid. Each lazy-imports its engine — install only what you
|
|
620
|
+
use:
|
|
621
|
+
|
|
622
|
+
```ts
|
|
623
|
+
import { createReactAdapter, ComponentRegistry } from 'nexusjs/view/inertia/ssr';
|
|
624
|
+
|
|
625
|
+
const components = new ComponentRegistry()
|
|
626
|
+
.register('Home', HomePage)
|
|
627
|
+
.register('Users/Index', UsersIndexPage);
|
|
628
|
+
|
|
629
|
+
app.inertia.setSsrAdapter(createReactAdapter({ components }));
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
| Adapter | Engine | SSR API |
|
|
633
|
+
| ------------------------ | --------- | ---------------------------------------------- |
|
|
634
|
+
| `createReactAdapter` | React 18+ | `react-dom/server.renderToString` |
|
|
635
|
+
| `createVueAdapter` | Vue 3 | `vue/server-renderer.renderToString` |
|
|
636
|
+
| `createSvelteAdapter` | Svelte 4/5| `svelte/server.render` or `Component.render` |
|
|
637
|
+
| `createSolidAdapter` | Solid | `solid-js/web.renderToString` |
|
|
638
|
+
|
|
639
|
+
### Form middleware (CSRF)
|
|
640
|
+
|
|
641
|
+
```ts
|
|
642
|
+
import { inertiaFormMiddleware } from 'nexusjs/view/inertia';
|
|
643
|
+
|
|
644
|
+
app.server.app.use('*', inertiaFormMiddleware({
|
|
645
|
+
validateCsrf: true,
|
|
646
|
+
csrfHeader: 'X-CSRF-Token',
|
|
647
|
+
csrfField: '_token',
|
|
648
|
+
csrfSharedKey: 'csrfToken',
|
|
649
|
+
}));
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
Returns **419 Page Expired** on mismatch. The form helper still owns
|
|
653
|
+
the per-field validation flow; this is the upstream CSRF gate.
|
|
654
|
+
|
|
655
|
+
---
|
|
656
|
+
|
|
657
|
+
---
|
|
658
|
+
|
|
659
|
+
## View engine — `nexusjs/view`
|
|
660
|
+
|
|
661
|
+
The view engine is available as `nexusjs/view` — its own bundle entry
|
|
662
|
+
point. It ships three adapters:
|
|
663
|
+
|
|
664
|
+
| Adapter | Extension | Style | Runtime support |
|
|
665
|
+
|---------|-----------|-------|----------------|
|
|
666
|
+
| **Rendu** (default) | `.html`, `.rendu` | PHP-style `<?= expr ?>` | Bun / Node / Cloudflare Workers |
|
|
667
|
+
| **Edge** | `.edge` | Mustache-style `{{ expr }}` | Bun / Node |
|
|
668
|
+
| **Eta** | `.eta` | EJS-style `<%= expr %>` | Bun / Node / Deno / Workers |
|
|
669
|
+
|
|
670
|
+
### Auto-detection by file extension
|
|
671
|
+
|
|
672
|
+
When you return `{ view: 'about.html', data }` from a controller, the
|
|
673
|
+
framework picks the right adapter based on the file extension:
|
|
674
|
+
|
|
675
|
+
- `.html` / `.rendu` → RenduAdapter
|
|
676
|
+
- `.edge` → EdgeAdapter
|
|
677
|
+
- `.eta` → EtaAdapter
|
|
678
|
+
|
|
679
|
+
### File-based views
|
|
680
|
+
|
|
681
|
+
The Application auto-loads `viewPaths` from `nx.config.ts` at boot,
|
|
682
|
+
so no explicit call is needed:
|
|
683
|
+
|
|
684
|
+
```ts
|
|
685
|
+
// nx.config.ts — all you need
|
|
686
|
+
export default {
|
|
687
|
+
view: 'rendu',
|
|
688
|
+
viewPaths: 'resources/views',
|
|
689
|
+
};
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
Then controllers reference view files directly:
|
|
693
|
+
|
|
694
|
+
```ts
|
|
695
|
+
@Get('/')
|
|
696
|
+
index() {
|
|
697
|
+
return {
|
|
698
|
+
view: 'welcome.html',
|
|
699
|
+
data: { year: new Date().getFullYear() },
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
### Override the adapter at runtime
|
|
705
|
+
|
|
706
|
+
```ts
|
|
707
|
+
app.setViewAdapter(new EdgeAdapter());
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
Or implement the `ViewAdapter` interface for a custom engine:
|
|
711
|
+
|
|
712
|
+
```ts
|
|
713
|
+
import type { ViewAdapter } from 'nexusjs/view';
|
|
714
|
+
|
|
715
|
+
class MyEngine implements ViewAdapter {
|
|
716
|
+
readonly name = 'my-engine';
|
|
717
|
+
async render(template: string, data: Record<string, any>) { /* ... */ }
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
app.setViewAdapter(new MyEngine());
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
### Inline templates (no file system)
|
|
724
|
+
|
|
725
|
+
When `viewPaths` is empty (the default), the `view` value is treated
|
|
726
|
+
as an inline Rendu template:
|
|
727
|
+
|
|
728
|
+
```ts
|
|
729
|
+
@Get('/users')
|
|
730
|
+
async index() {
|
|
731
|
+
return {
|
|
732
|
+
view: '<h1>Users</h1><?= users.length ?>',
|
|
733
|
+
data: { users: this.users.findAll() },
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
```
|
|
737
|
+
|
|
738
|
+
---
|
|
739
|
+
|
|
740
|
+
## Runtime adapters
|
|
741
|
+
|
|
742
|
+
The framework auto-detects Bun, Node, and Cloudflare Workers and loads
|
|
743
|
+
the appropriate adapter.
|
|
744
|
+
|
|
745
|
+
```ts
|
|
746
|
+
// Bun (default)
|
|
747
|
+
await app.listen(3000);
|
|
748
|
+
|
|
749
|
+
// Node
|
|
750
|
+
// (no extra setup — the server picks the Node adapter automatically)
|
|
751
|
+
|
|
752
|
+
// Cloudflare Workers
|
|
753
|
+
export default {
|
|
754
|
+
fetch: app.fetch,
|
|
755
|
+
};
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
---
|
|
759
|
+
|
|
760
|
+
## Project layout (the framework source)
|
|
761
|
+
|
|
762
|
+
```
|
|
763
|
+
src/
|
|
764
|
+
├── core/ # Framework core (always shipped)
|
|
765
|
+
│ ├── constants.ts # Metadata keys, param types
|
|
766
|
+
│ ├── application.ts # Main Application class
|
|
767
|
+
│ ├── di/ # DIContainer, scanner, tokens
|
|
768
|
+
│ ├── decorators/ # @Module, @Controller, @Injectable, @Get, @Body, @Validate, ...
|
|
769
|
+
│ ├── http/ # NexusServer (Hono), multi-style router, middleware
|
|
770
|
+
│ ├── validation/ # Zod schema runner
|
|
771
|
+
│ ├── view/ # Rendu / Edge / Inertia adapters
|
|
772
|
+
│ └── runtime/ # Bun / Node / Cloudflare Workers adapters
|
|
773
|
+
├── cli/ # `nx` command runner (optional bundle)
|
|
774
|
+
│ ├── commands/ # new, init, make:*, migrate, info
|
|
775
|
+
│ ├── templates/ # mustache-lite scaffolds
|
|
776
|
+
│ └── core/ # arg parser, prompts, fs helpers
|
|
777
|
+
├── auth/ # `nexusjs/auth` (better-auth wrapper)
|
|
778
|
+
├── queue/ # `nexusjs/queue` (BullMQ / Cloudflare / memory)
|
|
779
|
+
├── schedule/ # `nexusjs/schedule` (custom cron parser)
|
|
780
|
+
├── events/ # `nexusjs/events` (typed emitter)
|
|
781
|
+
├── session/ # `nexusjs/session` (cookie / memory / drizzle backends)
|
|
782
|
+
├── health/ # `nexusjs/health` (live/ready/startup + indicators)
|
|
783
|
+
├── config/ # `nexusjs/config` (Zod-validated env config)
|
|
784
|
+
├── logger/ # `nexusjs/logger` (Pino transports)
|
|
785
|
+
├── static/ # `nexusjs/static` (file serving)
|
|
786
|
+
├── limiter/ # `nexusjs/limiter` (rate limiting)
|
|
787
|
+
├── shield/ # `nexusjs/shield` (CSRF + security headers)
|
|
788
|
+
├── cache/ # `nexusjs/cache` (LRU + drizzle)
|
|
789
|
+
├── drive/ # `nexusjs/drive` (storage abstraction)
|
|
790
|
+
├── mail/ # `nexusjs/mail` (SMTP / File / Null)
|
|
791
|
+
└── drizzle/ # `nexusjs/drizzle` (default ORM)
|
|
792
|
+
├── drivers/ # postgres / mysql / sqlite / bun-sqlite / d1
|
|
793
|
+
├── repository/ # DrizzleRepository (Lucid-style)
|
|
794
|
+
├── decorators/ # @Table / @Column / @PrimaryKey
|
|
795
|
+
├── drizzle.service.ts # Main entry point
|
|
796
|
+
└── drizzle.module.ts # DI module
|
|
797
|
+
```
|
|
798
|
+
|
|
799
|
+
```
|
|
800
|
+
|
|
801
|
+
---
|
|
802
|
+
|
|
803
|
+
## Roadmap
|
|
804
|
+
|
|
805
|
+
The framework follows [Semantic Versioning](https://semver.org/).
|
|
806
|
+
Until v1.0, minor version bumps may include breaking changes. After
|
|
807
|
+
v1.0, only major bumps will.
|
|
808
|
+
|
|
809
|
+
### Shipped
|
|
810
|
+
|
|
811
|
+
- **v0.1** (2026-04-30) — MVC core, DI, validation, Rendu / Edge / Inertia adapters, CLI bootstrap.
|
|
812
|
+
- **v0.2** (2026-05-15) — `nexusjs/auth`, `nexusjs/queue`, `nexusjs/schedule`, `nexusjs/events`, `nexusjs/session`, full `nx` CLI.
|
|
813
|
+
- **v0.3** (2026-06-21) — production basics, cross-cutting features, `nexusjs/drizzle` as the default ORM.
|
|
814
|
+
- **v0.4** (2026-06-22) — observability + DX: `nexusjs/openapi`, `nexusjs/upload`, `nexusjs/sse`, `nexusjs/tracing`, `nexusjs/metrics`, request-scoped DI in core.
|
|
815
|
+
- **v0.5** (2026-06-23) — realtime + crypto + i18n + redis: `nexusjs/ws`, `nexusjs/crypto`, `nexusjs/i18n`, `nexusjs/redis`.
|
|
816
|
+
- **v0.6** (2026-06-24) — gRPC + tooling: `nexusjs/grpc` (reflection-based server + typed client) and a publishable `dist/` pipeline (`bin` field, `dist/src/*` flatten).
|
|
817
|
+
- **v0.6.1** (2026-06-25) — patch: `nexus` → `nexusjs` rename across all sources (191 files), `bin` field fix, `dist/src/*` flatten, docs in sync with the published name. No new features.
|
|
818
|
+
- **v0.6.3** (2026-06-26) — view engine extracted to `nexusjs/view`, Eta adapter, file-based view paths, auto-detection by extension.
|
|
819
|
+
- **v0.6.4** (2026-06-22) — default view engine to Rendu, CLI view options include eta, Application auto-loads viewPaths from nx.config.ts, static file path fix, scaffold deduplication.
|
|
820
|
+
- **v0.6.5** (2026-06-22) — env-aware config, `nx db:generate`, built-in `sessionMiddleware()`, scaffold generates `.env`/`.env.local`/`.gitignore`, drizzle model import fix, `make:crud` repository fix.
|
|
821
|
+
|
|
822
|
+
### Planned
|
|
823
|
+
|
|
824
|
+
- **v0.7** — `nexusjs/graphql` (code-first schema) and `nexusjs/resilience` (circuit breaker, retry, bulkhead).
|
|
825
|
+
- **v0.8** — `nexusjs/feature-flag` (canary / A/B testing), runtime parity test suite, performance benchmarks across Bun / Node / Workers.
|
|
826
|
+
- **v1.0** — stable public API surface with semver guarantees, removal of all v0.1 deprecated aliases, long-term LTS support plan.
|
|
827
|
+
|
|
828
|
+
Detailed release notes for every version live in
|
|
829
|
+
[`CHANGELOG.md`](./CHANGELOG.md).
|
|
830
|
+
|
|
831
|
+
## License
|
|
832
|
+
|
|
833
|
+
[MIT](./LICENSE) — Copyright © 2026 NexusJS Contributors.
|
|
834
|
+
|
|
835
|
+
The framework is released under the permissive MIT License. You can
|
|
836
|
+
use it in commercial and non-commercial projects, modify the source,
|
|
837
|
+
and distribute derivative works — as long as you preserve the
|
|
838
|
+
copyright notice and the license text. See the [LICENSE](./LICENSE)
|
|
839
|
+
file for the full text.
|
|
840
|
+
|
|
841
|
+
### Third-party notices
|
|
842
|
+
|
|
843
|
+
NexusJS depends on several open-source projects. Their licenses are
|
|
844
|
+
reproduced at install time via `bun install` (and `npm install`).
|
|
845
|
+
Notable runtime dependencies:
|
|
846
|
+
|
|
847
|
+
- **Hono** — MIT (web framework)
|
|
848
|
+
- **reflect-metadata** — Apache-2.0
|
|
849
|
+
- **Zod** — MIT (schema validation)
|
|
850
|
+
- **Rendu** — MIT (template engine)
|
|
851
|
+
|
|
852
|
+
Optional peer dependencies (each with its own license):
|
|
853
|
+
|
|
854
|
+
- **better-auth** — MIT
|
|
855
|
+
- **bullmq** — MIT
|
|
856
|
+
- **ioredis** — MIT
|
|
857
|
+
- **drizzle-orm** — Apache-2.0
|
|
858
|
+
- **@opentelemetry/*** — Apache-2.0
|
|
859
|
+
- **ws** — MIT
|
|
860
|
+
- **@grpc/grpc-js**, **@grpc/proto-loader** — Apache-2.0
|