@yoms/create-monorepo 1.0.2

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 (64) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +204 -0
  3. package/dist/index.js +649 -0
  4. package/package.json +74 -0
  5. package/templates/backend-hono/base/.env.example +7 -0
  6. package/templates/backend-hono/base/Dockerfile +55 -0
  7. package/templates/backend-hono/base/package.json +30 -0
  8. package/templates/backend-hono/base/src/config/env.ts +12 -0
  9. package/templates/backend-hono/base/src/config/logger.ts +52 -0
  10. package/templates/backend-hono/base/src/index.ts +49 -0
  11. package/templates/backend-hono/base/src/lib/__tests__/response.test.ts +66 -0
  12. package/templates/backend-hono/base/src/lib/errors.ts +87 -0
  13. package/templates/backend-hono/base/src/lib/response.ts +72 -0
  14. package/templates/backend-hono/base/src/middleware/__tests__/error.test.ts +86 -0
  15. package/templates/backend-hono/base/src/middleware/cors.middleware.ts +9 -0
  16. package/templates/backend-hono/base/src/middleware/error.middleware.ts +43 -0
  17. package/templates/backend-hono/base/src/middleware/logger.middleware.ts +14 -0
  18. package/templates/backend-hono/base/src/middleware/rate-limit.middleware.ts +135 -0
  19. package/templates/backend-hono/base/src/routes/__tests__/health.test.ts +36 -0
  20. package/templates/backend-hono/base/src/routes/health.route.ts +14 -0
  21. package/templates/backend-hono/base/src/types/app.types.ts +26 -0
  22. package/templates/backend-hono/base/tsconfig.json +10 -0
  23. package/templates/backend-hono/base/vitest.config.ts +19 -0
  24. package/templates/backend-hono/features/mongodb-prisma/env-additions.txt +2 -0
  25. package/templates/backend-hono/features/mongodb-prisma/package-additions.json +14 -0
  26. package/templates/backend-hono/features/mongodb-prisma/prisma/schema.prisma +18 -0
  27. package/templates/backend-hono/features/mongodb-prisma/src/config/database.ts +43 -0
  28. package/templates/backend-hono/features/mongodb-prisma/src/routes/users.route.ts +82 -0
  29. package/templates/backend-hono/features/mongodb-prisma/src/services/user.service.ts +121 -0
  30. package/templates/backend-hono/features/postgres-prisma/env-additions.txt +2 -0
  31. package/templates/backend-hono/features/postgres-prisma/package-additions.json +15 -0
  32. package/templates/backend-hono/features/postgres-prisma/prisma/schema.prisma +18 -0
  33. package/templates/backend-hono/features/postgres-prisma/src/config/database.ts +43 -0
  34. package/templates/backend-hono/features/postgres-prisma/src/routes/users.route.ts +82 -0
  35. package/templates/backend-hono/features/postgres-prisma/src/services/user.service.ts +121 -0
  36. package/templates/backend-hono/features/redis/env-additions.txt +2 -0
  37. package/templates/backend-hono/features/redis/package-additions.json +8 -0
  38. package/templates/backend-hono/features/redis/src/config/redis.ts +32 -0
  39. package/templates/backend-hono/features/redis/src/services/cache.service.ts +107 -0
  40. package/templates/backend-hono/features/smtp/env-additions.txt +7 -0
  41. package/templates/backend-hono/features/smtp/package-additions.json +8 -0
  42. package/templates/backend-hono/features/smtp/src/config/mail.ts +38 -0
  43. package/templates/backend-hono/features/smtp/src/services/email.service.ts +78 -0
  44. package/templates/backend-hono/features/swagger/package-additions.json +6 -0
  45. package/templates/backend-hono/features/swagger/src/lib/openapi.ts +19 -0
  46. package/templates/backend-hono/features/swagger/src/routes/docs.route.ts +18 -0
  47. package/templates/frontend-nextjs/base/.env.example +2 -0
  48. package/templates/frontend-nextjs/base/app/globals.css +59 -0
  49. package/templates/frontend-nextjs/base/app/layout.tsx +22 -0
  50. package/templates/frontend-nextjs/base/app/page.tsx +49 -0
  51. package/templates/frontend-nextjs/base/components.json +18 -0
  52. package/templates/frontend-nextjs/base/lib/api-client.ts +67 -0
  53. package/templates/frontend-nextjs/base/lib/utils.ts +6 -0
  54. package/templates/frontend-nextjs/base/next.config.ts +8 -0
  55. package/templates/frontend-nextjs/base/package.json +33 -0
  56. package/templates/frontend-nextjs/base/postcss.config.mjs +9 -0
  57. package/templates/frontend-nextjs/base/public/.gitkeep +1 -0
  58. package/templates/frontend-nextjs/base/tailwind.config.ts +58 -0
  59. package/templates/frontend-nextjs/base/tsconfig.json +19 -0
  60. package/templates/shared/base/package.json +19 -0
  61. package/templates/shared/base/src/index.ts +5 -0
  62. package/templates/shared/base/src/schemas/user.schema.ts +34 -0
  63. package/templates/shared/base/src/types.ts +46 -0
  64. package/templates/shared/base/tsconfig.json +9 -0
