stackkit 0.2.7 → 0.2.9

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.
Files changed (61) hide show
  1. package/README.md +91 -12
  2. package/dist/lib/fs/files.js +1 -1
  3. package/dist/lib/generation/code-generator.d.ts +2 -7
  4. package/dist/lib/generation/code-generator.js +120 -56
  5. package/dist/lib/utils/fs-helpers.d.ts +1 -1
  6. package/modules/auth/authjs/generator.json +16 -16
  7. package/modules/auth/better-auth/files/express/middlewares/authorize.ts +121 -41
  8. package/modules/auth/better-auth/files/express/modules/auth/auth.controller.ts +257 -0
  9. package/modules/auth/better-auth/files/express/modules/auth/auth.interface.ts +23 -0
  10. package/modules/auth/better-auth/files/express/modules/auth/auth.route.ts +22 -0
  11. package/modules/auth/better-auth/files/express/modules/auth/auth.service.ts +403 -0
  12. package/modules/auth/better-auth/files/express/templates/google-redirect.ejs +91 -0
  13. package/modules/auth/better-auth/files/express/templates/otp.ejs +87 -0
  14. package/modules/auth/better-auth/files/express/types/express.d.ts +6 -8
  15. package/modules/auth/better-auth/files/express/utils/cookie.ts +19 -0
  16. package/modules/auth/better-auth/files/express/utils/jwt.ts +34 -0
  17. package/modules/auth/better-auth/files/express/utils/token.ts +66 -0
  18. package/modules/auth/better-auth/files/nextjs/api/auth/[...all]/route.ts +1 -1
  19. package/modules/auth/better-auth/files/nextjs/lib/auth/auth-guards.ts +11 -1
  20. package/modules/auth/better-auth/files/nextjs/templates/email-otp.tsx +74 -0
  21. package/modules/auth/better-auth/files/shared/config/env.ts +113 -0
  22. package/modules/auth/better-auth/files/shared/lib/auth-client.ts +1 -1
  23. package/modules/auth/better-auth/files/shared/lib/auth.ts +151 -62
  24. package/modules/auth/better-auth/files/shared/prisma/schema.prisma +22 -11
  25. package/modules/auth/better-auth/files/shared/utils/email.ts +71 -0
  26. package/modules/auth/better-auth/generator.json +159 -81
  27. package/modules/database/mongoose/generator.json +18 -18
  28. package/modules/database/prisma/generator.json +44 -44
  29. package/package.json +1 -1
  30. package/templates/express/env.example +2 -2
  31. package/templates/express/eslint.config.mjs +7 -0
  32. package/templates/express/node_modules/.bin/acorn +17 -0
  33. package/templates/express/node_modules/.bin/eslint +17 -0
  34. package/templates/express/node_modules/.bin/tsc +17 -0
  35. package/templates/express/node_modules/.bin/tsserver +17 -0
  36. package/templates/express/node_modules/.bin/tsx +17 -0
  37. package/templates/express/package.json +12 -6
  38. package/templates/express/src/app.ts +15 -7
  39. package/templates/express/src/config/cors.ts +8 -7
  40. package/templates/express/src/config/env.ts +26 -5
  41. package/templates/express/src/config/logger.ts +2 -2
  42. package/templates/express/src/config/rate-limit.ts +2 -2
  43. package/templates/express/src/modules/health/health.controller.ts +13 -11
  44. package/templates/express/src/routes/index.ts +1 -6
  45. package/templates/express/src/server.ts +12 -12
  46. package/templates/express/src/shared/errors/app-error.ts +16 -0
  47. package/templates/express/src/shared/middlewares/error.middleware.ts +154 -12
  48. package/templates/express/src/shared/middlewares/not-found.middleware.ts +2 -1
  49. package/templates/express/src/shared/utils/catch-async.ts +11 -0
  50. package/templates/express/src/shared/utils/pagination.ts +6 -1
  51. package/templates/express/src/shared/utils/send-response.ts +25 -0
  52. package/templates/nextjs/lib/env.ts +19 -8
  53. package/modules/auth/better-auth/files/shared/lib/email/email-service.ts +0 -33
  54. package/modules/auth/better-auth/files/shared/lib/email/email-templates.ts +0 -89
  55. package/templates/express/eslint.config.cjs +0 -42
  56. package/templates/express/src/config/helmet.ts +0 -5
  57. package/templates/express/src/modules/health/health.service.ts +0 -6
  58. package/templates/express/src/shared/errors/error-codes.ts +0 -9
  59. package/templates/express/src/shared/logger/logger.ts +0 -20
  60. package/templates/express/src/shared/utils/async-handler.ts +0 -9
  61. package/templates/express/src/shared/utils/response.ts +0 -9
