blacksmith-cli 0.1.9 → 0.1.10

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 (2) hide show
  1. package/README.md +88 -77
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,25 +1,25 @@
1
1
  # Blacksmith CLI
2
2
 
3
- **Fullstack Django + React framework — one command, one codebase, one mental model.**
3
+ **Django + React framework — one command, one codebase, one mental model.**
4
4
 
5
- Blacksmith scaffolds production-ready web applications with a Django REST backend and a React frontend, wired together through automatic OpenAPI synchronization. Define your API in Django, and Blacksmith generates the TypeScript client, types, and hooks for you.
5
+ Blacksmith scaffolds production-ready web applications with Django, React, or both wired together through automatic OpenAPI synchronization. Choose your project type and Blacksmith handles the rest.
6
6
 
7
7
  ## Why Blacksmith?
8
8
 
9
- Building fullstack apps usually means gluing together two separate projects, manually keeping types in sync, and writing boilerplate on both sides of the stack. Blacksmith eliminates that friction:
9
+ Building web apps usually means gluing together separate projects, manually keeping types in sync, and writing boilerplate. Blacksmith eliminates that friction:
10
10
 
11
- - **One command to scaffold** a complete project with authentication, routing, and API layer already wired up
12
- - **Automatic API sync** — change a Django serializer, get updated TypeScript types and API client instantly
13
- - **Full-stack resource scaffolding** — `make:resource BlogPost` creates the model, serializer, viewset, URLs, hooks, components, and pages
14
- - **AI-ready** — generates a `CLAUDE.md` and skill files so AI coding assistants understand your entire stack
15
- - **Clean ejection** — remove Blacksmith at any time and keep a standard Django + React project
11
+ - **Flexible project types** scaffold a fullstack Django + React app, a standalone Django API, or a standalone React frontend
12
+ - **Automatic API sync** — change a Django serializer, get updated TypeScript types and API client instantly (fullstack)
13
+ - **Resource scaffolding** — `make:resource BlogPost` creates everything you need for the resource based on your project type
14
+ - **AI-ready** — generates `CLAUDE.md` and skill files so AI coding assistants understand your entire stack
15
+ - **Clean ejection** — remove Blacksmith at any time and keep a standard project
16
16
 
17
17
  ## Quick Start
18
18
 
19
19
  ### Prerequisites
20
20
 
21
21
  - **Node.js** >= 20.5.0
22
- - **Python 3**
22
+ - **Python 3** (for backend and fullstack projects)
23
23
  - **npm**
24
24
 
25
25
  ### Installation
@@ -34,14 +34,20 @@ npm install -g blacksmith-cli
34
34
  blacksmith init my-app
35
35
  ```
36
36
 
37
- You'll be prompted for configuration (or pass flags to skip prompts):
37
+ You'll be prompted for project type and configuration, or pass flags to skip prompts:
38
38
 
39
39
  ```bash
40
- blacksmith init my-app \
41
- --backend-port 8000 \
42
- --frontend-port 5173 \
43
- --theme-color blue \
44
- --ai
40
+ # Fullstack (Django + React)
41
+ blacksmith init my-app --type fullstack
42
+
43
+ # Backend only (Django API)
44
+ blacksmith init my-app --type backend
45
+
46
+ # Frontend only (React)
47
+ blacksmith init my-app --type frontend
48
+
49
+ # With all options
50
+ blacksmith init my-app --type fullstack -b 8000 -f 5173 --theme-color blue --ai
45
51
  ```
46
52
 
47
53
  ### Start Developing
@@ -51,51 +57,75 @@ cd my-app
51
57
  blacksmith dev
52
58
  ```
53
59
 
54
- This starts three processes in parallel:
55
- 1. **Django** development server
56
- 2. **Vite** dev server with HMR
57
- 3. **OpenAPI watcher** that auto-syncs types when backend files change
60
+ What starts depends on your project type:
61
+ - **Fullstack**: Django + Vite + OpenAPI watcher (auto-syncs types on backend changes)
62
+ - **Backend**: Django development server
63
+ - **Frontend**: Vite dev server with HMR
58
64
 
59
65
  ## Commands
60
66
 
61
67
  | Command | Description |
62
68
  |---|---|
63
69
  | `blacksmith init [name]` | Create a new project (interactive or via flags) |
