create-aziz-app 2.0.15 → 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 (56) hide show
  1. package/README.md +3 -3
  2. package/bin/create-aziz-app.js +9 -9
  3. package/package.json +10 -11
  4. package/template/README.md +5 -5
  5. package/template/_framework/boot.js +3 -3
  6. package/template/_framework/hooks.js +1 -1
  7. package/template/{modules → _framework}/next-response.js +5 -13
  8. package/template/_framework/router.js +1 -1
  9. package/template/_framework/runtime.js +1 -1
  10. package/template/api/createUser.js +1 -1
  11. package/template/api/hello.js +1 -1
  12. package/template/api/loginUser.js +1 -1
  13. package/template/api/users.js +1 -1
  14. package/template/app/about/page.js +1 -1
  15. package/template/app/layout.js +1 -1
  16. package/template/components/Footer.js +1 -1
  17. package/template/components/Navbar.js +1 -1
  18. package/template/package.json +4 -7
  19. package/template/scripts/dev-server.js +1 -1
  20. package/template/.vscode/settings.json +0 -15
  21. package/template/api/getUser.js +0 -60
  22. package/template/api/getUserWithDB.js +0 -65
  23. package/template/app.config.js +0 -41
  24. package/template/app.html +0 -55
  25. package/template/components/Counter.jsx +0 -36
  26. package/template/components/Footer.jsx +0 -9
  27. package/template/components/Navbar.jsx +0 -17
  28. package/template/docs/API-GUIDE.md +0 -196
  29. package/template/docs/API-ROUTES.md +0 -538
  30. package/template/docs/AUTO-IMPORT.md +0 -99
  31. package/template/docs/AUTO-REGISTRATION.md +0 -248
  32. package/template/docs/CSS-FRAMEWORKS.md +0 -221
  33. package/template/docs/DEV-SERVER.md +0 -184
  34. package/template/docs/GETTING-STARTED.md +0 -205
  35. package/template/docs/HOW-IT-WORKS.md +0 -362
  36. package/template/docs/NEXTJS-APP-ROUTER.md +0 -536
  37. package/template/docs/NEXTJS-COMPARISON.md +0 -473
  38. package/template/docs/QUICK-START.md +0 -111
  39. package/template/docs/STYLING.md +0 -269
  40. package/template/docs/TROUBLESHOOTING.md +0 -282
  41. package/template/modules/README.md +0 -129
  42. package/template/modules/api.js +0 -44
  43. package/template/modules/auto-import.js +0 -130
  44. package/template/modules/router.js +0 -218
  45. package/template/modules/state.js +0 -248
  46. package/template/package-lock.json +0 -13
  47. package/template/pages/About.jsx +0 -48
  48. package/template/pages/ApiDemo.jsx +0 -209
  49. package/template/pages/Contact.jsx +0 -25
  50. package/template/pages/Example.jsx +0 -59
  51. package/template/pages/Home.jsx +0 -39
  52. package/template/pages/HooksDemo.jsx +0 -194
  53. package/template/pages/test.jsx +0 -72
  54. package/template/scripts/build.js +0 -81
  55. package/template/scripts/generate-imports.js +0 -88
  56. package/template/tailwind.config.js +0 -17
