baraqex 1.0.70 → 1.0.72

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 (26) hide show
  1. package/dist/index.js +5 -1
  2. package/dist/index.js.map +3 -3
  3. package/dist/server/index.d.ts.map +1 -1
  4. package/dist/server/index.js +5 -1
  5. package/dist/server/index.js.map +3 -3
  6. package/package.json +1 -1
  7. package/templates/fullstack-template/package-lock.json +338 -5
  8. package/templates/fullstack-template/package.json +3 -2
  9. package/templates/fullstack-template/server.js +15 -1
  10. package/templates/fullstack-template/src/server.ts +5 -5
  11. package/templates/fullstack-template/vite.config.ts +56 -0
  12. package/templates/ssr-template/src/App.tsx +29 -20
  13. package/templates/fullstack-template/src/App.tsx +0 -271
  14. package/templates/fullstack-template/src/api/auth/login.ts +0 -75
  15. package/templates/fullstack-template/src/api/auth/me.ts +0 -66
  16. package/templates/fullstack-template/src/api/auth/register.ts +0 -59
  17. package/templates/fullstack-template/src/api/hello.js +0 -19
  18. package/templates/fullstack-template/src/api/todos/[id].ts +0 -108
  19. package/templates/fullstack-template/src/api/todos/index.ts +0 -79
  20. package/templates/fullstack-template/src/api/users.js +0 -39
  21. package/templates/fullstack-template/src/components/Dashboard.tsx +0 -129
  22. package/templates/fullstack-template/src/components/Header.tsx +0 -76
  23. package/templates/fullstack-template/src/contexts/ApiContext.tsx +0 -69
  24. package/templates/fullstack-template/src/contexts/AuthContext.tsx +0 -155
  25. package/templates/fullstack-template/src/pages/index.tsx +0 -200
  26. package/templates/fullstack-template/src/styles/App.css +0 -446