64
- | `blacksmith dev` | Start Django + Vite + OpenAPI watcher |
65
- | `blacksmith sync` | Regenerate frontend API client from Django schema |
66
- | `blacksmith make:resource <Name>` | Scaffold a CRUD resource across the full stack |
67
- | `blacksmith build` | Production build (Vite + collectstatic) |
70
+ | `blacksmith dev` | Start development server(s) |
71
+ | `blacksmith sync` | Regenerate frontend API client from Django schema (fullstack only) |
72
+ | `blacksmith make:resource <Name>` | Scaffold a resource (scope depends on project type) |
73
+ | `blacksmith build` | Production build |
68
74
  | `blacksmith eject` | Remove Blacksmith, keep a clean project |
69
- | `blacksmith setup:ai` | Generate CLAUDE.md with AI development skills |
75
+ | `blacksmith setup:ai` | Generate/regenerate CLAUDE.md with AI development skills |
70
76
  | `blacksmith skills` | List available AI skills |
71
77
  | `blacksmith backend <cmd>` | Run a Django management command |
72
78
  | `blacksmith frontend <cmd>` | Run an npm command in the frontend |
73
79
 
74
- ## Generated Project Structure
80
+ ## Project Structures
81
+
82
+ ### Fullstack (`--type fullstack`)
75
83
 
76
84
  ```
77
85
  my-app/
78
86
  ├── backend/ # Django project
79
87
  │ ├── config/ # Settings, URLs, WSGI/ASGI
80
- │ │ └── settings/ # Split settings (base, development, production)
81
88
  │ ├── apps/ # Django apps (one per resource)
82
89
  │ │ └── users/ # Built-in user app with JWT auth
83
90
  │ ├── manage.py
84
- │ ├── requirements.txt
85
91
  │ └── venv/ # Python virtual environment
86
92
  ├── frontend/ # React + Vite project
87
93
  │ ├── src/
88
- │ │ ├── api/ # Auto-generated API client (via OpenAPI)
94
+ │ │ ├── api/ # Auto-generated API client + hooks
89
95
  │ │ ├── features/ # Feature modules (auth, etc.)
90
96
  │ │ ├── pages/ # Top-level page components
91
97
  │ │ ├── router/ # React Router with auth guards
92
- │ │ ├── shared/ # Shared components and hooks
93
- │ │ └── styles/ # Global styles (Tailwind CSS)
98
+ │ │ └── shared/ # Shared components, hooks, utils
94
99
  │ └── package.json
95
- ├── blacksmith.config.json # Project configuration
100
+ ├── blacksmith.config.json
96
101
  └── CLAUDE.md # AI development guide (with --ai)
97
102
  ```
98
103
 
104
+ ### Backend Only (`--type backend`)
105
+
106
+ ```
107
+ my-app/
108
+ ├── config/ # Settings, URLs, WSGI/ASGI
109
+ ├── apps/ # Django apps
110
+ │ └── users/ # Built-in user app with JWT auth
111
+ ├── manage.py
112
+ ├── venv/
113
+ └── blacksmith.config.json
114
+ ```
115
+
116
+ ### Frontend Only (`--type frontend`)
117
+
118
+ ```
119
+ my-app/
120
+ ├── src/
121
+ │ ├── api/ # API hooks
122
+ │ ├── pages/ # Page components
123
+ │ ├── router/ # React Router
124
+ │ └── shared/ # Shared components, hooks, utils
125
+ ├── package.json
126
+ └── blacksmith.config.json
127
+ ```
128
+
99
129
  ## Tech Stack
100
130
 
101
131
  ### Backend
@@ -111,33 +141,30 @@ my-app/
111
141
  - **React Router v7** for client-side routing
112
142
  - **TanStack React Query** for server state management
113
143
  - **React Hook Form** + **Zod** for forms and validation
114
- - **Tailwind CSS** for styling
144
+ - **Chakra UI** for components
115
145
  - **@hey-api/openapi-ts** for API client generation
116
146
 
117
147
  ## Resource Scaffolding
118
148
 
119
- The `make:resource` command generates a complete CRUD feature across both backend and frontend:
149
+ The `make:resource` command generates files based on your project type:
120
150
 
