create-featurebased-architecture-backend 1.0.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.
Files changed (77) hide show
  1. package/README.md +89 -0
  2. package/dist/index.js +828 -0
  3. package/package.json +42 -0
  4. package/templates/blank-hono/.env.example +4 -0
  5. package/templates/blank-hono/README.md +53 -0
  6. package/templates/blank-hono/package.json +18 -0
  7. package/templates/blank-hono/src/config/database.ts +4 -0
  8. package/templates/blank-hono/src/config/env.ts +5 -0
  9. package/templates/blank-hono/src/config/index.ts +2 -0
  10. package/templates/blank-hono/src/features/.gitkeep.ts +21 -0
  11. package/templates/blank-hono/src/index.ts +22 -0
  12. package/templates/blank-hono/src/routes/index.ts +8 -0
  13. package/templates/blank-hono/src/shared/index.ts +2 -0
  14. package/templates/blank-hono/src/shared/types/index.ts +16 -0
  15. package/templates/blank-hono/src/shared/utils/index.ts +1 -0
  16. package/templates/blank-hono/src/shared/utils/response.ts +10 -0
  17. package/templates/blank-hono/tsconfig.json +22 -0
  18. package/templates/blank-ts/README.md +30 -0
  19. package/templates/blank-ts/package.json +15 -0
  20. package/templates/blank-ts/src/features/.gitkeep.ts +16 -0
  21. package/templates/blank-ts/src/index.ts +7 -0
  22. package/templates/blank-ts/src/shared/utils/index.ts +3 -0
  23. package/templates/blank-ts/tsconfig.json +21 -0
  24. package/templates/react/README.md +34 -0
  25. package/templates/react/index.html +12 -0
  26. package/templates/react/package.json +22 -0
  27. package/templates/react/src/App.tsx +10 -0
  28. package/templates/react/src/features/home/components/HomePage.tsx +8 -0
  29. package/templates/react/src/features/home/index.ts +1 -0
  30. package/templates/react/src/index.css +10 -0
  31. package/templates/react/src/main.tsx +13 -0
  32. package/templates/react/src/shared/components/Button.tsx +29 -0
  33. package/templates/react/src/shared/components/index.ts +1 -0
  34. package/templates/react/tsconfig.json +27 -0
  35. package/templates/react/tsconfig.node.json +11 -0
  36. package/templates/react/vite.config.ts +12 -0
  37. package/templates/user-management-backend/.env.example +4 -0
  38. package/templates/user-management-backend/README.md +105 -0
  39. package/templates/user-management-backend/package.json +19 -0
  40. package/templates/user-management-backend/src/config/database.ts +4 -0
  41. package/templates/user-management-backend/src/config/env.ts +5 -0
  42. package/templates/user-management-backend/src/config/index.ts +2 -0
  43. package/templates/user-management-backend/src/features/users/controller.ts +100 -0
  44. package/templates/user-management-backend/src/features/users/index.ts +6 -0
  45. package/templates/user-management-backend/src/features/users/repository.ts +57 -0
  46. package/templates/user-management-backend/src/features/users/routes.ts +10 -0
  47. package/templates/user-management-backend/src/features/users/schema.ts +15 -0
  48. package/templates/user-management-backend/src/features/users/service.ts +40 -0
  49. package/templates/user-management-backend/src/features/users/types.ts +17 -0
  50. package/templates/user-management-backend/src/index.ts +22 -0
  51. package/templates/user-management-backend/src/routes/index.ts +8 -0
  52. package/templates/user-management-backend/src/shared/index.ts +2 -0
  53. package/templates/user-management-backend/src/shared/types/index.ts +16 -0
  54. package/templates/user-management-backend/src/shared/utils/index.ts +1 -0
  55. package/templates/user-management-backend/src/shared/utils/response.ts +10 -0
  56. package/templates/user-management-backend/tsconfig.json +22 -0
  57. package/templates/user-management-frontend/.env.example +1 -0
  58. package/templates/user-management-frontend/README.md +53 -0
  59. package/templates/user-management-frontend/index.html +12 -0
  60. package/templates/user-management-frontend/package.json +22 -0
  61. package/templates/user-management-frontend/src/App.tsx +19 -0
  62. package/templates/user-management-frontend/src/config/env.ts +1 -0
  63. package/templates/user-management-frontend/src/config/index.ts +1 -0
  64. package/templates/user-management-frontend/src/features/users/components/UserFormPage.tsx +76 -0
  65. package/templates/user-management-frontend/src/features/users/components/UsersPage.tsx +61 -0
  66. package/templates/user-management-frontend/src/features/users/components/index.ts +2 -0
  67. package/templates/user-management-frontend/src/features/users/hooks/index.ts +1 -0
  68. package/templates/user-management-frontend/src/features/users/hooks/useUsers.ts +45 -0
  69. package/templates/user-management-frontend/src/features/users/index.ts +4 -0
  70. package/templates/user-management-frontend/src/features/users/services/index.ts +1 -0
  71. package/templates/user-management-frontend/src/features/users/services/userService.ts +48 -0
  72. package/templates/user-management-frontend/src/features/users/types.ts +24 -0
  73. package/templates/user-management-frontend/src/index.css +108 -0
  74. package/templates/user-management-frontend/src/main.tsx +13 -0
  75. package/templates/user-management-frontend/tsconfig.json +27 -0
  76. package/templates/user-management-frontend/tsconfig.node.json +11 -0
  77. package/templates/user-management-frontend/vite.config.ts +12 -0
