create-fluxstack 1.8.3 → 1.9.1
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 +653 -275
- package/core/build/bundler.ts +199 -55
- package/core/build/index.ts +4 -0
- package/core/cli/generators/plugin.ts +6 -6
- package/core/cli/index.ts +100 -0
- package/core/server/live/auto-generated-components.ts +1 -1
- package/core/types/build.ts +21 -0
- package/core/utils/version.ts +6 -6
- package/create-fluxstack.ts +7 -7
- package/package.json +2 -1
- package/tsconfig.json +2 -1
package/README.md
CHANGED
|
@@ -1,275 +1,653 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
- **
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
###
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# ⚡ FluxStack
|
|
4
|
+
|
|
5
|
+
### The Revolutionary Full-Stack TypeScript Framework
|
|
6
|
+
|
|
7
|
+
*Build modern web apps with Bun, Elysia, React, and Eden Treaty*
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/create-fluxstack)
|
|
10
|
+
[](https://opensource.org/licenses/MIT)
|
|
11
|
+
[](https://bun.sh)
|
|
12
|
+
[](https://www.typescriptlang.org/)
|
|
13
|
+
[](https://reactjs.org/)
|
|
14
|
+
|
|
15
|
+
[Quick Start](#-quick-start) • [Features](#-key-features) • [Documentation](#-documentation--support) • [Examples](#-type-safe-api-development)
|
|
16
|
+
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## ✨ Key Features
|
|
22
|
+
|
|
23
|
+
<table>
|
|
24
|
+
<tr>
|
|
25
|
+
<td width="50%">
|
|
26
|
+
|
|
27
|
+
### 🚀 **Blazing Fast**
|
|
28
|
+
- **Bun Runtime** - 3x faster than Node.js
|
|
29
|
+
- **Elysia.js** - High-performance backend
|
|
30
|
+
- **Vite 7** - Lightning-fast HMR
|
|
31
|
+
|
|
32
|
+
</td>
|
|
33
|
+
<td width="50%">
|
|
34
|
+
|
|
35
|
+
### 🔒 **Type-Safe Everything**
|
|
36
|
+
- **Eden Treaty** - Automatic type inference
|
|
37
|
+
- **End-to-End Types** - Backend to frontend
|
|
38
|
+
- **Zero Manual DTOs** - Types flow naturally
|
|
39
|
+
|
|
40
|
+
</td>
|
|
41
|
+
</tr>
|
|
42
|
+
<tr>
|
|
43
|
+
<td width="50%">
|
|
44
|
+
|
|
45
|
+
### 🛠️ **Zero Configuration**
|
|
46
|
+
- **One Command Setup** - `bunx create-fluxstack`
|
|
47
|
+
- **Hot Reload Built-in** - Backend + Frontend
|
|
48
|
+
- **Swagger Auto-Generated** - API docs out of the box
|
|
49
|
+
|
|
50
|
+
</td>
|
|
51
|
+
<td width="50%">
|
|
52
|
+
|
|
53
|
+
### 🎯 **Production Ready**
|
|
54
|
+
- **Docker Multi-Stage** - Optimized containers
|
|
55
|
+
- **Declarative Config** - Environment management
|
|
56
|
+
- **WebSocket Support** - Real-time features
|
|
57
|
+
|
|
58
|
+
</td>
|
|
59
|
+
</tr>
|
|
60
|
+
</table>
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 🚀 Quick Start
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Create a new FluxStack app
|
|
68
|
+
bunx create-fluxstack my-awesome-app
|
|
69
|
+
cd my-awesome-app
|
|
70
|
+
bun run dev
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**That's it!** Your full-stack app is running at:
|
|
74
|
+
|
|
75
|
+
- 🌐 **Frontend & Backend**: http://localhost:3000
|
|
76
|
+
- 📚 **API Documentation**: http://localhost:3000/swagger
|
|
77
|
+
- ⚡ **Hot Reload**: Automatic on file changes
|
|
78
|
+
|
|
79
|
+
### Alternative Installation
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Create in current directory
|
|
83
|
+
mkdir my-app && cd my-app
|
|
84
|
+
bunx create-fluxstack .
|
|
85
|
+
bun run dev
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 💎 What You Get
|
|
91
|
+
|
|
92
|
+
<details open>
|
|
93
|
+
<summary><b>🎨 Modern Tech Stack (2025)</b></summary>
|
|
94
|
+
|
|
95
|
+
| Layer | Technology | Version | Why? |
|
|
96
|
+
|-------|-----------|---------|------|
|
|
97
|
+
| 🏃 **Runtime** | Bun | 1.2+ | 3x faster than Node.js |
|
|
98
|
+
| ⚙️ **Backend** | Elysia.js | 1.4.6 | Ultra-fast API framework |
|
|
99
|
+
| ⚛️ **Frontend** | React | 19.1 | Latest React features |
|
|
100
|
+
| ⚡ **Build Tool** | Vite | 7.1.7 | Instant dev server |
|
|
101
|
+
| 💅 **Styling** | Tailwind CSS | 4.1.13 | Utility-first CSS |
|
|
102
|
+
| 📘 **Language** | TypeScript | 5.8.3 | Full type safety |
|
|
103
|
+
| 🔌 **API Client** | Eden Treaty | 1.3.2 | Type-safe API calls |
|
|
104
|
+
|
|
105
|
+
</details>
|
|
106
|
+
|
|
107
|
+
<details open>
|
|
108
|
+
<summary><b>⚙️ Zero-Config Features</b></summary>
|
|
109
|
+
|
|
110
|
+
- ✅ **Automatic Type Inference** - Eden Treaty connects backend types to frontend
|
|
111
|
+
- ✅ **Coordinated Hot Reload** - Backend and frontend reload independently
|
|
112
|
+
- ✅ **Auto-Generated Swagger** - API documentation updates automatically
|
|
113
|
+
- ✅ **Docker Templates** - Production-ready multi-stage builds included
|
|
114
|
+
- ✅ **AI-Focused Docs** - Special documentation for AI assistants (`ai-context/`)
|
|
115
|
+
- ✅ **Declarative Config** - Laravel-inspired configuration system
|
|
116
|
+
- ✅ **WebSocket Support** - Real-time features built-in
|
|
117
|
+
- ✅ **Testing Setup** - Vitest + React Testing Library ready
|
|
118
|
+
|
|
119
|
+
</details>
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 🏗️ Architecture Overview
|
|
124
|
+
|
|
125
|
+
<div align="center">
|
|
126
|
+
|
|
127
|
+
```mermaid
|
|
128
|
+
graph TB
|
|
129
|
+
subgraph "🎨 Frontend Layer"
|
|
130
|
+
React[React 19 + Vite]
|
|
131
|
+
Components[Components]
|
|
132
|
+
Hooks[Custom Hooks]
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
subgraph "🔌 Communication Layer"
|
|
136
|
+
Eden[Eden Treaty]
|
|
137
|
+
WS[WebSockets]
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
subgraph "⚙️ Backend Layer"
|
|
141
|
+
Elysia[Elysia.js]
|
|
142
|
+
Routes[API Routes]
|
|
143
|
+
Controllers[Controllers]
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
subgraph "🗄️ Data Layer"
|
|
147
|
+
DB[(Your Database)]
|
|
148
|
+
Cache[(Cache)]
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
React --> Eden
|
|
152
|
+
Eden --> Elysia
|
|
153
|
+
Elysia --> Routes
|
|
154
|
+
Routes --> Controllers
|
|
155
|
+
Controllers --> DB
|
|
156
|
+
React --> WS
|
|
157
|
+
WS --> Elysia
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
### 📁 Project Structure
|
|
163
|
+
|
|
164
|
+
<details>
|
|
165
|
+
<summary><b>Click to expand directory structure</b></summary>
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
FluxStack/
|
|
169
|
+
├── 🔒 core/ # Framework Core (Read-Only)
|
|
170
|
+
│ ├── framework/ # FluxStack orchestrator
|
|
171
|
+
│ ├── plugins/ # Built-in plugins (Swagger, Vite, etc.)
|
|
172
|
+
│ ├── build/ # Build system & Docker scaffolding
|
|
173
|
+
│ ├── cli/ # CLI commands & generators
|
|
174
|
+
│ ├── config/ # Config schema helpers
|
|
175
|
+
│ └── utils/ # Logging, environment, etc.
|
|
176
|
+
│
|
|
177
|
+
├── 👨💻 app/ # Your Application Code
|
|
178
|
+
│ ├── server/ # Backend (Elysia + Bun)
|
|
179
|
+
│ │ ├── controllers/ # Business logic
|
|
180
|
+
│ │ ├── routes/ # API endpoints + schemas
|
|
181
|
+
│ │ ├── types/ # Shared types & App export
|
|
182
|
+
│ │ └── live/ # WebSocket components
|
|
183
|
+
│ │
|
|
184
|
+
│ ├── client/ # Frontend (React + Vite)
|
|
185
|
+
│ │ ├── src/
|
|
186
|
+
│ │ │ ├── components/ # React components
|
|
187
|
+
│ │ │ ├── hooks/ # Custom React hooks
|
|
188
|
+
│ │ │ ├── lib/ # Eden Treaty client
|
|
189
|
+
│ │ │ └── App.tsx # Main app
|
|
190
|
+
│ │ └── public/ # Static assets
|
|
191
|
+
│ │
|
|
192
|
+
│ └── shared/ # Shared types & utilities
|
|
193
|
+
│
|
|
194
|
+
├── ⚙️ config/ # Application Configuration
|
|
195
|
+
│ ├── app.config.ts # App settings
|
|
196
|
+
│ ├── server.config.ts # Server & CORS
|
|
197
|
+
│ ├── logger.config.ts # Logging
|
|
198
|
+
│ └── database.config.ts # Database
|
|
199
|
+
│
|
|
200
|
+
├── 🔌 plugins/ # External Plugins
|
|
201
|
+
│ └── crypto-auth/ # Example: Crypto authentication
|
|
202
|
+
│
|
|
203
|
+
├── 🤖 ai-context/ # AI Assistant Documentation
|
|
204
|
+
│ ├── 00-QUICK-START.md # Quick start for LLMs
|
|
205
|
+
│ ├── development/ # Development patterns
|
|
206
|
+
│ └── examples/ # Code examples
|
|
207
|
+
│
|
|
208
|
+
└── 📦 Package Files
|
|
209
|
+
├── package.json # Dependencies
|
|
210
|
+
├── tsconfig.json # TypeScript config
|
|
211
|
+
└── README.md # This file
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
</details>
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## 📜 Available Scripts
|
|
219
|
+
|
|
220
|
+
<table>
|
|
221
|
+
<tr>
|
|
222
|
+
<td width="50%">
|
|
223
|
+
|
|
224
|
+
### 🔨 Development
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# Full-stack development
|
|
228
|
+
bun run dev
|
|
229
|
+
|
|
230
|
+
# Frontend only (port 5173)
|
|
231
|
+
bun run dev:frontend
|
|
232
|
+
|
|
233
|
+
# Backend only (port 3001)
|
|
234
|
+
bun run dev:backend
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
</td>
|
|
238
|
+
<td width="50%">
|
|
239
|
+
|
|
240
|
+
### 🚀 Production
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# Build for production
|
|
244
|
+
bun run build
|
|
245
|
+
|
|
246
|
+
# Start production server
|
|
247
|
+
bun run start
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
</td>
|
|
251
|
+
</tr>
|
|
252
|
+
<tr>
|
|
253
|
+
<td width="50%">
|
|
254
|
+
|
|
255
|
+
### 🧪 Testing & Quality
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
# Run tests
|
|
259
|
+
bun run test
|
|
260
|
+
|
|
261
|
+
# Test with UI
|
|
262
|
+
bun run test:ui
|
|
263
|
+
|
|
264
|
+
# Type checking
|
|
265
|
+
bunx tsc --noEmit
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
</td>
|
|
269
|
+
<td width="50%">
|
|
270
|
+
|
|
271
|
+
### 🛠️ Utilities
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
# Sync version across files
|
|
275
|
+
bun run sync-version
|
|
276
|
+
|
|
277
|
+
# Run CLI commands
|
|
278
|
+
bun run cli
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
</td>
|
|
282
|
+
</tr>
|
|
283
|
+
</table>
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## 🔒 Type-Safe API Development
|
|
288
|
+
|
|
289
|
+
**FluxStack uses Eden Treaty to eliminate manual DTOs and provide automatic type inference from backend to frontend.**
|
|
290
|
+
|
|
291
|
+
### 📝 Define Backend Route
|
|
292
|
+
|
|
293
|
+
```typescript
|
|
294
|
+
// app/server/routes/users.ts
|
|
295
|
+
import { Elysia, t } from 'elysia'
|
|
296
|
+
|
|
297
|
+
export const userRoutes = new Elysia({ prefix: '/users' })
|
|
298
|
+
.get('/', () => ({
|
|
299
|
+
users: listUsers()
|
|
300
|
+
}))
|
|
301
|
+
.post('/', ({ body }) => createUser(body), {
|
|
302
|
+
body: t.Object({
|
|
303
|
+
name: t.String(),
|
|
304
|
+
email: t.String({ format: 'email' })
|
|
305
|
+
}),
|
|
306
|
+
response: t.Object({
|
|
307
|
+
success: t.Boolean(),
|
|
308
|
+
user: t.Optional(t.Object({
|
|
309
|
+
id: t.Number(),
|
|
310
|
+
name: t.String(),
|
|
311
|
+
email: t.String(),
|
|
312
|
+
createdAt: t.Date()
|
|
313
|
+
})),
|
|
314
|
+
message: t.Optional(t.String())
|
|
315
|
+
})
|
|
316
|
+
})
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### ✨ Use in Frontend (Fully Typed!)
|
|
320
|
+
|
|
321
|
+
```typescript
|
|
322
|
+
// app/client/src/App.tsx
|
|
323
|
+
import { api } from '@/app/client/src/lib/eden-api'
|
|
324
|
+
|
|
325
|
+
// ✅ TypeScript knows all types automatically!
|
|
326
|
+
const { data: response, error } = await api.users.post({
|
|
327
|
+
name: 'Ada Lovelace', // ✅ Type: string
|
|
328
|
+
email: 'ada@example.com' // ✅ Type: string (email format)
|
|
329
|
+
})
|
|
330
|
+
|
|
331
|
+
// ✅ response is typed as the exact response schema
|
|
332
|
+
if (!error && response?.user) {
|
|
333
|
+
console.log(response.user.name) // ✅ Type: string
|
|
334
|
+
console.log(response.user.id) // ✅ Type: number
|
|
335
|
+
console.log(response.user.createdAt) // ✅ Type: Date
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### 🎯 Benefits
|
|
340
|
+
|
|
341
|
+
- ✅ **Zero Manual Types** - Types flow automatically from backend to frontend
|
|
342
|
+
- ✅ **Autocomplete** - Full IntelliSense in your IDE
|
|
343
|
+
- ✅ **Type Safety** - Catch errors at compile time, not runtime
|
|
344
|
+
- ✅ **Refactor Friendly** - Change backend schema, frontend updates automatically
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## 🎨 Customization Examples
|
|
349
|
+
|
|
350
|
+
<details>
|
|
351
|
+
<summary><b>➕ Add a New API Route</b></summary>
|
|
352
|
+
|
|
353
|
+
```typescript
|
|
354
|
+
// app/server/routes/posts.ts
|
|
355
|
+
import { Elysia, t } from 'elysia'
|
|
356
|
+
|
|
357
|
+
export const postRoutes = new Elysia({ prefix: '/posts' })
|
|
358
|
+
.get('/', () => ({
|
|
359
|
+
posts: getAllPosts()
|
|
360
|
+
}))
|
|
361
|
+
.post('/', ({ body }) => ({
|
|
362
|
+
post: createPost(body)
|
|
363
|
+
}), {
|
|
364
|
+
body: t.Object({
|
|
365
|
+
title: t.String({ minLength: 3 }),
|
|
366
|
+
content: t.String({ minLength: 10 })
|
|
367
|
+
})
|
|
368
|
+
})
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
**Then register it:**
|
|
372
|
+
```typescript
|
|
373
|
+
// app/server/index.ts
|
|
374
|
+
import { postRoutes } from './routes/posts'
|
|
375
|
+
|
|
376
|
+
app.use(postRoutes)
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
</details>
|
|
380
|
+
|
|
381
|
+
<details>
|
|
382
|
+
<summary><b>🔌 Create a Custom Plugin</b></summary>
|
|
383
|
+
|
|
384
|
+
```typescript
|
|
385
|
+
// app/server/plugins/audit.ts
|
|
386
|
+
import { Elysia } from 'elysia'
|
|
387
|
+
|
|
388
|
+
export const auditPlugin = new Elysia({ name: 'audit' })
|
|
389
|
+
.derive(({ request }) => ({
|
|
390
|
+
timestamp: Date.now(),
|
|
391
|
+
ip: request.headers.get('x-forwarded-for')
|
|
392
|
+
}))
|
|
393
|
+
.onRequest(({ request, timestamp }) => {
|
|
394
|
+
console.log(`[${new Date(timestamp).toISOString()}] ${request.method} ${request.url}`)
|
|
395
|
+
})
|
|
396
|
+
.onResponse(({ request, timestamp }) => {
|
|
397
|
+
const duration = Date.now() - timestamp
|
|
398
|
+
console.log(`[AUDIT] ${request.method} ${request.url} - ${duration}ms`)
|
|
399
|
+
})
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
**Use it:**
|
|
403
|
+
```typescript
|
|
404
|
+
import { auditPlugin } from './plugins/audit'
|
|
405
|
+
|
|
406
|
+
app.use(auditPlugin)
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
</details>
|
|
410
|
+
|
|
411
|
+
<details>
|
|
412
|
+
<summary><b>⚙️ Add Environment Configuration</b></summary>
|
|
413
|
+
|
|
414
|
+
```typescript
|
|
415
|
+
// config/features.config.ts
|
|
416
|
+
import { defineConfig, config } from '@/core/utils/config-schema'
|
|
417
|
+
|
|
418
|
+
const featuresConfigSchema = {
|
|
419
|
+
enableAnalytics: config.boolean('ENABLE_ANALYTICS', false),
|
|
420
|
+
maxUploadSize: config.number('MAX_UPLOAD_SIZE', 5242880), // 5MB
|
|
421
|
+
allowedOrigins: config.array('ALLOWED_ORIGINS', ['http://localhost:3000'])
|
|
422
|
+
} as const
|
|
423
|
+
|
|
424
|
+
export const featuresConfig = defineConfig(featuresConfigSchema)
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
**Use it with full type safety:**
|
|
428
|
+
```typescript
|
|
429
|
+
import { featuresConfig } from '@/config/features.config'
|
|
430
|
+
|
|
431
|
+
if (featuresConfig.enableAnalytics) {
|
|
432
|
+
// Type: boolean (not string!)
|
|
433
|
+
trackEvent('user_action')
|
|
434
|
+
}
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
</details>
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
## 📚 Documentation & Support
|
|
442
|
+
|
|
443
|
+
<table>
|
|
444
|
+
<tr>
|
|
445
|
+
<td width="33%">
|
|
446
|
+
|
|
447
|
+
### 📖 **Documentation**
|
|
448
|
+
- [AI Context Docs](./ai-context/)
|
|
449
|
+
- [Quick Start Guide](./ai-context/00-QUICK-START.md)
|
|
450
|
+
- [Development Patterns](./ai-context/development/patterns.md)
|
|
451
|
+
- [CLAUDE.md](./CLAUDE.md)
|
|
452
|
+
|
|
453
|
+
</td>
|
|
454
|
+
<td width="33%">
|
|
455
|
+
|
|
456
|
+
### 💬 **Community**
|
|
457
|
+
- [GitHub Issues](https://github.com/MarcosBrendonDePaula/FluxStack/issues)
|
|
458
|
+
- [Discussions](https://github.com/MarcosBrendonDePaula/FluxStack/discussions)
|
|
459
|
+
- [Repository](https://github.com/MarcosBrendonDePaula/FluxStack)
|
|
460
|
+
|
|
461
|
+
</td>
|
|
462
|
+
<td width="33%">
|
|
463
|
+
|
|
464
|
+
### 🔄 **Upgrading**
|
|
465
|
+
```bash
|
|
466
|
+
bunx create-fluxstack@latest
|
|
467
|
+
|
|
468
|
+
# Check version
|
|
469
|
+
npm list -g create-fluxstack
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
</td>
|
|
473
|
+
</tr>
|
|
474
|
+
</table>
|
|
475
|
+
|
|
476
|
+
---
|
|
477
|
+
|
|
478
|
+
## 🤔 Why FluxStack?
|
|
479
|
+
|
|
480
|
+
### 🆚 **Comparison with Other Stacks**
|
|
481
|
+
|
|
482
|
+
<table>
|
|
483
|
+
<tr>
|
|
484
|
+
<th>Feature</th>
|
|
485
|
+
<th>FluxStack</th>
|
|
486
|
+
<th>Next.js</th>
|
|
487
|
+
<th>T3 Stack</th>
|
|
488
|
+
</tr>
|
|
489
|
+
<tr>
|
|
490
|
+
<td><b>Runtime</b></td>
|
|
491
|
+
<td>✅ Bun (3x faster)</td>
|
|
492
|
+
<td>❌ Node.js</td>
|
|
493
|
+
<td>❌ Node.js</td>
|
|
494
|
+
</tr>
|
|
495
|
+
<tr>
|
|
496
|
+
<td><b>Backend Framework</b></td>
|
|
497
|
+
<td>✅ Elysia (ultra-fast)</td>
|
|
498
|
+
<td>⚠️ Next.js API Routes</td>
|
|
499
|
+
<td>✅ tRPC</td>
|
|
500
|
+
</tr>
|
|
501
|
+
<tr>
|
|
502
|
+
<td><b>Type Safety</b></td>
|
|
503
|
+
<td>✅ Eden Treaty (auto-inferred)</td>
|
|
504
|
+
<td>⚠️ Manual types</td>
|
|
505
|
+
<td>✅ tRPC</td>
|
|
506
|
+
</tr>
|
|
507
|
+
<tr>
|
|
508
|
+
<td><b>Configuration</b></td>
|
|
509
|
+
<td>✅ Declarative with validation</td>
|
|
510
|
+
<td>⚠️ Manual setup</td>
|
|
511
|
+
<td>⚠️ Manual setup</td>
|
|
512
|
+
</tr>
|
|
513
|
+
<tr>
|
|
514
|
+
<td><b>API Docs</b></td>
|
|
515
|
+
<td>✅ Auto-generated Swagger</td>
|
|
516
|
+
<td>❌ Manual</td>
|
|
517
|
+
<td>❌ Manual</td>
|
|
518
|
+
</tr>
|
|
519
|
+
<tr>
|
|
520
|
+
<td><b>WebSockets</b></td>
|
|
521
|
+
<td>✅ Built-in</td>
|
|
522
|
+
<td>⚠️ Third-party</td>
|
|
523
|
+
<td>⚠️ Third-party</td>
|
|
524
|
+
</tr>
|
|
525
|
+
<tr>
|
|
526
|
+
<td><b>Docker</b></td>
|
|
527
|
+
<td>✅ Multi-stage ready</td>
|
|
528
|
+
<td>⚠️ Manual setup</td>
|
|
529
|
+
<td>⚠️ Manual setup</td>
|
|
530
|
+
</tr>
|
|
531
|
+
</table>
|
|
532
|
+
|
|
533
|
+
### 💡 **Key Advantages**
|
|
534
|
+
|
|
535
|
+
<table>
|
|
536
|
+
<tr>
|
|
537
|
+
<td width="50%">
|
|
538
|
+
|
|
539
|
+
#### 🚀 **Performance**
|
|
540
|
+
- **3x faster** startup with Bun
|
|
541
|
+
- **Ultra-fast** API routing with Elysia
|
|
542
|
+
- **Instant** HMR with Vite 7
|
|
543
|
+
- **Optimized** production builds
|
|
544
|
+
|
|
545
|
+
#### 🔒 **Type Safety**
|
|
546
|
+
- **Automatic** type inference
|
|
547
|
+
- **Zero manual** DTO definitions
|
|
548
|
+
- **End-to-end** type checking
|
|
549
|
+
- **Refactor-friendly** architecture
|
|
550
|
+
|
|
551
|
+
</td>
|
|
552
|
+
<td width="50%">
|
|
553
|
+
|
|
554
|
+
#### 🛠️ **Developer Experience**
|
|
555
|
+
- **Zero configuration** needed
|
|
556
|
+
- **One command** to start
|
|
557
|
+
- **Auto-generated** documentation
|
|
558
|
+
- **AI-optimized** documentation
|
|
559
|
+
|
|
560
|
+
#### 🎯 **Production Ready**
|
|
561
|
+
- **Docker** templates included
|
|
562
|
+
- **Declarative** configuration
|
|
563
|
+
- **Unified** error handling
|
|
564
|
+
- **Built-in** monitoring support
|
|
565
|
+
|
|
566
|
+
</td>
|
|
567
|
+
</tr>
|
|
568
|
+
</table>
|
|
569
|
+
|
|
570
|
+
---
|
|
571
|
+
|
|
572
|
+
## ⚙️ Requirements
|
|
573
|
+
|
|
574
|
+
<table>
|
|
575
|
+
<tr>
|
|
576
|
+
<td width="50%">
|
|
577
|
+
|
|
578
|
+
### 📦 **System Requirements**
|
|
579
|
+
- **Bun** ≥ 1.2.0 (required)
|
|
580
|
+
- **Git** (for version control)
|
|
581
|
+
- **Modern OS**: Linux, macOS, or Windows
|
|
582
|
+
|
|
583
|
+
</td>
|
|
584
|
+
<td width="50%">
|
|
585
|
+
|
|
586
|
+
### 📥 **Install Bun**
|
|
587
|
+
|
|
588
|
+
**macOS / Linux:**
|
|
589
|
+
```bash
|
|
590
|
+
curl -fsSL https://bun.sh/install | bash
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
**Windows:**
|
|
594
|
+
```powershell
|
|
595
|
+
powershell -c "irm bun.sh/install.ps1 | iex"
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
</td>
|
|
599
|
+
</tr>
|
|
600
|
+
</table>
|
|
601
|
+
|
|
602
|
+
> ⚠️ **Important**: FluxStack is designed exclusively for the Bun runtime. Node.js is not supported.
|
|
603
|
+
|
|
604
|
+
---
|
|
605
|
+
|
|
606
|
+
## 🚀 Ready to Build?
|
|
607
|
+
|
|
608
|
+
<div align="center">
|
|
609
|
+
|
|
610
|
+
### Start your next project in seconds
|
|
611
|
+
|
|
612
|
+
```bash
|
|
613
|
+
bunx create-fluxstack my-awesome-app
|
|
614
|
+
cd my-awesome-app
|
|
615
|
+
bun run dev
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
### Welcome to the future of full-stack development 🎉
|
|
619
|
+
|
|
620
|
+
[](https://github.com/MarcosBrendonDePaula/FluxStack)
|
|
621
|
+
[](https://www.npmjs.com/package/create-fluxstack)
|
|
622
|
+
|
|
623
|
+
</div>
|
|
624
|
+
|
|
625
|
+
---
|
|
626
|
+
|
|
627
|
+
## 📄 License
|
|
628
|
+
|
|
629
|
+
This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.
|
|
630
|
+
|
|
631
|
+
---
|
|
632
|
+
|
|
633
|
+
## 🙏 Acknowledgments
|
|
634
|
+
|
|
635
|
+
Built with amazing open-source technologies:
|
|
636
|
+
- [Bun](https://bun.sh) - Fast all-in-one JavaScript runtime
|
|
637
|
+
- [Elysia.js](https://elysiajs.com) - Ergonomic framework for humans
|
|
638
|
+
- [React](https://react.dev) - Library for web and native interfaces
|
|
639
|
+
- [Vite](https://vite.dev) - Next generation frontend tooling
|
|
640
|
+
- [Tailwind CSS](https://tailwindcss.com) - Utility-first CSS framework
|
|
641
|
+
- [TypeScript](https://www.typescriptlang.org) - JavaScript with syntax for types
|
|
642
|
+
|
|
643
|
+
---
|
|
644
|
+
|
|
645
|
+
<div align="center">
|
|
646
|
+
|
|
647
|
+
**Made with ❤️ by the FluxStack Team**
|
|
648
|
+
|
|
649
|
+
*Star ⭐ this repo if you find it helpful!*
|
|
650
|
+
|
|
651
|
+
[Report Bug](https://github.com/MarcosBrendonDePaula/FluxStack/issues) · [Request Feature](https://github.com/MarcosBrendonDePaula/FluxStack/issues) · [Contribute](https://github.com/MarcosBrendonDePaula/FluxStack/pulls)
|
|
652
|
+
|
|
653
|
+
</div>
|