@@ -1,269 +0,0 @@
1
- # Styling Guide
2
-
3
- ## Overview
4
-
5
- Aziz App uses external CSS files instead of inline styles for better organization and maintainability.
6
-
7
- ## File Structure
8
-
9
- ```
10
- styles/
11
- ├── globals.css ← Default custom CSS
12
- └── tailwind.css ← Tailwind CSS (when selected)
13
- ```
14
-
15
- ## globals.css
16
-
17
- The default stylesheet that includes:
18
- - CSS Reset
19
- - Base body styles
20
- - Navbar and Footer styles
21
- - Card, Button, Form components
22
- - Typography styles
23
- - Utility classes
24
-
25
- ### Usage
26
-
27
- ```html
28
- <!-- Already included in app.html -->
29
- <link rel="stylesheet" href="styles/globals.css">
30
- ```
31
-
32
- ### Available Classes
33
-
34
- **Layout:**
35
- - `.card` - White card with shadow
36
- - `#root` - Main content wrapper
37
-
38
- **Buttons:**
39
- - `.btn` - Base button style
40
- - `.btn-primary` - Primary button (blue)
41
- - `.btn-danger` - Danger button (red)
42
- - `.btn-grey` - Grey button
43
-
44
- **Counter:**
45
- - `.count-display` - Large number display
46
- - `.counter-actions` - Button group
47
-
48
- **Forms:**
49
- - `input`, `textarea` - Styled form inputs
50
- - `form` - Flex column layout
51
-
52
- **404:**
53
- - `.not-found` - Centered 404 page
54
-
55
- ## tailwind.css
56
-
57
- When using Tailwind CSS, this file provides:
58
- - Tailwind directives (@tailwind base, components, utilities)
59
- - Custom component classes
60
- - Custom utility classes
61
- - Theme extensions
62
-
63
- ### Custom Colors
64
-
65
- ```css
66
- .text-primary { color: #61dafb; }
67
- .bg-primary { background-color: #61dafb; }
68
- .text-dark { color: #282c34; }
69
- .bg-dark { background-color: #282c34; }
70
- ```
71
-
72
- ### Custom Components
73
-
74
- All the same classes from globals.css are available as Tailwind components:
75
- - `.card`
76
- - `.btn`, `.btn-primary`, `.btn-danger`, `.btn-grey`
77
- - `.count-display`
78
- - `.counter-actions`
79
-
80
- ## Customizing Styles
81
-
82
- ### Modify globals.css
83
-
84
- Edit `styles/globals.css` to change:
85
- - Colors
86
- - Spacing
87
- - Typography
88
- - Component styles
89
-
90
- ```css
91
- /* Example: Change primary color */
92
- nav .brand {
93
- color: #your-color;
94
- }
95
-
96
- .btn-primary {
97
- background-color: #your-color;
98
- }
99
- ```
100
-
101
- ### Modify tailwind.css
102
-
103
- Edit `styles/tailwind.css` to:
104
- - Add custom components
105
- - Add custom utilities
106
- - Modify theme
107
-
108
- ```css
109
- @layer components {
110
- .my-custom-card {
111
- @apply bg-white p-6 rounded-lg shadow-xl;
112
- }
113
- }
114
- ```
115
-
116
- ### Add New CSS Files
117
-
118
- 1. Create a new CSS file in `styles/`
119
- 2. Link it in `app.html`:
120
-
121
- ```html
122
- <link rel="stylesheet" href="styles/my-custom.css">
123
- ```
124
-
125
- ## Best Practices
126
-
127
- ### Organization
128
- - Keep global styles in `globals.css`
129
- - Create separate files for large features
130
- - Use meaningful class names
131
-
132
- ### Performance
133
- - Minimize CSS file size
134
- - Avoid deep nesting
135
- - Use CSS variables for themes
136
-
137
- ### Maintainability
138
- - Comment complex styles
139
- - Group related styles
140
- - Use consistent naming
141
-
142
- ## Responsive Design
143
-
144
- ### Custom CSS
145
-
146
- ```css
147
- /* Mobile first approach */
148
- .card {
149
- padding: 16px;
150
- }
151
-
152
- /* Tablet and up */
153
- @media (min-width: 768px) {
154
- .card {
155
- padding: 24px;
156
- }
157
- }
158
- ```
159
-
160
- ### Tailwind CSS
161
-
162
- ```javascript
163
- // Use responsive prefixes
164
- <div class="p-4 md:p-6 lg:p-8">
165
- Responsive padding
166
- </div>
167
- ```
168
-
169
- ## Dark Mode
170
-
171
- ### Custom CSS
172
-
173
- ```css
174
- /* Add dark mode support */
175
- @media (prefers-color-scheme: dark) {
176
- body {
177
- background-color: #1a1a1a;
178
- color: #f5f5f5;
179
- }
180
-
181
- .card {
182
- background-color: #2a2a2a;
183
- }
184
- }
185
- ```
186
-
187
- ### Tailwind CSS
188
-
189
- ```javascript
190
- // Use dark: prefix
191
- <div class="bg-white dark:bg-gray-800">
192
- Dark mode support
193
- </div>
194
- ```
195
-
196
- ## CSS Variables
197
-
198
- ### Define Variables
199
-
200
- ```css
201
- :root {
202
- --primary-color: #61dafb;
203
- --dark-color: #282c34;
204
- --spacing: 16px;
205
- }
206
- ```
207
-
208
- ### Use Variables
209
-
210
- ```css
211
- .btn-primary {
212
- background-color: var(--primary-color);
213
- padding: var(--spacing);
214
- }
215
- ```
216
-
217
- ## Tips
218
-
219
- 1. **Start Simple** - Use the provided classes first
220
- 2. **Be Consistent** - Stick to one naming convention
221
- 3. **Mobile First** - Design for mobile, enhance for desktop
222
- 4. **Test Browsers** - Check in different browsers
223
- 5. **Optimize** - Remove unused styles
224
-
225
- ## Examples
226
-
227
- ### Custom Button
228
-
229
- ```css
230
- /* In globals.css */
231
- .btn-success {
232
- background-color: #28a745;
233
- color: white;
234
- padding: 10px 22px;
235
- border-radius: 8px;
236
- border: none;
237
- cursor: pointer;
238
- }
239
- ```
240
-
241
- ```javascript
242
- // In your component
243
- <button class="btn-success">Success!</button>
244
- ```
245
-
246
- ### Custom Card
247
-
248
- ```css
249
- /* In globals.css */
250
- .card-highlight {
251
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
252
- color: white;
253
- padding: 24px;
254
- border-radius: 10px;
255
- }
256
- ```
257
-
258
- ```javascript
259
- // In your component
260
- <div class="card-highlight">
261
- <h2>Highlighted Card</h2>
262
- </div>
263
- ```
264
-
265
- ## Resources
266
-
267
- - [MDN CSS Reference](https://developer.mozilla.org/en-US/docs/Web/CSS)
268
- - [CSS Tricks](https://css-tricks.com/)
269
- - [Can I Use](https://caniuse.com/) - Browser compatibility
@@ -1,282 +0,0 @@
1
- # Troubleshooting Guide
2
-
3
- ## Live Reload Issues
4
-
5
- ### Indicator Stuck on "Connecting..."
6
-
7
- **Symptoms:**
8
- - Green indicator shows "🔌 Connecting..." and never changes
9
- - Changes don't show without hard refresh (Ctrl+Shift+R)
10
-
11
- **Causes:**
12
- - Browser cached old version of `app.html` without live reload script
13
- - SSE connection blocked by browser extension or firewall
14
-
15
- **Solutions:**
16
-
17
- 1. **Hard refresh once** to clear cache:
18
- - Windows/Linux: `Ctrl + Shift + R`
19
- - Mac: `Cmd + Shift + R`
20
-
21
- 2. **Check browser console** (F12):
22
- - Look for: `"🔌 Connecting to live reload at http://localhost:3000/live-reload"`
23
- - Look for: `"✅ Live reload connected"`
24
- - If you see errors, note them
25
-
26
- 3. **Disable browser extensions** temporarily:
27
- - Ad blockers can block SSE connections
28
- - Try in incognito/private mode
29
-
30
- 4. **Check terminal output**:
31
- - Should show: `"🔌 [time] Browser connected for live reload (1 total)"`
32
- - If not showing, SSE connection failed
33
-
34
- 5. **Restart dev server**:
35
- ```bash
36
- # Stop with Ctrl+C
37
- npm run dev
38
- ```
39
-
40
- 6. **Clear browser cache completely**:
41
- - Chrome: Settings → Privacy → Clear browsing data
42
- - Firefox: Settings → Privacy → Clear Data
43
- - Edge: Settings → Privacy → Clear browsing data
44
-
45
- ### Changes Not Showing
46
-
47
- **Symptoms:**
48
- - Indicator shows "✅ Live Reload Active"
49
- - Page reloads but changes don't appear
50
-
51
- **Solutions:**
52
-
53
- 1. **Check file was saved**:
54
- - Verify file has no unsaved indicator in editor
55
- - Check terminal shows: `"📝 Detected change: pages/Home.jsx"`
56
-
57
- 2. **Check imports were regenerated**:
58
- - Terminal should show: `"🔄 Regenerating imports..."`
59
- - Check `app.html` has your file listed
60
-
61
- 3. **Verify file location**:
62
- - Files must be in: `api/`, `components/`, `pages/`, `modules/`, or `styles/`
63
- - Files outside these folders won't trigger reload
64
-
65
- 4. **Check for JavaScript errors**:
66
- - Open browser console (F12)
67
- - Look for red error messages
68
- - Fix any syntax errors in your code
69
-
70
- 5. **Manual import regeneration**:
71
- ```bash
72
- npm run build
73
- ```
74
-
75
- ### Indicator Shows "❌ Connection Error"
76
-
77
- **Symptoms:**
78
- - Red indicator with error message
79
- - Console shows EventSource errors
80
-
81
- **Solutions:**
82
-
83
- 1. **Check dev server is running**:
84
- - Terminal should show: `"✅ Dev server running with live reload!"`
85
- - If not, run: `npm run dev`
86
-
87
- 2. **Check port is correct**:
88
- - Browser URL should match terminal output
89
- - Example: `http://localhost:3000/`
90
-
91
- 3. **Firewall blocking connection**:
92
- - Allow Node.js through firewall
93
- - Try different port: `PORT=3001 npm run dev`
94
-
95
- 4. **Browser doesn't support EventSource**:
96
- - Update to latest browser version
97
- - Try different browser (Chrome, Firefox, Edge)
98
-
99
- ## Page Not Found (404)
100
-
101
- **Symptoms:**
102
- - Clicking link shows 404 page
103
- - URL is correct but page doesn't load
104
-
105
- **Solutions:**
106
-
107
- 1. **Check function name**:
108
- ```jsx
109
- // ✅ Correct - ends with "Page"
110
- function AboutPage() { }
111
-
112
- // ❌ Wrong - missing "Page"
113
- function About() { }
114
- ```
115
-
116
- 2. **Check file is loaded**:
117
- - Open `app.html`
118
- - Look for: `<script type="text/babel" src="pages/YourPage.jsx"></script>`
119
- - If missing, run: `npm run build`
120
-
121
- 3. **Check browser console**:
122
- - Look for: `"📄 Auto-registered: about → AboutPage()"`
123
- - If missing, function name is wrong
124
-
125
- 4. **Manual registration**:
126
- ```jsx
127
- // Add this if auto-registration fails
128
- registerPage("about", AboutPage);
129
- ```
130
-
131
- ## State Not Working
132
-
133
- **Symptoms:**
134
- - `useState` is undefined
135
- - State doesn't update
136
-
137
- **Solutions:**
138
-
139
- 1. **Check `/** @jsx h */` at top of file**:
140
- ```jsx
141
- /** @jsx h */
142
-
143
- function MyPage() {
144
- const [count, setCount] = useState(0);
145
- // ...
146
- }
147
- ```
148
-
149
- 2. **Check state.js is loaded**:
150
- - Open `app.html`
151
- - Look for: `<script type="text/babel" src="modules/state.js"></script>`
152
-
153
- 3. **Check browser console for errors**:
154
- - Look for: `"useState is not defined"`
155
- - If found, state.js didn't load
156
-
157
- ## Styling Not Applied
158
-
159
- **Symptoms:**
160
- - Page has no styling
161
- - Looks like plain HTML
162
-
163
- **Solutions:**
164
-
165
- 1. **Check CSS file is linked**:
166
- - Open `app.html`
167
- - Look for: `<link rel="stylesheet" href="styles/globals.css">`
168
-
169
- 2. **Check CSS file exists**:
170
- - Verify `styles/globals.css` exists
171
- - Check file has content
172
-
173
- 3. **Check class names**:
174
- ```jsx
175
- // ✅ Correct
176
- <div class="card">
177
-
178
- // ❌ Wrong (React syntax)
179
- <div className="card">
180
- ```
181
-
182
- 4. **Hard refresh**:
183
- - CSS might be cached
184
- - Press: `Ctrl + Shift + R` (Windows) or `Cmd + Shift + R` (Mac)
185
-
186
- ## API Routes Not Working
187
-
188
- **Symptoms:**
189
- - `fetchApi()` returns 404
190
- - API endpoint not found
191
-
192
- **Solutions:**
193
-
194
- 1. **Check API file is loaded**:
195
- - Open `app.html`
196
- - Look for: `<script type="text/babel" src="api/yourfile.js"></script>`
197
-
198
- 2. **Check route registration**:
199
- ```jsx
200
- // In api/users.js
201
- registerApiRoute('users', async (req, res) => {
202
- // handler
203
- });
204
- ```
205
-
206
- 3. **Check URL format**:
207
- ```jsx
208
- // ✅ Correct
209
- await fetchApi('/api/users');
210
-
211
- // ❌ Wrong
212
- await fetchApi('api/users'); // missing leading /
213
- await fetchApi('/users'); // missing /api/
214
- ```
215
-
216
- 4. **Check browser console**:
217
- - Look for network errors
218
- - Check request URL is correct
219
-
220
- ## Port Already in Use
221
-
222
- **Symptoms:**
223
- - Error: `EADDRINUSE: address already in use :::3000`
224
-
225
- **Solutions:**
226
-
227
- 1. **Server auto-finds next port**:
228
- - Check terminal for actual port
229
- - Example: `"Server running at http://localhost:3001/"`
230
-
231
- 2. **Kill process on port 3000**:
232
- ```bash
233
- # Windows
234
- netstat -ano | findstr :3000
235
- taskkill /PID <PID> /F
236
-
237
- # Mac/Linux
238
- lsof -ti:3000 | xargs kill -9
239
- ```
240
-
241
- 3. **Use different port**:
242
- ```bash
243
- PORT=3001 npm run dev
244
- ```
245
-
246
- ## General Tips
247
-
248
- ### Before Asking for Help
249
-
250
- 1. **Check browser console** (F12) for errors
251
- 2. **Check terminal output** for server errors
252
- 3. **Try hard refresh** (Ctrl+Shift+R)
253
- 4. **Try incognito mode** to rule out extensions
254
- 5. **Restart dev server** (Ctrl+C, then `npm run dev`)
255
-
256
- ### Debug Checklist
257
-
258
- - [ ] Dev server is running
259
- - [ ] Browser URL matches server URL
260
- - [ ] File is saved
261
- - [ ] File is in correct folder
262
- - [ ] `/** @jsx h */` at top of JSX files
263
- - [ ] Function name ends with "Page"
264
- - [ ] No JavaScript errors in console
265
- - [ ] Live reload indicator is green
266
-
267
- ### Still Having Issues?
268
-
269
- 1. **Check documentation**:
270
- - [Getting Started](GETTING-STARTED.md)
271
- - [Auto-Registration](AUTO-REGISTRATION.md)
272
- - [Dev Server](DEV-SERVER.md)
273
-
274
- 2. **Create minimal reproduction**:
275
- - Create new app: `npx create-aziz-app test-app`
276
- - Test if issue persists in fresh app
277
-
278
- 3. **Report issue** with:
279
- - Browser console output
280
- - Terminal output
281
- - Code that's not working
282
- - Steps to reproduce
@@ -1,129 +0,0 @@
1
- # Modules Folder
2
-
3
- This folder contains the core system modules that power your application.
4
-
5
- ## Core Modules
6
-
7
- ### 📦 router.js
8
- The main application engine containing:
9
- - **`h()` function** - JSX createElement (converts JSX to DOM elements)
10
- - **Router system** - File-based routing with hash navigation
11
- - **`registerPage()`** - Register page components
12
- - **`navigate()`** - Navigate between pages
13
- - **`renderPage()`** - Render engine with focus preservation
14
- - **Global state** - Basic global state management
15
-
16
- ### 🔄 state.js
17
- State management system:
18
- - **`useState(initialValue)`** - React-like hooks for local component state
19
- - **Hook system** - Manages state across re-renders
20
- - **`resetHooks()`** - Resets hook index before each render
21
-
22
- ### 🌐 api.js
23
- API route system (Next.js-like):
24
- - **`registerApiRoute(path, handler)`** - Register API endpoints
25
- - **`fetchApi(path, options)`** - Fetch-like API for making requests
26
- - **Request/Response objects** - Express-like req/res handling
27
- - **Mock API system** - Client-side API simulation
28
-
29
- ## How It Works
30
-
31
- ### 1. Router System
32
- ```javascript
33
- // Register a page
34
- registerPage("home", HomePage);
35
-
36
- // Navigate programmatically
37
- navigate("about");
38
-
39
- // Get current path
40
- const path = getCurrentPath(); // returns "home", "about", etc.
41
- ```
42
-
43
- ### 2. State Management
44
- ```javascript
45
- // Use state in components
46
- const [count, setCount] = useState(0);
47
- const [name, setName] = useState('');
48
-
49
- // Update state
50
- setCount(count + 1);
51
- setName('New Name');
52
- ```
53
-
54
- ### 3. API Routes
55
- ```javascript
56
- // Register an API route
57
- registerApiRoute('myroute', async (req, res) => {
58
- return res.status(200).json({ data: 'Hello!' });
59
- });
60
-
61
- // Call from components
62
- const response = await fetchApi('/api/myroute');
63
- const data = await response.json();
64
- ```
65
-
66
- ## Module Loading Order
67
-
68
- The modules must be loaded in this order (see `app.html`):
69
-
70
- 1. **router.js** - Core engine and routing
71
- 2. **state.js** - State management
72
- 3. **api.js** - API system
73
- 4. **API routes** - Your API endpoints
74
- 5. **Components** - Reusable UI components
75
- 6. **Pages** - Page components
76
- 7. **Start app** - Call `startApp()`
77
-
78
- ## Extending the System
79
-
80
- ### Add New Core Features
81
-
82
- Create new modules in this folder for additional core functionality:
83
-
84
- ```javascript
85
- // modules/auth.js
86
- function login(username, password) {
87
- // Authentication logic
88
- }
89
-
90
- function logout() {
91
- // Logout logic
92
- }
93
-
94
- window.auth = { login, logout };
95
- ```
96
-
97
- Then load it in `app.html`:
98
- ```html
99
- <script type="text/babel" src="modules/auth.js"></script>
100
- ```
101
-
102
- ### Module Best Practices
103
-
104
- 1. **Export to global scope** - Use `window.functionName` or `globalThis.functionName`
105
- 2. **Keep modules focused** - Each module should have a single responsibility
106
- 3. **Document your modules** - Add comments explaining what each function does
107
- 4. **Load order matters** - Ensure dependencies are loaded first
108
-
109
- ## File Structure
110
-
111
- ```
112
- template/
113
- ├── modules/ # Core system modules (you are here)
114
- │ ├── router.js # Routing and rendering engine
115
- │ ├── state.js # State management
116
- │ ├── api.js # API route system
117
- │ └── README.md # This file
118
- ├── api/ # API route handlers
119
- ├── components/ # Reusable UI components
120
- ├── pages/ # Page components
121
- └── app.html # Main HTML file
122
- ```
123
-
124
- ## Notes
125
-
126
- - These modules are loaded via Babel standalone for JSX support
127
- - All modules use the `/** @jsx h */` pragma to use the custom `h()` function
128
- - The system is designed to be simple and easy to understand
129
- - You can replace any module with your own implementation
@@ -1,44 +0,0 @@
1
- /** @jsx h */
2
-
3
- // ============================================================
4
- // API CLIENT
5
- // Fetch-like API for making requests to backend API routes
6
- // API routes run on the SERVER (Node.js), not in the browser
7
- // ============================================================
8
-
9
- // Fetch-like API for making requests to backend
10
- async function fetchApi(path, options = {}) {
11
- const {
12
- method = 'GET',
13
- body = null,
14
- headers = {}
15
- } = options;
16
-
17
- const fetchOptions = {
18
- method,
19
- headers: {
20
- 'Content-Type': 'application/json',
21
- ...headers
22
- }
23
- };
24
-
25
- if (body) {
26
- fetchOptions.body = typeof body === 'string' ? body : JSON.stringify(body);
27
- }
28
-
29
- try {
30
- const response = await fetch(path, fetchOptions);
31
- return response;
32
- } catch (error) {
33
- console.error('API Error:', error);
34
- throw error;
35
- }
36
- }
37
-
38
- // Export to global scope
39
- window.fetchApi = fetchApi;
40
-
41
- // Also make available without window prefix
42
- if (typeof globalThis !== 'undefined') {
43
- globalThis.fetchApi = fetchApi;
44
- }