package/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # create-featurebased-architecture-backend
2
+
3
+ A CLI tool to scaffold feature-based architecture projects with Bun, Hono, and React.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ npx create-featurebased-architecture-backend
9
+ ```
10
+
11
+ Or with bun:
12
+
13
+ ```bash
14
+ bunx create-featurebased-architecture-backend
15
+ ```
16
+
17
+ ## Templates
18
+
19
+ | Template | Description |
20
+ |----------|-------------|
21
+ | **Blank Hono** (default) | Feature-based Hono backend with NeonDB setup |
22
+ | **Blank TS** | Feature-based TypeScript project |
23
+ | **React** | Feature-based React frontend with Vite |
24
+ | **User Management Backend** | Complete CRUD backend for users with NeonDB |
25
+ | **User Management Frontend** | React frontend for user management |
26
+
27
+ ## Feature-Based Architecture
28
+
29
+ Each feature is self-contained with its own:
30
+ - Routes (API endpoints)
31
+ - Controller (request handling)
32
+ - Service (business logic)
33
+ - Repository (data access)
34
+ - Types (TypeScript interfaces)
35
+ - Schema (validation)
36
+
37
+ ## Database Setup (NeonDB)
38
+
39
+ For templates using NeonDB, run this SQL to create the users table:
40
+
41
+ ```sql
42
+ CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
43
+
44
+ CREATE TABLE users (
45
+ id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
46
+ email VARCHAR(255) UNIQUE NOT NULL,
47
+ name VARCHAR(100) NOT NULL,
48
+ created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
49
+ updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
50
+ );
51
+
52
+ CREATE INDEX idx_users_email ON users(email);
53
+
54
+ CREATE OR REPLACE FUNCTION update_updated_at_column()
55
+ RETURNS TRIGGER AS $$
56
+ BEGIN
57
+ NEW.updated_at = CURRENT_TIMESTAMP;
58
+ RETURN NEW;
59
+ END;
60
+ $$ language 'plpgsql';
61
+
62
+ CREATE TRIGGER update_users_updated_at
63
+ BEFORE UPDATE ON users
64
+ FOR EACH ROW
65
+ EXECUTE FUNCTION update_updated_at_column();
66
+ ```
67
+
68
+ ## Development
69
+
70
+ ```bash
71
+ # Install dependencies
72
+ bun install
73
+
74
+ # Run CLI locally
75
+ bun run dev
76
+
77
+ # Build for publishing
78
+ bun run build
79
+ ```
80
+
81
+ ## Publishing
82
+
83
+ ```bash
84
+ npm publish
85
+ ```
86
+
87
+ ## License
88
+
89
+ MIT