@@ -1,200 +0,0 @@
1
- import { useState, useEffect } from 'baraqex';
2
-
3
- interface User {
4
- id: number;
5
- name: string;
6
- email: string;
7
- }
8
-
9
- export default function HomePage() {
10
- const [users, setUsers] = useState<User[]>([]);
11
- const [newUser, setNewUser] = useState({ name: '', email: '' });
12
- const [loading, setLoading] = useState(false);
13
-
14
- // Fetch users on component mount
15
- useEffect(() => {
16
- fetchUsers();
17
- }, []);
18
-
19
- const fetchUsers = async () => {
20
- try {
21
- const response = await fetch('/api/users');
22
- const data = await response.json();
23
- if (data.success) {
24
- setUsers(data.users);
25
- }
26
- } catch (error) {
27
- console.error('Error fetching users:', error);
28
- }
29
- };
30
-
31
- const handleSubmit = async (e: React.FormEvent) => {
32
- e.preventDefault();
33
- setLoading(true);
34
-
35
- try {
36
- const response = await fetch('/api/users', {
37
- method: 'POST',
38
- headers: {
39
- 'Content-Type': 'application/json',
40
- },
41
- body: JSON.stringify(newUser),
42
- });
43
-
44
- const data = await response.json();
45
-
46
- if (data.success) {
47
- setUsers([...users, data.user]);
48
- setNewUser({ name: '', email: '' });
49
- } else {
50
- alert('Error: ' + data.error);
51
- }
52
- } catch (error) {
53
- console.error('Error creating user:', error);
54
- alert('Error creating user');
55
- } finally {
56
- setLoading(false);
57
- }
58
- };
59
-
60
- return (
61
- <div style={{
62
- fontFamily: 'system-ui, sans-serif',
63
- maxWidth: '800px',
64
- margin: '0 auto',
65
- padding: '20px'
66
- }}>
67
- <h1 style={{ color: '#333', marginBottom: '30px' }}>
68
- 🚀 Baraqex Fullstack Demo
69
- </h1>
70
-
71
- <p style={{ color: '#666', marginBottom: '40px' }}>
72
- This page demonstrates server-side rendering with API integration.
73
- The page is rendered on the server and then hydrated on the client.
74
- </p>
75
-
76
- {/* Add User Form */}
77
- <div style={{
78
- background: '#f5f5f5',
79
- padding: '20px',
80
- borderRadius: '8px',
81
- marginBottom: '30px'
82
- }}>
83
- <h2 style={{ marginTop: '0', color: '#333' }}>Add New User</h2>
84
- <form onSubmit={handleSubmit}>
85
- <div style={{ marginBottom: '15px' }}>
86
- <input
87
- type="text"
88
- placeholder="Name"
89
- value={newUser.name}
90
- onChange={(e) => setNewUser({ ...newUser, name: e.target.value })}
91
- style={{
92
- width: '100%',
93
- padding: '10px',
94
- border: '1px solid #ddd',
95
- borderRadius: '4px',
96
- fontSize: '14px'
97
- }}
98
- required
99
- />
100
- </div>
101
- <div style={{ marginBottom: '15px' }}>
102
- <input
103
- type="email"
104
- placeholder="Email"
105
- value={newUser.email}
106
- onChange={(e) => setNewUser({ ...newUser, email: e.target.value })}
107
- style={{
108
- width: '100%',
109
- padding: '10px',
110
- border: '1px solid #ddd',
111
- borderRadius: '4px',
112
- fontSize: '14px'
113
- }}
114
- required
115
- />
116
- </div>
117
- <button
118
- type="submit"
119
- disabled={loading}
120
- style={{
121
- background: loading ? '#ccc' : '#007bff',
122
- color: 'white',
123
- border: 'none',
124
- padding: '10px 20px',
125
- borderRadius: '4px',
126
- cursor: loading ? 'not-allowed' : 'pointer',
127
- fontSize: '14px'
128
- }}
129
- >
130
- {loading ? 'Adding...' : 'Add User'}
131
- </button>
132
- </form>
133
- </div>
134
-
135
- {/* Users List */}
136
- <div>
137
- <h2 style={{ color: '#333' }}>Users ({users.length})</h2>
138
- {users.length === 0 ? (
139
- <p style={{ color: '#666', fontStyle: 'italic' }}>
140
- No users found. Add some users using the form above!
141
- </p>
142
- ) : (
143
- <div style={{ display: 'grid', gap: '10px' }}>
144
- {users.map((user) => (
145
- <div
146
- key={user.id}
147
- style={{
148
- background: 'white',
149
- border: '1px solid #ddd',
150
- borderRadius: '6px',
151
- padding: '15px',
152
- display: 'flex',
153
- justifyContent: 'space-between',
154
- alignItems: 'center'
155
- }}
156
- >
157
- <div>
158
- <strong style={{ color: '#333' }}>{user.name}</strong>
159
- <br />
160
- <span style={{ color: '#666', fontSize: '14px' }}>{user.email}</span>
161
- </div>
162
- <div style={{
163
- background: '#28a745',
164
- color: 'white',
165
- padding: '4px 8px',
166
- borderRadius: '4px',
167
- fontSize: '12px'
168
- }}>
169
- ID: {user.id}
170
- </div>
171
- </div>
172
- ))}
173
- </div>
174
- )}
175
- </div>
176
-
177
- {/* API Info */}
178
- <div style={{
179
- marginTop: '40px',
180
- padding: '20px',
181
- background: '#e7f3ff',
182
- borderRadius: '8px'
183
- }}>
184
- <h3 style={{ marginTop: '0', color: '#0066cc' }}>🔗 API Endpoints</h3>
185
- <ul style={{ color: '#333' }}>
186
- <li><code>GET /api/users</code> - Fetch all users</li>
187
- <li><code>POST /api/users</code> - Create a new user</li>
188
- <li><code>GET /api/hello</code> - Simple hello endpoint</li>
189
- </ul>
190
- <p style={{ color: '#666', fontSize: '14px', marginBottom: '0' }}>
191
- Try visiting <a href="/api/users" target="_blank">/api/users</a> or <a href="/api/hello" target="_blank">/api/hello</a> to see the API responses.
192
- </p>
193
- </div>
194
- </div>
195
- );
196
- }
197
-
198
- // Page metadata for SEO
199
- HomePage.title = 'Baraqex Fullstack Demo';
200
- HomePage.description = 'A demonstration of Baraqex fullstack capabilities with SSR and API integration';
@@ -1,446 +0,0 @@
1
- /* Reset and base styles */
2
- * {
3
- margin: 0;
4
- padding: 0;
5
- box-sizing: border-box;
6
- }
7
-
8
- body {
9
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
10
- line-height: 1.6;
11
- color: #333;
12
- background-color: #f8fafc;
13
- }
14
-
15
- .app {
16
- min-height: 100vh;
17
- display: flex;
18
- flex-direction: column;
19
- }
20
-
21
- /* Header Styles */
22
- .app-header {
23
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
24
- color: white;
25
- padding: 1rem 0;
26
- box-shadow: 0 2px 10px rgba(0,0,0,0.1);
27
- }
28
-
29
- .header-content {
30
- max-width: 1200px;
31
- margin: 0 auto;
32
- padding: 0 2rem;
33
- display: flex;
34
- justify-content: space-between;
35
- align-items: center;
36
- flex-wrap: wrap;
37
- gap: 1rem;
38
- }
39
-
40
- .app-title {
41
- display: flex;
42
- align-items: center;
43
- gap: 0.5rem;
44
- font-size: 1.5rem;
45
- font-weight: 700;
46
- }
47
-
48
- .logo {
49
- font-size: 2rem;
50
- }
51
-
52
- .header-nav {
53
- display: flex;
54
- gap: 0.5rem;
55
- }
56
-
57
- .nav-button {
58
- background: rgba(255,255,255,0.1);
59
- border: none;
60
- color: white;
61
- padding: 0.5rem 1rem;
62
- border-radius: 0.5rem;
63
- cursor: pointer;
64
- transition: all 0.2s;
65
- font-size: 0.9rem;
66
- }
67
-
68
- .nav-button:hover {
69
- background: rgba(255,255,255,0.2);
70
- transform: translateY(-1px);
71
- }
72
-
73
- .nav-button.active {
74
- background: rgba(255,255,255,0.3);
75
- font-weight: 600;
76
- }
77
-
78
- .user-menu {
79
- display: flex;
80
- align-items: center;
81
- gap: 1rem;
82
- }
83
-
84
- .user-greeting {
85
- font-size: 0.9rem;
86
- opacity: 0.9;
87
- }
88
-
89
- .logout-button {
90
- background: rgba(255,255,255,0.1);
91
- border: 1px solid rgba(255,255,255,0.3);
92
- color: white;
93
- padding: 0.5rem 1rem;
94
- border-radius: 0.5rem;
95
- cursor: pointer;
96
- transition: all 0.2s;
97
- font-size: 0.9rem;
98
- }
99
-
100
- .logout-button:hover {
101
- background: rgba(255,255,255,0.2);
102
- }
103
-
104
- /* Main Content */
105
- .main-content {
106
- flex: 1;
107
- max-width: 1200px;
108
- margin: 0 auto;
109
- padding: 2rem;
110
- width: 100%;
111
- }
112
-
113
- /* Dashboard Styles */
114
- .dashboard {
115
- display: flex;
116
- flex-direction: column;
117
- gap: 2rem;
118
- }
119
-
120
- .dashboard-header {
121
- text-align: center;
122
- margin-bottom: 1rem;
123
- }
124
-
125
- .dashboard-header h2 {
126
- font-size: 2rem;
127
- color: #2d3748;
128
- margin-bottom: 0.5rem;
129
- }
130
-
131
- .dashboard-subtitle {
132
- color: #718096;
133
- font-size: 1.1rem;
134
- }
135
-
136
- .stats-grid {
137
- display: grid;
138
- grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
139
- gap: 1.5rem;
140
- margin-bottom: 2rem;
141
- }
142
-
143
- .stat-card {
144
- background: white;
145
- padding: 1.5rem;
146
- border-radius: 1rem;
147
- box-shadow: 0 4px 6px rgba(0,0,0,0.05);
148
- display: flex;
149
- align-items: center;
150
- gap: 1rem;
151
- transition: transform 0.2s, box-shadow 0.2s;
152
- }
153
-
154
- .stat-card:hover {
155
- transform: translateY(-2px);
156
- box-shadow: 0 8px 25px rgba(0,0,0,0.1);
157
- }
158
-
159
- .stat-icon {
160
- font-size: 2.5rem;
161
- opacity: 0.8;
162
- }
163
-
164
- .stat-number {
165
- font-size: 2rem;
166
- font-weight: 700;
167
- color: #2d3748;
168
- margin-bottom: 0.25rem;
169
- }
170
-
171
- .stat-label {
172
- color: #718096;
173
- font-size: 0.9rem;
174
- }
175
-
176
- /* Login Form */
177
- .login-container {
178
- display: flex;
179
- justify-content: center;
180
- align-items: center;
181
- min-height: 60vh;
182
- }
183
-
184
- .login-form {
185
- background: white;
186
- padding: 2rem;
187
- border-radius: 1rem;
188
- box-shadow: 0 10px 25px rgba(0,0,0,0.1);
189
- width: 100%;
190
- max-width: 400px;
191
- }
192
-
193
- .login-title {
194
- text-align: center;
195
- font-size: 1.8rem;
196
- color: #2d3748;
197
- margin-bottom: 1.5rem;
198
- }
199
-
200
- .form-group {
201
- margin-bottom: 1rem;
202
- }
203
-
204
- .form-label {
205
- display: block;
206
- margin-bottom: 0.5rem;
207
- color: #4a5568;
208
- font-weight: 500;
209
- }
210
-
211
- .form-input {
212
- width: 100%;
213
- padding: 0.75rem;
214
- border: 2px solid #e2e8f0;
215
- border-radius: 0.5rem;
216
- font-size: 1rem;
217
- transition: border-color 0.2s;
218
- }
219
-
220
- .form-input:focus {
221
- outline: none;
222
- border-color: #667eea;
223
- }
224
-
225
- .submit-button {
226
- width: 100%;
227
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
228
- color: white;
229
- border: none;
230
- padding: 0.75rem;
231
- border-radius: 0.5rem;
232
- font-size: 1rem;
233
- font-weight: 600;
234
- cursor: pointer;
235
- transition: transform 0.2s;
236
- }
237
-
238
- .submit-button:hover {
239
- transform: translateY(-1px);
240
- }
241
-
242
- .submit-button:disabled {
243
- opacity: 0.6;
244
- cursor: not-allowed;
245
- transform: none;
246
- }
247
-
248
- .form-toggle {
249
- text-align: center;
250
- margin-top: 1rem;
251
- color: #718096;
252
- }
253
-
254
- .form-toggle button {
255
- background: none;
256
- border: none;
257
- color: #667eea;
258
- cursor: pointer;
259
- text-decoration: underline;
260
- }
261
-
262
- .error-message {
263
- background: #fed7d7;
264
- color: #c53030;
265
- padding: 0.75rem;
266
- border-radius: 0.5rem;
267
- margin-bottom: 1rem;
268
- text-align: center;
269
- }
270
-
271
- /* Loading Spinner */
272
- .loading-container {
273
- display: flex;
274
- flex-direction: column;
275
- align-items: center;
276
- justify-content: center;
277
- padding: 4rem 2rem;
278
- }
279
-
280
- .spinner {
281
- width: 50px;
282
- height: 50px;
283
- border: 4px solid #e2e8f0;
284
- border-top: 4px solid #667eea;
285
- border-radius: 50%;
286
- animation: spin 1s linear infinite;
287
- margin-bottom: 1rem;
288
- }
289
-
290
- @keyframes spin {
291
- 0% { transform: rotate(0deg); }
292
- 100% { transform: rotate(360deg); }
293
- }
294
-
295
- /* Todo List Styles */
296
- .todo-container {
297
- background: white;
298
- border-radius: 1rem;
299
- box-shadow: 0 4px 6px rgba(0,0,0,0.05);
300
- overflow: hidden;
301
- }
302
-
303
- .todo-header {
304
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
305
- color: white;
306
- padding: 1.5rem;
307
- text-align: center;
308
- }
309
-
310
- .todo-content {
311
- padding: 1.5rem;
312
- }
313
-
314
- .todo-form {
315
- display: flex;
316
- gap: 1rem;
317
- margin-bottom: 2rem;
318
- }
319
-
320
- .todo-input {
321
- flex: 1;
322
- padding: 0.75rem;
323
- border: 2px solid #e2e8f0;
324
- border-radius: 0.5rem;
325
- font-size: 1rem;
326
- }
327
-
328
- .todo-input:focus {
329
- outline: none;
330
- border-color: #667eea;
331
- }
332
-
333
- .add-button {
334
- background: #667eea;
335
- color: white;
336
- border: none;
337
- padding: 0.75rem 1.5rem;
338
- border-radius: 0.5rem;
339
- cursor: pointer;
340
- white-space: nowrap;
341
- transition: background-color 0.2s;
342
- }
343
-
344
- .add-button:hover {
345
- background: #5a67d8;
346
- }
347
-
348
- .todo-list {
349
- display: flex;
350
- flex-direction: column;
351
- gap: 0.75rem;
352
- }
353
-
354
- .todo-item {
355
- display: flex;
356
- align-items: center;
357
- gap: 1rem;
358
- padding: 1rem;
359
- background: #f7fafc;
360
- border-radius: 0.5rem;
361
- transition: background-color 0.2s;
362
- }
363
-
364
- .todo-item:hover {
365
- background: #edf2f7;
366
- }
367
-
368
- .todo-checkbox {
369
- width: 1.25rem;
370
- height: 1.25rem;
371
- cursor: pointer;
372
- }
373
-
374
- .todo-text {
375
- flex: 1;
376
- font-size: 1rem;
377
- }
378
-
379
- .todo-text.completed {
380
- text-decoration: line-through;
381
- opacity: 0.6;
382
- }
383
-
384
- .delete-button {
385
- background: #e53e3e;
386
- color: white;
387
- border: none;
388
- padding: 0.5rem 1rem;
389
- border-radius: 0.25rem;
390
- cursor: pointer;
391
- font-size: 0.9rem;
392
- transition: background-color 0.2s;
393
- }
394
-
395
- .delete-button:hover {
396
- background: #c53030;
397
- }
398
-
399
- /* Footer */
400
- .app-footer {
401
- background: #2d3748;
402
- color: white;
403
- text-align: center;
404
- padding: 1rem;
405
- margin-top: auto;
406
- }
407
-
408
- /* Responsive Design */
409
- @media (max-width: 768px) {
410
- .header-content {
411
- flex-direction: column;
412
- text-align: center;
413
- }
414
-
415
- .header-nav {
416
- order: 3;
417
- width: 100%;
418
- justify-content: center;
419
- }
420
-
421
- .main-content {
422
- padding: 1rem;
423
- }
424
-
425
- .stats-grid {
426
- grid-template-columns: 1fr;
427
- }
428
-
429
- .todo-form {
430
- flex-direction: column;
431
- }
432
- }
433
-
434
- @media (max-width: 480px) {
435
- .stat-card {
436
- padding: 1rem;
437
- }
438
-
439
- .stat-icon {
440
- font-size: 2rem;
441
- }
442
-
443
- .stat-number {
444
- font-size: 1.5rem;
445
- }
446
- }