create-featurebased-architecture 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.
- package/README.md +89 -0
- package/dist/index.js +828 -0
- package/package.json +42 -0
- package/templates/blank-hono/.env.example +4 -0
- package/templates/blank-hono/README.md +53 -0
- package/templates/blank-hono/package.json +18 -0
- package/templates/blank-hono/src/config/database.ts +4 -0
- package/templates/blank-hono/src/config/env.ts +5 -0
- package/templates/blank-hono/src/config/index.ts +2 -0
- package/templates/blank-hono/src/features/.gitkeep.ts +21 -0
- package/templates/blank-hono/src/index.ts +22 -0
- package/templates/blank-hono/src/routes/index.ts +8 -0
- package/templates/blank-hono/src/shared/index.ts +2 -0
- package/templates/blank-hono/src/shared/types/index.ts +16 -0
- package/templates/blank-hono/src/shared/utils/index.ts +1 -0
- package/templates/blank-hono/src/shared/utils/response.ts +10 -0
- package/templates/blank-hono/tsconfig.json +22 -0
- package/templates/blank-ts/README.md +30 -0
- package/templates/blank-ts/package.json +15 -0
- package/templates/blank-ts/src/features/.gitkeep.ts +16 -0
- package/templates/blank-ts/src/index.ts +7 -0
- package/templates/blank-ts/src/shared/utils/index.ts +3 -0
- package/templates/blank-ts/tsconfig.json +21 -0
- package/templates/react/README.md +34 -0
- package/templates/react/index.html +12 -0
- package/templates/react/package.json +22 -0
- package/templates/react/src/App.tsx +10 -0
- package/templates/react/src/features/home/components/HomePage.tsx +8 -0
- package/templates/react/src/features/home/index.ts +1 -0
- package/templates/react/src/index.css +10 -0
- package/templates/react/src/main.tsx +13 -0
- package/templates/react/src/shared/components/Button.tsx +29 -0
- package/templates/react/src/shared/components/index.ts +1 -0
- package/templates/react/tsconfig.json +27 -0
- package/templates/react/tsconfig.node.json +11 -0
- package/templates/react/vite.config.ts +12 -0
- package/templates/user-management-backend/.env.example +4 -0
- package/templates/user-management-backend/README.md +105 -0
- package/templates/user-management-backend/package.json +19 -0
- package/templates/user-management-backend/src/config/database.ts +4 -0
- package/templates/user-management-backend/src/config/env.ts +5 -0
- package/templates/user-management-backend/src/config/index.ts +2 -0
- package/templates/user-management-backend/src/features/users/controller.ts +100 -0
- package/templates/user-management-backend/src/features/users/index.ts +6 -0
- package/templates/user-management-backend/src/features/users/repository.ts +57 -0
- package/templates/user-management-backend/src/features/users/routes.ts +10 -0
- package/templates/user-management-backend/src/features/users/schema.ts +15 -0
- package/templates/user-management-backend/src/features/users/service.ts +40 -0
- package/templates/user-management-backend/src/features/users/types.ts +17 -0
- package/templates/user-management-backend/src/index.ts +22 -0
- package/templates/user-management-backend/src/routes/index.ts +8 -0
- package/templates/user-management-backend/src/shared/index.ts +2 -0
- package/templates/user-management-backend/src/shared/types/index.ts +16 -0
- package/templates/user-management-backend/src/shared/utils/index.ts +1 -0
- package/templates/user-management-backend/src/shared/utils/response.ts +10 -0
- package/templates/user-management-backend/tsconfig.json +22 -0
- package/templates/user-management-frontend/.env.example +1 -0
- package/templates/user-management-frontend/README.md +53 -0
- package/templates/user-management-frontend/index.html +12 -0
- package/templates/user-management-frontend/package.json +22 -0
- package/templates/user-management-frontend/src/App.tsx +19 -0
- package/templates/user-management-frontend/src/config/env.ts +1 -0
- package/templates/user-management-frontend/src/config/index.ts +1 -0
- package/templates/user-management-frontend/src/features/users/components/UserFormPage.tsx +76 -0
- package/templates/user-management-frontend/src/features/users/components/UsersPage.tsx +61 -0
- package/templates/user-management-frontend/src/features/users/components/index.ts +2 -0
- package/templates/user-management-frontend/src/features/users/hooks/index.ts +1 -0
- package/templates/user-management-frontend/src/features/users/hooks/useUsers.ts +45 -0
- package/templates/user-management-frontend/src/features/users/index.ts +4 -0
- package/templates/user-management-frontend/src/features/users/services/index.ts +1 -0
- package/templates/user-management-frontend/src/features/users/services/userService.ts +48 -0
- package/templates/user-management-frontend/src/features/users/types.ts +24 -0
- package/templates/user-management-frontend/src/index.css +108 -0
- package/templates/user-management-frontend/src/main.tsx +13 -0
- package/templates/user-management-frontend/tsconfig.json +27 -0
- package/templates/user-management-frontend/tsconfig.node.json +11 -0
- 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
|