create-fluxstack 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 (101) hide show
  1. package/.env +30 -0
  2. package/LICENSE +21 -0
  3. package/README.md +214 -0
  4. package/app/client/README.md +69 -0
  5. package/app/client/frontend-only.ts +12 -0
  6. package/app/client/index.html +13 -0
  7. package/app/client/public/vite.svg +1 -0
  8. package/app/client/src/App.css +883 -0
  9. package/app/client/src/App.tsx +669 -0
  10. package/app/client/src/assets/react.svg +1 -0
  11. package/app/client/src/components/TestPage.tsx +453 -0
  12. package/app/client/src/index.css +51 -0
  13. package/app/client/src/lib/eden-api.ts +110 -0
  14. package/app/client/src/main.tsx +10 -0
  15. package/app/client/src/vite-env.d.ts +1 -0
  16. package/app/client/tsconfig.app.json +43 -0
  17. package/app/client/tsconfig.json +7 -0
  18. package/app/client/tsconfig.node.json +25 -0
  19. package/app/server/app.ts +10 -0
  20. package/app/server/backend-only.ts +15 -0
  21. package/app/server/controllers/users.controller.ts +69 -0
  22. package/app/server/index.ts +104 -0
  23. package/app/server/routes/index.ts +25 -0
  24. package/app/server/routes/users.routes.ts +121 -0
  25. package/app/server/types/index.ts +1 -0
  26. package/app/shared/types/index.ts +18 -0
  27. package/bun.lock +1053 -0
  28. package/core/__tests__/integration.test.ts +227 -0
  29. package/core/build/index.ts +186 -0
  30. package/core/cli/command-registry.ts +334 -0
  31. package/core/cli/index.ts +394 -0
  32. package/core/cli/plugin-discovery.ts +200 -0
  33. package/core/client/standalone.ts +57 -0
  34. package/core/config/__tests__/config-loader.test.ts +591 -0
  35. package/core/config/__tests__/config-merger.test.ts +657 -0
  36. package/core/config/__tests__/env-converter.test.ts +372 -0
  37. package/core/config/__tests__/env-processor.test.ts +431 -0
  38. package/core/config/__tests__/env.test.ts +452 -0
  39. package/core/config/__tests__/integration.test.ts +418 -0
  40. package/core/config/__tests__/loader.test.ts +331 -0
  41. package/core/config/__tests__/schema.test.ts +129 -0
  42. package/core/config/__tests__/validator.test.ts +318 -0
  43. package/core/config/env-dynamic.ts +326 -0
  44. package/core/config/env.ts +597 -0
  45. package/core/config/index.ts +317 -0
  46. package/core/config/loader.ts +546 -0
  47. package/core/config/runtime-config.ts +322 -0
  48. package/core/config/schema.ts +694 -0
  49. package/core/config/validator.ts +540 -0
  50. package/core/framework/__tests__/server.test.ts +233 -0
  51. package/core/framework/client.ts +132 -0
  52. package/core/framework/index.ts +8 -0
  53. package/core/framework/server.ts +501 -0
  54. package/core/framework/types.ts +63 -0
  55. package/core/plugins/__tests__/built-in.test.ts.disabled +366 -0
  56. package/core/plugins/__tests__/manager.test.ts +398 -0
  57. package/core/plugins/__tests__/monitoring.test.ts +401 -0
  58. package/core/plugins/__tests__/registry.test.ts +335 -0
  59. package/core/plugins/built-in/index.ts +142 -0
  60. package/core/plugins/built-in/logger/index.ts +180 -0
  61. package/core/plugins/built-in/monitoring/README.md +193 -0
  62. package/core/plugins/built-in/monitoring/index.ts +912 -0
  63. package/core/plugins/built-in/static/index.ts +289 -0
  64. package/core/plugins/built-in/swagger/index.ts +229 -0
  65. package/core/plugins/built-in/vite/index.ts +316 -0
  66. package/core/plugins/config.ts +348 -0
  67. package/core/plugins/discovery.ts +350 -0
  68. package/core/plugins/executor.ts +351 -0
  69. package/core/plugins/index.ts +195 -0
  70. package/core/plugins/manager.ts +583 -0
  71. package/core/plugins/registry.ts +424 -0
  72. package/core/plugins/types.ts +254 -0
  73. package/core/server/framework.ts +123 -0
  74. package/core/server/index.ts +8 -0
  75. package/core/server/plugins/database.ts +182 -0
  76. package/core/server/plugins/logger.ts +47 -0
  77. package/core/server/plugins/swagger.ts +34 -0
  78. package/core/server/standalone.ts +91 -0
  79. package/core/templates/create-project.ts +455 -0
  80. package/core/types/api.ts +169 -0
  81. package/core/types/build.ts +174 -0
  82. package/core/types/config.ts +68 -0
  83. package/core/types/index.ts +127 -0
  84. package/core/types/plugin.ts +94 -0
  85. package/core/utils/__tests__/errors.test.ts +139 -0
  86. package/core/utils/__tests__/helpers.test.ts +297 -0
  87. package/core/utils/__tests__/logger.test.ts +141 -0
  88. package/core/utils/env-runtime-v2.ts +232 -0
  89. package/core/utils/env-runtime.ts +252 -0
  90. package/core/utils/errors/codes.ts +115 -0
  91. package/core/utils/errors/handlers.ts +63 -0
  92. package/core/utils/errors/index.ts +81 -0
  93. package/core/utils/helpers.ts +180 -0
  94. package/core/utils/index.ts +18 -0
  95. package/core/utils/logger/index.ts +161 -0
  96. package/core/utils/logger.ts +106 -0
  97. package/core/utils/monitoring/index.ts +212 -0
  98. package/create-fluxstack.ts +231 -0
  99. package/package.json +43 -0
  100. package/tsconfig.json +51 -0
  101. package/vite.config.ts +42 -0