@@ -0,0 +1,8 @@
1
+ import type { NextConfig } from 'next';
2
+
3
+ const nextConfig: NextConfig = {
4
+ transpilePackages: ['__PACKAGE_SCOPE__/shared'],
5
+ reactStrictMode: true,
6
+ };
7
+
8
+ export default nextConfig;
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "__PACKAGE_SCOPE__/web",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "next dev -p __WEB_PORT__",
7
+ "build": "next build",
8
+ "start": "next start -p __WEB_PORT__",
9
+ "typecheck": "tsc --noEmit",
10
+ "lint": "next lint",
11
+ "format": "prettier --write \"app/**/*.{ts,tsx}\" \"components/**/*.{ts,tsx}\" \"lib/**/*.ts\""
12
+ },
13
+ "dependencies": {
14
+ "next": "^15.1.6",
15
+ "react": "^19.0.0",
16
+ "react-dom": "^19.0.0",
17
+ "class-variance-authority": "^0.7.1",
18
+ "clsx": "^2.1.1",
19
+ "tailwind-merge": "^2.6.0",
20
+ "__PACKAGE_SCOPE__/shared": "workspace:*"
21
+ },
22
+ "devDependencies": {
23
+ "@types/node": "^22.10.5",
24
+ "@types/react": "^19.0.6",
25
+ "@types/react-dom": "^19.0.2",
26
+ "autoprefixer": "^10.4.20",
27
+ "eslint": "^9.17.0",
28
+ "eslint-config-next": "^15.1.6",
29
+ "postcss": "^8.4.49",
30
+ "tailwindcss": "^3.4.17",
31
+ "typescript": "^5.7.2"
32
+ }
33
+ }
@@ -0,0 +1,9 @@
1
+ /** @type {import('postcss-load-config').Config} */
2
+ const config = {
3
+ plugins: {
4
+ tailwindcss: {},
5
+ autoprefixer: {},
6
+ },
7
+ };
8
+
9
+ export default config;
@@ -0,0 +1 @@
1
+ # This file ensures the public directory is tracked by git
@@ -0,0 +1,58 @@
1
+ import type { Config } from 'tailwindcss';
2
+
3
+ const config: Config = {
4
+ darkMode: ['class'],
5
+ content: [
6
+ './pages/**/*.{ts,tsx}',
7
+ './components/**/*.{ts,tsx}',
8
+ './app/**/*.{ts,tsx}',
9
+ './src/**/*.{ts,tsx}',
10
+ ],
11
+ theme: {
12
+ extend: {
13
+ colors: {
14
+ border: 'hsl(var(--border))',
15
+ input: 'hsl(var(--input))',
16
+ ring: 'hsl(var(--ring))',
17
+ background: 'hsl(var(--background))',
18
+ foreground: 'hsl(var(--foreground))',
19
+ primary: {
20
+ DEFAULT: 'hsl(var(--primary))',
21
+ foreground: 'hsl(var(--primary-foreground))',
22
+ },
23
+ secondary: {
24
+ DEFAULT: 'hsl(var(--secondary))',
25
+ foreground: 'hsl(var(--secondary-foreground))',
26
+ },
27
+ destructive: {
28
+ DEFAULT: 'hsl(var(--destructive))',
29
+ foreground: 'hsl(var(--destructive-foreground))',
30
+ },
31
+ muted: {
32
+ DEFAULT: 'hsl(var(--muted))',
33
+ foreground: 'hsl(var(--muted-foreground))',
34
+ },
35
+ accent: {
36
+ DEFAULT: 'hsl(var(--accent))',
37
+ foreground: 'hsl(var(--accent-foreground))',
38
+ },
39
+ popover: {
40
+ DEFAULT: 'hsl(var(--popover))',
41
+ foreground: 'hsl(var(--popover-foreground))',
42
+ },
43
+ card: {
44
+ DEFAULT: 'hsl(var(--card))',
45
+ foreground: 'hsl(var(--card-foreground))',
46
+ },
47
+ },
48
+ borderRadius: {
49
+ lg: 'var(--radius)',
50
+ md: 'calc(var(--radius) - 2px)',
51
+ sm: 'calc(var(--radius) - 4px)',
52
+ },
53
+ },
54
+ },
55
+ plugins: [],
56
+ };
57
+
58
+ export default config;
@@ -0,0 +1,19 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "jsx": "preserve",
6
+ "incremental": true,
7
+ "paths": {
8
+ "@/*": ["./*"],
9
+ "__PACKAGE_SCOPE__/shared": ["../shared/src"]
10
+ },
11
+ "plugins": [
12
+ {
13
+ "name": "next"
14
+ }
15
+ ]
16
+ },
17
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
18
+ "exclude": ["node_modules"]
19
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "__PACKAGE_SCOPE__/shared",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "main": "./src/index.ts",
7
+ "types": "./src/index.ts",
8
+ "scripts": {
9
+ "typecheck": "tsc --noEmit",
10
+ "lint": "eslint src --ext .ts",
11
+ "format": "prettier --write \"src/**/*.ts\""
12
+ },
13
+ "dependencies": {
14
+ "zod": "^3.24.1"
15
+ },
16
+ "devDependencies": {
17
+ "typescript": "^5.7.2"
18
+ }
19
+ }
@@ -0,0 +1,5 @@
1
+ // Types
2
+ export * from './types.js';
3
+
4
+ // Schemas
5
+ export * from './schemas/user.schema.js';
@@ -0,0 +1,34 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * User schema
5
+ */
6
+ export const UserSchema = z.object({
7
+ id: z.string(),
8
+ email: z.string().email(),
9
+ name: z.string().nullable(),
10
+ createdAt: z.coerce.date(),
11
+ updatedAt: z.coerce.date(),
12
+ });
13
+
14
+ export type User = z.infer<typeof UserSchema>;
15
+
16
+ /**
17
+ * Create user schema
18
+ */
19
+ export const CreateUserSchema = z.object({
20
+ email: z.string().email(),
21
+ name: z.string().min(1).optional(),
22
+ });
23
+
24
+ export type CreateUser = z.infer<typeof CreateUserSchema>;
25
+
26
+ /**
27
+ * Update user schema
28
+ */
29
+ export const UpdateUserSchema = z.object({
30
+ email: z.string().email().optional(),
31
+ name: z.string().min(1).nullable().optional(),
32
+ });
33
+
34
+ export type UpdateUser = z.infer<typeof UpdateUserSchema>;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Result type for operations that can fail
3
+ */
4
+ export type Result<T, E = Error> =
5
+ | { success: true; data: T }
6
+ | { success: false; error: E };
7
+
8
+ /**
9
+ * Base entity with common fields
10
+ */
11
+ export interface BaseEntity {
12
+ id: string;
13
+ createdAt: Date;
14
+ updatedAt: Date;
15
+ }
16
+
17
+ /**
18
+ * Pagination parameters
19
+ */
20
+ export interface PaginationParams {
21
+ page: number;
22
+ limit: number;
23
+ }
24
+
25
+ /**
26
+ * Paginated response
27
+ */
28
+ export interface PaginatedResponse<T> {
29
+ data: T[];
30
+ pagination: {
31
+ page: number;
32
+ limit: number;
33
+ total: number;
34
+ totalPages: number;
35
+ };
36
+ }
37
+
38
+ /**
39
+ * API response wrapper
40
+ */
41
+ export interface ApiResponse<T = unknown> {
42
+ success: boolean;
43
+ data?: T;
44
+ error?: string;
45
+ message?: string;
46
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "rootDir": "./src",
5
+ "types": []
6
+ },
7
+ "include": ["src/**/*"],
8
+ "exclude": ["node_modules"]
9
+ }