@@ -1,42 +0,0 @@
1
- module.exports = [
2
- // Global ignores
3
- {
4
- ignores: ['**/node_modules/**', '**/dist/**', '.env'],
5
- },
6
-
7
- // TypeScript files
8
- {
9
- files: ['**/*.ts', '**/*.tsx'],
10
- languageOptions: {
11
- parser: require('@typescript-eslint/parser'),
12
- parserOptions: {
13
- project: './tsconfig.json',
14
- ecmaVersion: 'latest',
15
- sourceType: 'module',
16
- },
17
- },
18
- plugins: {
19
- '@typescript-eslint': require('@typescript-eslint/eslint-plugin'),
20
- },
21
- rules: {
22
- 'prefer-const': 'error',
23
- 'no-console': 'off',
24
- eqeqeq: ['error', 'always'],
25
- curly: ['error', 'multi-line'],
26
- 'no-implicit-coercion': ['warn', { allow: ['!!'] }],
27
- '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^(?:_|next)$' }],
28
- '@typescript-eslint/explicit-module-boundary-types': 'off',
29
- '@typescript-eslint/no-explicit-any': 'off',
30
- },
31
- },
32
-
33
- // JavaScript files
34
- {
35
- files: ['**/*.js'],
36
- languageOptions: {
37
- ecmaVersion: 'latest',
38
- sourceType: 'module',
39
- },
40
- rules: {},
41
- },
42
- ];
@@ -1,5 +0,0 @@
1
- import createHelmet from "helmet";
2
-
3
- const helmet = createHelmet();
4
-
5
- export { helmet };
@@ -1,6 +0,0 @@
1
- // Demo service - placeholder for future use
2
- // Add your service logic here when needed
3
-
4
- export const healthServices = {
5
- // placeholder
6
- };
@@ -1,9 +0,0 @@
1
- const ERROR_CODES = {
2
- VALIDATION: "VALIDATION_ERROR",
3
- NOT_FOUND: "NOT_FOUND",
4
- UNAUTHORIZED: "UNAUTHORIZED",
5
- FORBIDDEN: "FORBIDDEN",
6
- INTERNAL: "INTERNAL_ERROR",
7
- } as const;
8
-
9
- export default ERROR_CODES;
@@ -1,20 +0,0 @@
1
- function ts() {
2
- return new Date().toISOString();
3
- }
4
-
5
- export const info = (msg: string, meta?: any) => {
6
- console.log(`${ts()} INFO: ${msg}` + (meta ? ` ${JSON.stringify(meta)}` : ""));
7
- };
8
- export const warn = (msg: string, meta?: any) => {
9
- console.warn(`${ts()} WARN: ${msg}` + (meta ? ` ${JSON.stringify(meta)}` : ""));
10
- };
11
- export const error = (msg: string, meta?: any) => {
12
- console.error(`${ts()} ERROR: ${msg}` + (meta ? ` ${JSON.stringify(meta)}` : ""));
13
- };
14
- export const debug = (msg: string, meta?: any) => {
15
- if (process.env.NODE_ENV !== "production") {
16
- console.debug(`${ts()} DEBUG: ${msg}` + (meta ? ` ${JSON.stringify(meta)}` : ""));
17
- }
18
- };
19
-
20
- export default { info, warn, error, debug };
@@ -1,9 +0,0 @@
1
- import { NextFunction, Request, Response } from "express";
2
-
3
- export default function asyncHandler(
4
- fn: (req: Request, res: Response, next: NextFunction) => Promise<any>,
5
- ) {
6
- return (req: Request, res: Response, next: NextFunction) => {
7
- fn(req, res, next).catch(next);
8
- };
9
- }
@@ -1,9 +0,0 @@
1
- import { Response } from "express";
2
-
3
- export function success(res: Response, data: any, message = "Success", meta?: any) {
4
- return res.json({ success: true, message, data, meta });
5
- }
6
-
7
- export function fail(res: Response, status = 500, message = "Error", details?: any) {
8
- return res.status(status).json({ success: false, message, details });
9
- }