package/.env ADDED
@@ -0,0 +1,30 @@
1
+ # FluxStack Environment Variables
2
+
3
+ # Development Mode
4
+ #NODE_ENV=development
5
+ NODE_ENV=production
6
+ # Server Configuration
7
+ PORT=3000
8
+ HOST=localhost
9
+
10
+ # Frontend Configuration
11
+ FRONTEND_PORT=5173
12
+ VITE_API_URL=http://localhost:3000
13
+ VITE_APP_NAME=FluxStack
14
+ VITE_APP_VERSION=1.4.0
15
+ VITE_NODE_ENV=development
16
+
17
+ # Backend Configuration
18
+ BACKEND_PORT=3001
19
+
20
+ # CORS Configuration
21
+ CORS_ORIGINS=http://localhost:3000,http://localhost:5173
22
+ CORS_METHODS=GET,POST,PUT,DELETE,OPTIONS
23
+ CORS_HEADERS=Content-Type,Authorization
24
+
25
+ # Logging
26
+ LOG_LEVEL=info
27
+
28
+ # Build Configuration
29
+ BUILD_TARGET=bun
30
+ BUILD_OUTDIR=dist
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Marcos Brendon De Paula
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,214 @@
1
+ # ⚡ create-fluxstack
2
+
3
+ > Create FluxStack apps with zero configuration - powered by Bun
4
+
5
+ [![npm version](https://badge.fury.io/js/create-fluxstack.svg)](https://badge.fury.io/js/create-fluxstack)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ ## 🚀 Quick Start
9
+
10
+ ```bash
11
+ # Create a new FluxStack app
12
+ bunx create-fluxstack my-awesome-app
13
+
14
+ # Or with npx
15
+ npx create-fluxstack my-awesome-app
16
+
17
+ # Navigate and start developing
18
+ cd my-awesome-app
19
+ bun run dev
20
+ ```
21
+
22
+ **That's it!** Your full-stack TypeScript app is ready at:
23
+ - **Backend**: http://localhost:3000
24
+ - **Frontend**: http://localhost:5173
25
+ - **API Docs**: http://localhost:3000/swagger
26
+
27
+ ## ✨ What You Get
28
+
29
+ ### 🔥 Modern Tech Stack
30
+ - **⚡ Bun Runtime** - 3x faster than Node.js
31
+ - **🚀 Elysia.js** - Ultra-fast backend framework
32
+ - **⚛️ React 19** - Latest React with modern features
33
+ - **🎨 Tailwind CSS v4** - Latest styling framework
34
+ - **📦 Vite 7** - Lightning-fast dev server
35
+ - **🔒 TypeScript 5** - Full type safety end-to-end
36
+
37
+ ### 🛠️ Zero Configuration
38
+ - **✅ Hot Reload** - Backend + Frontend coordinated
39
+ - **✅ Type Safety** - Eden Treaty for API communication
40
+ - **✅ Auto Documentation** - Swagger UI generated
41
+ - **✅ Git Ready** - Initialized with first commit
42
+ - **✅ Production Ready** - Build scripts included
43
+
44
+ ## 📁 Project Structure
45
+
46
+ ```
47
+ my-awesome-app/
48
+ ├── core/ # FluxStack framework (don't modify)
49
+ ├── app/ # Your application code
50
+ │ ├── server/ # Backend API routes
51
+ │ ├── client/ # Frontend React app
52
+ │ └── shared/ # Shared types and utilities
53
+ ├── package.json # Dependencies and scripts
54
+ └── README.md # Project documentation
55
+ ```
56
+
57
+ ## 🎯 Available Scripts
58
+
59
+ ```bash
60
+ # Development
61
+ bun run dev # Start full-stack development
62
+ bun run dev:frontend # Frontend only
63
+ bun run dev:backend # Backend only
64
+
65
+ # Production
66
+ bun run build # Build for production
67
+ bun run start # Start production server
68
+
69
+ # Utilities
70
+ bun run typecheck # Check TypeScript
71
+ ```
72
+
73
+ ## 🔧 Requirements
74
+
75
+ - **Bun** >= 1.0.0 (recommended)
76
+ - **Node.js** >= 18.0.0 (fallback)
77
+
78
+ ### Install Bun
79
+
80
+ ```bash
81
+ # Install Bun (if not already installed)
82
+ curl -fsSL https://bun.sh/install | bash
83
+ ```
84
+
85
+ ## 🎨 Customization
86
+
87
+ ### Environment Variables
88
+
89
+ The generated app uses these environment variables (in `.env`):
90
+
91
+ ```bash
92
+ NODE_ENV=development
93
+ PORT=3000
94
+ HOST=localhost
95
+ VITE_PORT=5173
96
+ VITE_API_URL=http://localhost:3000
97
+ ```
98
+
99
+ ### Adding Routes
100
+
101
+ Backend routes in `app/server/routes/`:
102
+
103
+ ```typescript
104
+ // app/server/routes/users.ts
105
+ import { Elysia } from 'elysia'
106
+
107
+ export const userRoutes = new Elysia({ prefix: '/users' })
108
+ .get('/', () => ({ users: [] }))
109
+ .post('/', ({ body }) => ({ user: body }))
110
+ ```
111
+
112
+ Frontend API calls with type safety:
113
+
114
+ ```typescript
115
+ // app/client/src/components/Users.tsx
116
+ import { api } from '../lib/api'
117
+
118
+ const users = await api.users.get() // ✅ Fully typed!
119
+ ```
120
+
121
+ ## 🚀 Deployment
122
+
123
+ ### Option 1: Single Server (Recommended)
124
+
125
+ ```bash
126
+ # Build everything
127
+ bun run build
128
+
129
+ # Start production server
130
+ bun run start
131
+ ```
132
+
133
+ ### Option 2: Separate Deploy
134
+
135
+ ```bash
136
+ # Backend
137
+ bun run build:backend
138
+ bun dist/index.js
139
+
140
+ # Frontend
141
+ bun run build:frontend
142
+ # Deploy dist/ folder to CDN
143
+ ```
144
+
145
+ ## 🤝 Examples
146
+
147
+ ### Basic CRUD API
148
+
149
+ ```typescript
150
+ // app/server/routes/posts.ts
151
+ export const postRoutes = new Elysia({ prefix: '/posts' })
152
+ .get('/', () => ({ posts: [] }))
153
+ .post('/', ({ body }) => ({ id: 1, ...body }))
154
+ .get('/:id', ({ params }) => ({ id: params.id }))
155
+ ```
156
+
157
+ ### Frontend Integration
158
+
159
+ ```typescript
160
+ // app/client/src/hooks/usePosts.ts
161
+ import { api } from '../lib/api'
162
+
163
+ export function usePosts() {
164
+ return useQuery({
165
+ queryKey: ['posts'],
166
+ queryFn: () => api.posts.get()
167
+ })
168
+ }
169
+ ```
170
+
171
+ ## 🛟 Troubleshooting
172
+
173
+ ### Port Already in Use
174
+
175
+ ```bash
176
+ # Kill processes on ports
177
+ pkill -f "3000"
178
+ pkill -f "5173"
179
+ ```
180
+
181
+ ### Type Errors
182
+
183
+ ```bash
184
+ # Regenerate types
185
+ bun run typecheck
186
+ ```
187
+
188
+ ### Environment Issues
189
+
190
+ ```bash
191
+ # Force development mode
192
+ NODE_ENV=development bun run dev
193
+ ```
194
+
195
+ ## 📖 Learn More
196
+
197
+ - [FluxStack Documentation](https://fluxstack.dev)
198
+ - [Bun Runtime](https://bun.sh)
199
+ - [Elysia.js](https://elysiajs.com)
200
+ - [React 19](https://react.dev)
201
+
202
+ ## 🐛 Issues & Contributing
203
+
204
+ Found a bug? Have a suggestion?
205
+ - [GitHub Issues](https://github.com/fluxstack/create-fluxstack/issues)
206
+ - [GitHub Discussions](https://github.com/fluxstack/create-fluxstack/discussions)
207
+
208
+ ## 📄 License
209
+
210
+ MIT © FluxStack Team
211
+
212
+ ---
213
+
214
+ **Happy coding with the divine Bun runtime! ⚡🔥**
@@ -0,0 +1,69 @@
1
+ # React + TypeScript + Vite
2
+
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
+
10
+ ## Expanding the ESLint configuration
11
+
12
+ If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
13
+
14
+ ```js
15
+ export default tseslint.config([
16
+ globalIgnores(['dist']),
17
+ {
18
+ files: ['**/*.{ts,tsx}'],
19
+ extends: [
20
+ // Other configs...
21
+
22
+ // Remove tseslint.configs.recommended and replace with this
23
+ ...tseslint.configs.recommendedTypeChecked,
24
+ // Alternatively, use this for stricter rules
25
+ ...tseslint.configs.strictTypeChecked,
26
+ // Optionally, add this for stylistic rules
27
+ ...tseslint.configs.stylisticTypeChecked,
28
+
29
+ // Other configs...
30
+ ],
31
+ languageOptions: {
32
+ parserOptions: {
33
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
34
+ tsconfigRootDir: import.meta.dirname,
35
+ },
36
+ // other options...
37
+ },
38
+ },
39
+ ])
40
+ ```
41
+
42
+ You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
43
+
44
+ ```js
45
+ // eslint.config.js
46
+ import reactX from 'eslint-plugin-react-x'
47
+ import reactDom from 'eslint-plugin-react-dom'
48
+
49
+ export default tseslint.config([
50
+ globalIgnores(['dist']),
51
+ {
52
+ files: ['**/*.{ts,tsx}'],
53
+ extends: [
54
+ // Other configs...
55
+ // Enable lint rules for React
56
+ reactX.configs['recommended-typescript'],
57
+ // Enable lint rules for React DOM
58
+ reactDom.configs.recommended,
59
+ ],
60
+ languageOptions: {
61
+ parserOptions: {
62
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
63
+ tsconfigRootDir: import.meta.dirname,
64
+ },
65
+ // other options...
66
+ },
67
+ },
68
+ ])
69
+ ```
@@ -0,0 +1,12 @@
1
+ // Frontend standalone entry point
2
+ import { startFrontendOnly } from "../../core/client/standalone"
3
+
4
+ // Configuração para frontend standalone
5
+ const frontendConfig = {
6
+ clientPath: "app/client",
7
+ vitePort: (globalThis as any).process?.env?.FRONTEND_PORT || 5173,
8
+ apiUrl: (globalThis as any).process?.env?.API_URL || "http://localhost:3001"
9
+ }
10
+
11
+ // Iniciar apenas o frontend
12
+ startFrontendOnly(frontendConfig)
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Vite + React + TS</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.tsx"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>