121
151
  ```bash
122
152
  blacksmith make:resource BlogPost
123
153
  ```
124
154
 
125
- **Backend** (in `backend/apps/blog_posts/`):
126
- - `models.py`Django model
127
- - `serializers.py` — DRF serializer
128
- - `views.py` DRF viewset
129
- - `urls.py` — URL configuration
130
- - `admin.py` — Admin registration
131
- - `tests.py` — Test scaffold
155
+ **Backend** (fullstack and backend projects):
156
+ - `apps/blog_posts/`model, serializer, viewset, urls, admin, tests
157
+ - Automatically registered in `INSTALLED_APPS` and `config/urls.py`
158
+ - Migrations run automatically
132
159
 
133
- **Frontend** (in `frontend/src/features/blog-posts/`):
134
- - API hooks for list, detail, create, update, delete
135
- - List and detail page components
136
- - Create and edit form components
160
+ **Frontend** (fullstack and frontend projects):
161
+ - `src/api/hooks/blog-posts/` query and mutation hooks
162
+ - `src/pages/blog-posts/` — list and detail pages
163
+ - Routes auto-registered
137
164
 
138
- After scaffolding, run `blacksmith sync` to generate the TypeScript types.
165
+ **Fullstack**: Also runs `blacksmith sync` to generate TypeScript types from the new endpoint.
139
166
 
140
- ## OpenAPI Sync
167
+ ## OpenAPI Sync (Fullstack Only)
141
168
 
142
169
  Blacksmith bridges Django and React through OpenAPI:
143
170
 
@@ -159,17 +186,25 @@ blacksmith setup:ai
159
186
 
160
187
  This creates:
161
188
  - **CLAUDE.md** — project overview, commands, workflow, and conventions
162
- - **.claude/skills/** — detailed skill files covering Django, DRF, React, React Query, forms, authentication, and more
189
+ - **.claude/skills/** — detailed skill files tailored to your project type (Django skills for backend, React skills for frontend, all for fullstack)
163
190
 
164
- ## Theme Presets
191
+ ## Configuration
165
192
 
166
- Choose a theme color during project creation:
193
+ Project settings live in `blacksmith.config.json`:
167
194
 
168
- ```bash
169
- blacksmith init my-app --theme-color violet
195
+ ```json
196
+ {
197
+ "name": "my-app",
198
+ "version": "0.1.0",
199
+ "type": "fullstack",
200
+ "backend": { "port": 8000 },
201
+ "frontend": { "port": 5173 }
202
+ }
170
203
  ```
171
204
 
172
- Available presets: `default`, `blue`, `green`, `violet`, `red`, `neutral`
205
+ - `type` `"fullstack"`, `"backend"`, or `"frontend"`
206
+ - `backend` — present for fullstack and backend projects
207
+ - `frontend` — present for fullstack and frontend projects
173
208
 
174
209
  ## Ejecting
175
210
 
@@ -179,31 +214,7 @@ If you outgrow Blacksmith or want full control, eject cleanly:
179
214
  blacksmith eject
180
215
  ```
181
216
 
182
- This removes the Blacksmith dependency and configuration, leaving you with a standard Django + React project that runs independently.
183
-
184
- ## Development Workflow
185
-
186
- A typical workflow looks like:
187
-
188
- 1. Create a resource: `blacksmith make:resource Product`
189
- 2. Customize the Django model in `backend/apps/products/models.py`
190
- 3. Update the serializer in `backend/apps/products/serializers.py`
191
- 4. Run `blacksmith sync` to regenerate the frontend API client
192
- 5. Build the UI in `frontend/src/features/products/`
193
- 6. Check the API docs at `http://localhost:8000/api/docs/`
194
-
195
- ## Configuration
196
-
197
- Project settings live in `blacksmith.config.json`:
198
-
199
- ```json
200
- {
201
- "name": "my-app",
202
- "version": "0.1.0",
203
- "backend": { "port": 8000 },
204
- "frontend": { "port": 5173 }
205
- }
206
- ```
217
+ This removes the Blacksmith dependency and configuration, leaving you with a standard project that runs independently.
207
218
 
208
219
  ## License
209
220
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blacksmith-cli",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Fullstack Django + React framework — one command, one codebase, one mental model",
5
5
  "type": "module",
6
6
  "bin": {