create-aziz-app 2.0.14 → 3.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 (60) hide show
  1. package/README.md +227 -0
  2. package/bin/create-aziz-app.js +9 -9
  3. package/package.json +10 -11
  4. package/template/README.md +862 -138
  5. package/template/_framework/boot.js +36 -0
  6. package/template/_framework/hooks.js +207 -0
  7. package/template/{modules → _framework}/next-response.js +5 -13
  8. package/template/_framework/router.js +279 -0
  9. package/template/_framework/runtime.js +86 -0
  10. package/template/api/createUser.js +1 -1
  11. package/template/api/hello.js +8 -17
  12. package/template/api/loginUser.js +1 -1
  13. package/template/api/users.js +38 -134
  14. package/template/app/about/page.js +45 -0
  15. package/template/app/layout.js +23 -0
  16. package/template/app/page.js +54 -0
  17. package/template/app/test/page.js +55 -0
  18. package/template/components/Footer.js +10 -0
  19. package/template/components/Navbar.js +30 -0
  20. package/template/index.html +24 -0
  21. package/template/package.json +5 -14
  22. package/template/scripts/dev-server.js +330 -302
  23. package/template/scripts/live-reload-client.js +0 -1
  24. package/template/.vscode/settings.json +0 -15
  25. package/template/api/getUser.js +0 -60
  26. package/template/api/getUserWithDB.js +0 -65
  27. package/template/app.config.js +0 -41
  28. package/template/app.html +0 -55
  29. package/template/components/Counter.jsx +0 -36
  30. package/template/components/Footer.jsx +0 -9
  31. package/template/components/Navbar.jsx +0 -17
  32. package/template/docs/API-GUIDE.md +0 -196
  33. package/template/docs/API-ROUTES.md +0 -538
  34. package/template/docs/AUTO-IMPORT.md +0 -99
  35. package/template/docs/AUTO-REGISTRATION.md +0 -248
  36. package/template/docs/CSS-FRAMEWORKS.md +0 -221
  37. package/template/docs/DEV-SERVER.md +0 -184
  38. package/template/docs/GETTING-STARTED.md +0 -205
  39. package/template/docs/HOW-IT-WORKS.md +0 -362
  40. package/template/docs/NEXTJS-APP-ROUTER.md +0 -536
  41. package/template/docs/NEXTJS-COMPARISON.md +0 -473
  42. package/template/docs/QUICK-START.md +0 -111
  43. package/template/docs/STYLING.md +0 -269
  44. package/template/docs/TROUBLESHOOTING.md +0 -282
  45. package/template/modules/README.md +0 -129
  46. package/template/modules/api.js +0 -44
  47. package/template/modules/auto-import.js +0 -130
  48. package/template/modules/router.js +0 -218
  49. package/template/modules/state.js +0 -248
  50. package/template/package-lock.json +0 -13
  51. package/template/pages/About.jsx +0 -48
  52. package/template/pages/ApiDemo.jsx +0 -209
  53. package/template/pages/Contact.jsx +0 -25
  54. package/template/pages/Example.jsx +0 -59
  55. package/template/pages/Home.jsx +0 -39
  56. package/template/pages/HooksDemo.jsx +0 -194
  57. package/template/pages/test.jsx +0 -72
  58. package/template/scripts/build.js +0 -81
  59. package/template/scripts/generate-imports.js +0 -88
  60. package/template/tailwind.config.js +0 -17
@@ -1,473 +0,0 @@
1
- # Next.js Comparison
2
-
3
- ## Overview
4
-
5
- Aziz App is a **lightweight Next.js clone** with all the core benefits but zero dependencies and minimal complexity.
6
-
7
- ## Feature Comparison
8
-
9
- | Feature | Aziz App | Next.js | Notes |
10
- |---------|----------|---------|-------|
11
- | **React Hooks** | ✅ | ✅ | useState, useEffect, useMemo, useCallback, useRef, useReducer |
12
- | **File-based Routing** | ✅ | ✅ | pages/ folder → routes |
13
- | **API Routes** | ✅ | ✅ | api/ folder → endpoints |
14
- | **Server-side API** | ✅ | ✅ | Real Node.js backend |
15
- | **Hot Reload** | ✅ | ✅ | WebSocket-based |
16
- | **Auto Import** | ✅ | ✅ | No manual imports needed |
17
- | **Zero Config** | ✅ | ❌ | No config files needed |
18
- | **Bundle Size** | **~50KB** | ~300KB+ | 6x smaller! |
19
- | **Dependencies** | **0** | 20+ | No node_modules bloat |
20
- | **Build Time** | **Instant** | Slow | No build step |
21
- | **SSR** | ❌ | ✅ | Client-side only |
22
- | **SSG** | ❌ | ✅ | Client-side only |
23
- | **Image Optimization** | ❌ | ✅ | Use CDN instead |
24
- | **TypeScript** | ❌ | ✅ | Pure JavaScript |
25
- | **Middleware** | ❌ | ✅ | Keep it simple |
26
-
27
- ## React Hooks - Identical API
28
-
29
- ### useState
30
-
31
- ```javascript
32
- // Next.js
33
- import { useState } from 'react';
34
- const [count, setCount] = useState(0);
35
-
36
- // Aziz App - EXACTLY THE SAME!
37
- const [count, setCount] = useState(0);
38
- ```
39
-
40
- ### useEffect
41
-
42
- ```javascript
43
- // Next.js
44
- import { useEffect } from 'react';
45
- useEffect(() => {
46
- console.log('Mounted!');
47
- return () => console.log('Cleanup!');
48
- }, [dependency]);
49
-
50
- // Aziz App - EXACTLY THE SAME!
51
- useEffect(() => {
52
- console.log('Mounted!');
53
- return () => console.log('Cleanup!');
54
- }, [dependency]);
55
- ```
56
-
57
- ### useMemo
58
-
59
- ```javascript
60
- // Next.js
61
- import { useMemo } from 'react';
62
- const value = useMemo(() => expensiveCalc(), [dep]);
63
-
64
- // Aziz App - EXACTLY THE SAME!
65
- const value = useMemo(() => expensiveCalc(), [dep]);
66
- ```
67
-
68
- ### useCallback
69
-
70
- ```javascript
71
- // Next.js
72
- import { useCallback } from 'react';
73
- const callback = useCallback(() => doSomething(), [dep]);
74
-
75
- // Aziz App - EXACTLY THE SAME!
76
- const callback = useCallback(() => doSomething(), [dep]);
77
- ```
78
-
79
- ### useRef
80
-
81
- ```javascript
82
- // Next.js
83
- import { useRef } from 'react';
84
- const ref = useRef(null);
85
-
86
- // Aziz App - EXACTLY THE SAME!
87
- const ref = useRef(null);
88
- ```
89
-
90
- ### useReducer
91
-
92
- ```javascript
93
- // Next.js
94
- import { useReducer } from 'react';
95
- const [state, dispatch] = useReducer(reducer, initialState);
96
-
97
- // Aziz App - EXACTLY THE SAME!
98
- const [state, dispatch] = useReducer(reducer, initialState);
99
- ```
100
-
101
- ## API Routes - Identical API
102
-
103
- ### Basic Route
104
-
105
- ```javascript
106
- // Next.js (pages/api/hello.js)
107
- export default async function handler(req, res) {
108
- res.status(200).json({ message: 'Hello' });
109
- }
110
-
111
- // Aziz App (api/hello.js) - EXACTLY THE SAME!
112
- export default async function handler(req, res) {
113
- res.status(200).json({ message: 'Hello' });
114
- }
115
- ```
116
-
117
- ### Request Object
118
-
119
- ```javascript
120
- // Both Next.js and Aziz App
121
- {
122
- method: 'GET' | 'POST' | 'PUT' | 'DELETE',
123
- body: {}, // Parsed JSON
124
- query: {}, // URL parameters
125
- headers: {}, // Request headers
126
- url: string // Full URL
127
- }
128
- ```
129
-
130
- ### Response Methods
131
-
132
- ```javascript
133
- // Both Next.js and Aziz App
134
- res.status(200) // Set status
135
- res.json({ data: 'value' }) // Send JSON
136
- res.send('text') // Send text
137
- res.setHeader('X-Custom', 'value') // Set header
138
- ```
139
-
140
- ### CRUD Example
141
-
142
- ```javascript
143
- // Works identically in both!
144
- export default async function handler(req, res) {
145
- switch (req.method) {
146
- case 'GET':
147
- return res.status(200).json({ users: [] });
148
- case 'POST':
149
- return res.status(201).json({ created: true });
150
- case 'PUT':
151
- return res.status(200).json({ updated: true });
152
- case 'DELETE':
153
- return res.status(200).json({ deleted: true });
154
- default:
155
- return res.status(405).json({ error: 'Method not allowed' });
156
- }
157
- }
158
- ```
159
-
160
- ## File-based Routing
161
-
162
- ### Pages
163
-
164
- ```
165
- // Next.js
166
- pages/
167
- ├── index.js → /
168
- ├── about.js → /about
169
- └── contact.js → /contact
170
-
171
- // Aziz App - Same concept!
172
- pages/
173
- ├── Home.jsx → #/home
174
- ├── About.jsx → #/about
175
- └── Contact.jsx → #/contact
176
- ```
177
-
178
- ### Auto-Registration
179
-
180
- ```javascript
181
- // Next.js - Automatic
182
- // Just create the file
183
-
184
- // Aziz App - Automatic too!
185
- // Just name your function: AboutPage()
186
- function AboutPage() {
187
- return <div><h1>About</h1></div>;
188
- }
189
- ```
190
-
191
- ## Data Fetching
192
-
193
- ### Client-side Fetching
194
-
195
- ```javascript
196
- // Next.js
197
- import { useState, useEffect } from 'react';
198
-
199
- function Page() {
200
- const [data, setData] = useState(null);
201
-
202
- useEffect(() => {
203
- fetch('/api/users')
204
- .then(res => res.json())
205
- .then(setData);
206
- }, []);
207
-
208
- return <div>{data?.message}</div>;
209
- }
210
-
211
- // Aziz App - EXACTLY THE SAME!
212
- function Page() {
213
- const [data, setData] = useState(null);
214
-
215
- useEffect(() => {
216
- fetch('/api/users')
217
- .then(res => res.json())
218
- .then(setData);
219
- }, []);
220
-
221
- return <div>{data?.message}</div>;
222
- }
223
- ```
224
-
225
- ### Custom Hook
226
-
227
- ```javascript
228
- // Both Next.js and Aziz App
229
- function useFetch(url) {
230
- const [data, setData] = useState(null);
231
- const [loading, setLoading] = useState(true);
232
-
233
- useEffect(() => {
234
- fetch(url)
235
- .then(res => res.json())
236
- .then(data => {
237
- setData(data);
238
- setLoading(false);
239
- });
240
- }, [url]);
241
-
242
- return { data, loading };
243
- }
244
- ```
245
-
246
- ## JSX Syntax
247
-
248
- ### Components
249
-
250
- ```jsx
251
- // Next.js
252
- export default function Button({ onClick, children }) {
253
- return <button onClick={onClick}>{children}</button>;
254
- }
255
-
256
- // Aziz App - Same JSX!
257
- function Button({ onClick, children }) {
258
- return <button onClick={onClick}>{children}</button>;
259
- }
260
- ```
261
-
262
- ### Props
263
-
264
- ```jsx
265
- // Both support the same props
266
- <div
267
- class="container"
268
- style={{ color: 'red' }}
269
- onClick={() => alert('Hi')}
270
- >
271
- Content
272
- </div>
273
- ```
274
-
275
- ## Development Experience
276
-
277
- ### Hot Reload
278
-
279
- ```
280
- // Next.js
281
- 1. Save file
282
- 2. Fast Refresh
283
- 3. State preserved
284
-
285
- // Aziz App
286
- 1. Save file
287
- 2. WebSocket reload
288
- 3. Full page reload (state reset)
289
- ```
290
-
291
- ### Error Messages
292
-
293
- ```
294
- // Next.js
295
- - Detailed error overlay
296
- - Stack traces
297
- - Suggestions
298
-
299
- // Aziz App
300
- - Browser console errors
301
- - Simpler debugging
302
- - Less magic
303
- ```
304
-
305
- ## When to Use Each
306
-
307
- ### Use Aziz App When:
308
-
309
- ✅ Building simple SPAs
310
- ✅ Learning React concepts
311
- ✅ Prototyping quickly
312
- ✅ Want zero dependencies
313
- ✅ Don't need SSR/SSG
314
- ✅ Want instant startup
315
- ✅ Prefer simplicity
316
-
317
- ### Use Next.js When:
318
-
319
- ✅ Need SEO (SSR/SSG)
320
- ✅ Building large apps
321
- ✅ Need image optimization
322
- ✅ Want TypeScript
323
- ✅ Need middleware
324
- ✅ Want edge functions
325
- ✅ Building production apps
326
-
327
- ## Migration Path
328
-
329
- ### From Aziz App to Next.js
330
-
331
- 1. **Pages** - Rename files, adjust exports
332
- 2. **API Routes** - Copy as-is (same API!)
333
- 3. **Hooks** - No changes needed (same API!)
334
- 4. **Components** - Minor adjustments
335
- 5. **Styling** - Add CSS modules if needed
336
-
337
- ### From Next.js to Aziz App
338
-
339
- 1. **Remove SSR/SSG** - Convert to client-side
340
- 2. **Pages** - Adjust file names
341
- 3. **API Routes** - Copy as-is (same API!)
342
- 4. **Hooks** - No changes needed (same API!)
343
- 5. **Remove dependencies** - Delete node_modules
344
-
345
- ## Performance
346
-
347
- ### Bundle Size
348
-
349
- ```
350
- Next.js Production Build:
351
- - Framework: ~300KB
352
- - Runtime: ~100KB
353
- - Total: ~400KB+
354
-
355
- Aziz App:
356
- - Framework: ~50KB
357
- - Runtime: 0KB (browser native)
358
- - Total: ~50KB
359
- ```
360
-
361
- ### Startup Time
362
-
363
- ```
364
- Next.js:
365
- - npm install: 2-5 minutes
366
- - npm run dev: 10-30 seconds
367
- - First load: 2-5 seconds
368
-
369
- Aziz App:
370
- - npm install: 5 seconds
371
- - npm run dev: <1 second
372
- - First load: <1 second
373
- ```
374
-
375
- ### Build Time
376
-
377
- ```
378
- Next.js:
379
- - Development: 10-30 seconds
380
- - Production: 1-5 minutes
381
-
382
- Aziz App:
383
- - Development: Instant
384
- - Production: No build needed
385
- ```
386
-
387
- ## Code Examples
388
-
389
- ### Counter Component
390
-
391
- ```jsx
392
- // Works identically in both!
393
- function Counter() {
394
- const [count, setCount] = useState(0);
395
-
396
- return (
397
- <div>
398
- <p>Count: {count}</p>
399
- <button onClick={() => setCount(count + 1)}>
400
- Increment
401
- </button>
402
- </div>
403
- );
404
- }
405
- ```
406
-
407
- ### Form with Validation
408
-
409
- ```jsx
410
- // Works identically in both!
411
- function ContactForm() {
412
- const [name, setName] = useState('');
413
- const [email, setEmail] = useState('');
414
- const [error, setError] = useState('');
415
-
416
- const handleSubmit = async (e) => {
417
- e.preventDefault();
418
-
419
- if (!name || !email) {
420
- setError('All fields required');
421
- return;
422
- }
423
-
424
- const res = await fetch('/api/contact', {
425
- method: 'POST',
426
- headers: { 'Content-Type': 'application/json' },
427
- body: JSON.stringify({ name, email })
428
- });
429
-
430
- if (res.ok) {
431
- alert('Sent!');
432
- }
433
- };
434
-
435
- return (
436
- <form onSubmit={handleSubmit}>
437
- <input
438
- value={name}
439
- onChange={(e) => setName(e.target.value)}
440
- placeholder="Name"
441
- />
442
- <input
443
- value={email}
444
- onChange={(e) => setEmail(e.target.value)}
445
- placeholder="Email"
446
- />
447
- {error && <p>{error}</p>}
448
- <button type="submit">Submit</button>
449
- </form>
450
- );
451
- }
452
- ```
453
-
454
- ## Summary
455
-
456
- Aziz App is a **lightweight Next.js clone** that provides:
457
-
458
- - ✅ **Same React Hooks API** - useState, useEffect, etc.
459
- - ✅ **Same API Routes** - Identical req/res objects
460
- - ✅ **Same JSX Syntax** - Write components the same way
461
- - ✅ **Same Development Flow** - File-based routing, hot reload
462
- - ✅ **Zero Dependencies** - No node_modules bloat
463
- - ✅ **Instant Startup** - No build step
464
- - ✅ **6x Smaller** - Minimal bundle size
465
-
466
- Perfect for:
467
- - 🎓 Learning React/Next.js concepts
468
- - 🚀 Rapid prototyping
469
- - 📱 Simple SPAs
470
- - 🎨 Portfolio sites
471
- - 🧪 Experiments
472
-
473
- **It's Next.js, but lightweight!** 🎉
@@ -1,111 +0,0 @@
1
- # Quick Start Guide
2
-
3
- ## Adding a New Page
4
-
5
- 1. Create `pages/NewPage.jsx`:
6
- ```javascript
7
- /** @jsx h */
8
-
9
- // Register this page
10
- registerPage("newpage", NewPage);
11
-
12
- function NewPage() {
13
- // Use state management
14
- const [counter, setCounter] = window.StateManager.useState(0);
15
-
16
- return (
17
- <div>
18
- <h1>New Page</h1>
19
- <p>Counter: {counter}</p>
20
- <button onClick={() => setCounter(counter + 1)}>
21
- Increment
22
- </button>
23
- </div>
24
- );
25
- }
26
- ```
27
-
28
- 2. That's it! The page will be automatically loaded and available at `#/newpage`
29
-
30
- ## Adding a New Component
31
-
32
- 1. Create `components/Button.jsx`:
33
- ```javascript
34
- /** @jsx h */
35
-
36
- // Register this component
37
- if (window.AutoImport) {
38
- window.AutoImport.registerComponent('Button', Button);
39
- }
40
-
41
- function Button({ label, onClick, variant = 'primary' }) {
42
- return (
43
- <button
44
- class={`btn btn-${variant}`}
45
- onClick={onClick}
46
- >
47
- {label}
48
- </button>
49
- );
50
- }
51
- ```
52
-
53
- 2. Use it in any page:
54
- ```javascript
55
- // In your page component
56
- const Button = window.AutoImport.getComponent('Button');
57
- return <Button label="Click me" onClick={() => alert('Clicked!')} />;
58
- ```
59
-
60
- ## State Management Examples
61
-
62
- ### Basic Counter
63
- ```javascript
64
- const [count, setCount] = window.StateManager.useState(0);
65
- return <button onClick={() => setCount(count + 1)}>Count: {count}</button>;
66
- ```
67
-
68
- ### Form with Multiple Fields
69
- ```javascript
70
- const [form, setForm] = window.StateManager.useState({
71
- name: '',
72
- email: '',
73
- message: ''
74
- });
75
-
76
- const handleChange = (field, value) => {
77
- setForm({ ...form, [field]: value });
78
- };
79
-
80
- return (
81
- <form>
82
- <input
83
- value={form.name}
84
- onChange={(e) => handleChange('name', e.target.value)}
85
- />
86
- {/* ... other fields */}
87
- </form>
88
- );
89
- ```
90
-
91
- ### Global State
92
- ```javascript
93
- // Set global state
94
- window.StateManager.setState({ theme: 'dark', user: 'John' });
95
-
96
- // Get global state
97
- const { theme, user } = window.StateManager.getState();
98
- ```
99
-
100
- ## Tips
101
-
102
- 1. **State is reactive**: When state changes, components automatically re-render
103
- 2. **No imports needed**: Everything is available via `window.StateManager` and `window.AutoImport`
104
- 3. **Isolation**: Each component's `useState` is isolated to that component
105
- 4. **Global vs Local**: Use `window.StateManager.setState()` for global state, `useState()` for local component state
106
-
107
- ## Testing
108
-
109
- Open `app.html` and navigate to:
110
- - `#/` (Home) - Shows global state, local state, and reusable components
111
- - `#/test` - Comprehensive form and state examples