create-ern-boilerplate 0.0.52 → 0.0.54

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 (155) hide show
  1. package/create.js +80 -13
  2. package/package.json +1 -1
  3. package/templates/agent-generator-fullstack/.gitignore-template +80 -0
  4. package/templates/agent-generator-fullstack/AI_GUIDE.md +233 -0
  5. package/templates/agent-generator-fullstack/CONVENTIONS.md +346 -0
  6. package/templates/agent-generator-fullstack/CUSTOMIZATION.md +498 -0
  7. package/templates/agent-generator-fullstack/PATTERNS.md +472 -0
  8. package/templates/agent-generator-fullstack/README.md +360 -0
  9. package/templates/agent-generator-fullstack/SERVER_GUIDE.md +726 -0
  10. package/templates/agent-generator-fullstack/ai-context.json +23 -0
  11. package/templates/agent-generator-fullstack/app/(auth)/_layout.tsx +17 -0
  12. package/templates/agent-generator-fullstack/app/(auth)/login.tsx +87 -0
  13. package/templates/agent-generator-fullstack/app/(auth)/register.tsx +100 -0
  14. package/templates/agent-generator-fullstack/app/(tabs)/_layout.tsx +47 -0
  15. package/templates/agent-generator-fullstack/app/(tabs)/index.tsx +44 -0
  16. package/templates/agent-generator-fullstack/app/(tabs)/settings.tsx +71 -0
  17. package/templates/agent-generator-fullstack/app/_layout.tsx +27 -0
  18. package/templates/agent-generator-fullstack/app.config.js +99 -0
  19. package/templates/agent-generator-fullstack/app.plugins.js +17 -0
  20. package/templates/agent-generator-fullstack/babel.config.js +30 -0
  21. package/templates/agent-generator-fullstack/eas.json +54 -0
  22. package/templates/agent-generator-fullstack/examples/apps/dashboard-with-auth/README.md +417 -0
  23. package/templates/agent-generator-fullstack/examples/apps/news-no-auth/README.md +350 -0
  24. package/templates/agent-generator-fullstack/examples/apps/todo-offline/README.md +197 -0
  25. package/templates/agent-generator-fullstack/examples/component.example.tsx +90 -0
  26. package/templates/agent-generator-fullstack/examples/hook.example.ts +133 -0
  27. package/templates/agent-generator-fullstack/examples/screen.example.tsx +138 -0
  28. package/templates/agent-generator-fullstack/examples/screens/detail-screen.example.tsx +288 -0
  29. package/templates/agent-generator-fullstack/examples/screens/form-screen.example.tsx +368 -0
  30. package/templates/agent-generator-fullstack/examples/screens/list-screen-no-auth.example.tsx +195 -0
  31. package/templates/agent-generator-fullstack/examples/screens/list-screen-with-auth.example.tsx +251 -0
  32. package/templates/agent-generator-fullstack/examples/service.example.ts +152 -0
  33. package/templates/agent-generator-fullstack/examples/services/mockApi/resource-advanced.mock.example.ts +132 -0
  34. package/templates/agent-generator-fullstack/examples/services/mockApi/resource-basic.mock.example.ts +88 -0
  35. package/templates/agent-generator-fullstack/examples/services/offline-service.example.ts +259 -0
  36. package/templates/agent-generator-fullstack/examples/services/service-with-mock.example.ts +156 -0
  37. package/templates/agent-generator-fullstack/examples/services/service-without-mock.example.ts +121 -0
  38. package/templates/agent-generator-fullstack/examples/types/resource.types.example.ts +61 -0
  39. package/templates/agent-generator-fullstack/global.css +3 -0
  40. package/templates/agent-generator-fullstack/metro.config.js +9 -0
  41. package/templates/agent-generator-fullstack/nativewind-env.d.ts +3 -0
  42. package/templates/agent-generator-fullstack/package.json +112 -0
  43. package/templates/agent-generator-fullstack/server/db.json +40 -0
  44. package/templates/agent-generator-fullstack/src/assets/images/adaptive-icon.png +0 -0
  45. package/templates/agent-generator-fullstack/src/assets/images/favicon.png +0 -0
  46. package/templates/agent-generator-fullstack/src/assets/images/icon.png +0 -0
  47. package/templates/agent-generator-fullstack/src/assets/images/splash-icon.png +0 -0
  48. package/templates/agent-generator-fullstack/src/components/auth/ProtectedRoute.tsx +90 -0
  49. package/templates/agent-generator-fullstack/src/components/common/Button.tsx +99 -0
  50. package/templates/agent-generator-fullstack/src/components/common/Card.tsx +32 -0
  51. package/templates/agent-generator-fullstack/src/components/common/Input.tsx +78 -0
  52. package/templates/agent-generator-fullstack/src/components/common/Loading.tsx +41 -0
  53. package/templates/agent-generator-fullstack/src/components/config/ToastConfig.tsx +109 -0
  54. package/templates/agent-generator-fullstack/src/components/shared/ConfirmDialog.tsx +104 -0
  55. package/templates/agent-generator-fullstack/src/components/shared/FormInput.tsx +44 -0
  56. package/templates/agent-generator-fullstack/src/components/shared/LucideIcon.tsx +18 -0
  57. package/templates/agent-generator-fullstack/src/components/shared/RoleSelector.tsx +44 -0
  58. package/templates/agent-generator-fullstack/src/hooks/useAuth.ts +23 -0
  59. package/templates/agent-generator-fullstack/src/hooks/useTheme.ts +24 -0
  60. package/templates/agent-generator-fullstack/src/services/api.ts +97 -0
  61. package/templates/agent-generator-fullstack/src/services/authService.ts +45 -0
  62. package/templates/agent-generator-fullstack/src/services/mockApi/auth.mock.ts +89 -0
  63. package/templates/agent-generator-fullstack/src/services/mockApi/index.ts +53 -0
  64. package/templates/agent-generator-fullstack/src/services/mockApi/users.mock.ts +83 -0
  65. package/templates/agent-generator-fullstack/src/store/authStore.ts +45 -0
  66. package/templates/agent-generator-fullstack/src/store/themeStore.ts +26 -0
  67. package/templates/agent-generator-fullstack/src/theme/colors.ts +32 -0
  68. package/templates/agent-generator-fullstack/src/types/api.types.ts +28 -0
  69. package/templates/agent-generator-fullstack/src/types/auth.types.ts +38 -0
  70. package/templates/agent-generator-fullstack/src/types/user.types.ts +40 -0
  71. package/templates/agent-generator-fullstack/src/utils/constants.ts +48 -0
  72. package/templates/agent-generator-fullstack/src/utils/storage.ts +73 -0
  73. package/templates/agent-generator-fullstack/src/utils/validation.ts +54 -0
  74. package/templates/agent-generator-fullstack/tailwind.config.js +33 -0
  75. package/templates/agent-generator-fullstack/tsconfig.json +36 -0
  76. package/templates/starter-kit-news/.gitignore-template +80 -0
  77. package/templates/starter-kit-news/AI_GUIDE.md +233 -0
  78. package/templates/starter-kit-news/CHANGELOG.md +161 -0
  79. package/templates/starter-kit-news/CONVENTIONS.md +346 -0
  80. package/templates/starter-kit-news/CUSTOMIZATION.md +498 -0
  81. package/templates/starter-kit-news/PATTERNS.md +472 -0
  82. package/templates/starter-kit-news/README.md +402 -0
  83. package/templates/starter-kit-news/SERVER_GUIDE.md +726 -0
  84. package/templates/starter-kit-news/ai-context.json +23 -0
  85. package/templates/starter-kit-news/app/(auth)/_layout.tsx +17 -0
  86. package/templates/starter-kit-news/app/(auth)/login.tsx +87 -0
  87. package/templates/starter-kit-news/app/(auth)/register.tsx +100 -0
  88. package/templates/starter-kit-news/app/(tabs)/_layout.tsx +47 -0
  89. package/templates/starter-kit-news/app/(tabs)/index.tsx +172 -0
  90. package/templates/starter-kit-news/app/(tabs)/settings.tsx +71 -0
  91. package/templates/starter-kit-news/app/_layout.tsx +27 -0
  92. package/templates/starter-kit-news/app/news/[id].tsx +192 -0
  93. package/templates/starter-kit-news/app/news/_layout.tsx +26 -0
  94. package/templates/starter-kit-news/app.config.js +99 -0
  95. package/templates/starter-kit-news/app.plugins.js +17 -0
  96. package/templates/starter-kit-news/babel.config.js +30 -0
  97. package/templates/starter-kit-news/eas.json +54 -0
  98. package/templates/starter-kit-news/examples/apps/dashboard-with-auth/README.md +417 -0
  99. package/templates/starter-kit-news/examples/apps/news-no-auth/README.md +350 -0
  100. package/templates/starter-kit-news/examples/apps/todo-offline/README.md +197 -0
  101. package/templates/starter-kit-news/examples/component.example.tsx +90 -0
  102. package/templates/starter-kit-news/examples/hook.example.ts +133 -0
  103. package/templates/starter-kit-news/examples/screen.example.tsx +138 -0
  104. package/templates/starter-kit-news/examples/screens/detail-screen.example.tsx +288 -0
  105. package/templates/starter-kit-news/examples/screens/form-screen.example.tsx +368 -0
  106. package/templates/starter-kit-news/examples/screens/list-screen-no-auth.example.tsx +195 -0
  107. package/templates/starter-kit-news/examples/screens/list-screen-with-auth.example.tsx +251 -0
  108. package/templates/starter-kit-news/examples/service.example.ts +152 -0
  109. package/templates/starter-kit-news/examples/services/mockApi/resource-advanced.mock.example.ts +132 -0
  110. package/templates/starter-kit-news/examples/services/mockApi/resource-basic.mock.example.ts +88 -0
  111. package/templates/starter-kit-news/examples/services/offline-service.example.ts +259 -0
  112. package/templates/starter-kit-news/examples/services/service-with-mock.example.ts +156 -0
  113. package/templates/starter-kit-news/examples/services/service-without-mock.example.ts +121 -0
  114. package/templates/starter-kit-news/examples/types/resource.types.example.ts +61 -0
  115. package/templates/starter-kit-news/global.css +3 -0
  116. package/templates/starter-kit-news/metro.config.js +9 -0
  117. package/templates/starter-kit-news/nativewind-env.d.ts +3 -0
  118. package/templates/starter-kit-news/package.json +101 -0
  119. package/templates/starter-kit-news/server/db.json +138 -0
  120. package/templates/starter-kit-news/src/assets/images/adaptive-icon.png +0 -0
  121. package/templates/starter-kit-news/src/assets/images/favicon.png +0 -0
  122. package/templates/starter-kit-news/src/assets/images/icon.png +0 -0
  123. package/templates/starter-kit-news/src/assets/images/splash-icon.png +0 -0
  124. package/templates/starter-kit-news/src/components/auth/ProtectedRoute.tsx +90 -0
  125. package/templates/starter-kit-news/src/components/common/Button.tsx +99 -0
  126. package/templates/starter-kit-news/src/components/common/Card.tsx +32 -0
  127. package/templates/starter-kit-news/src/components/common/Input.tsx +78 -0
  128. package/templates/starter-kit-news/src/components/common/Loading.tsx +41 -0
  129. package/templates/starter-kit-news/src/components/config/ToastConfig.tsx +109 -0
  130. package/templates/starter-kit-news/src/components/shared/ConfirmDialog.tsx +104 -0
  131. package/templates/starter-kit-news/src/components/shared/FormInput.tsx +44 -0
  132. package/templates/starter-kit-news/src/components/shared/LucideIcon.tsx +18 -0
  133. package/templates/starter-kit-news/src/components/shared/RoleSelector.tsx +44 -0
  134. package/templates/starter-kit-news/src/hooks/useAuth.ts +23 -0
  135. package/templates/starter-kit-news/src/hooks/useTheme.ts +24 -0
  136. package/templates/starter-kit-news/src/services/api.ts +118 -0
  137. package/templates/starter-kit-news/src/services/authService.ts +49 -0
  138. package/templates/starter-kit-news/src/services/mockApi/auth.mock.ts +89 -0
  139. package/templates/starter-kit-news/src/services/mockApi/index.ts +65 -0
  140. package/templates/starter-kit-news/src/services/mockApi/news.mock.ts +75 -0
  141. package/templates/starter-kit-news/src/services/mockApi/users.mock.ts +83 -0
  142. package/templates/starter-kit-news/src/services/newsService.ts +101 -0
  143. package/templates/starter-kit-news/src/store/authStore.ts +125 -0
  144. package/templates/starter-kit-news/src/store/themeStore.ts +26 -0
  145. package/templates/starter-kit-news/src/theme/colors.ts +32 -0
  146. package/templates/starter-kit-news/src/types/api.types.ts +28 -0
  147. package/templates/starter-kit-news/src/types/auth.types.ts +38 -0
  148. package/templates/starter-kit-news/src/types/news.types.ts +37 -0
  149. package/templates/starter-kit-news/src/types/user.types.ts +40 -0
  150. package/templates/starter-kit-news/src/utils/constants.ts +48 -0
  151. package/templates/starter-kit-news/src/utils/storage.ts +73 -0
  152. package/templates/starter-kit-news/src/utils/validation.ts +54 -0
  153. package/templates/starter-kit-news/tailwind.config.js +33 -0
  154. package/templates/starter-kit-news/tsconfig.json +36 -0
  155. package/.claude/settings.local.json +0 -9
package/create.js CHANGED
@@ -102,14 +102,36 @@ async function main() {
102
102
  const spinner = ora(`📁 Copying template "${templateName}"...`).start();
103
103
 
104
104
  try {
105
- await fs.copy(templateDir, targetDir);
105
+ // Special handling for fullstack template
106
+ if (templateName === "agent-generator-fullstack") {
107
+ const frontendDir = path.join(targetDir, "frontend");
108
+ const backendDir = path.join(targetDir, "backend");
106
109
 
107
- // === Rename .gitignore-template → .gitignore ===
108
- const gitignoreTemplatePath = path.join(targetDir, ".gitignore-template");
109
- const gitignorePath = path.join(targetDir, ".gitignore");
110
+ // Create directories
111
+ await fs.ensureDir(frontendDir);
112
+ await fs.ensureDir(backendDir);
110
113
 
111
- if (await fs.pathExists(gitignoreTemplatePath)) {
112
- await fs.move(gitignoreTemplatePath, gitignorePath);
114
+ // Copy template to frontend/
115
+ await fs.copy(templateDir, frontendDir);
116
+
117
+ // Handle .gitignore-template in frontend/
118
+ const gitignoreTemplatePath = path.join(frontendDir, ".gitignore-template");
119
+ const gitignorePath = path.join(frontendDir, ".gitignore");
120
+
121
+ if (await fs.pathExists(gitignoreTemplatePath)) {
122
+ await fs.move(gitignoreTemplatePath, gitignorePath);
123
+ }
124
+ } else {
125
+ // Normal template copy
126
+ await fs.copy(templateDir, targetDir);
127
+
128
+ // === Rename .gitignore-template → .gitignore ===
129
+ const gitignoreTemplatePath = path.join(targetDir, ".gitignore-template");
130
+ const gitignorePath = path.join(targetDir, ".gitignore");
131
+
132
+ if (await fs.pathExists(gitignoreTemplatePath)) {
133
+ await fs.move(gitignoreTemplatePath, gitignorePath);
134
+ }
113
135
  }
114
136
 
115
137
 
@@ -125,7 +147,10 @@ async function main() {
125
147
  };
126
148
 
127
149
  // === Update package.json ===
128
- const pkgPath = path.join(targetDir, "package.json");
150
+ const pkgPath = templateName === "agent-generator-fullstack"
151
+ ? path.join(targetDir, "frontend", "package.json")
152
+ : path.join(targetDir, "package.json");
153
+
129
154
  if (fs.existsSync(pkgPath)) {
130
155
  const pkg = await fs.readJson(pkgPath);
131
156
  pkg.name = projectName.toLowerCase().replace(/\s+/g, "-");;
@@ -214,16 +239,51 @@ async function main() {
214
239
 
215
240
 
216
241
  // === Detect & update app.json OR app.config.js ===
217
- const appConfigJsPath = path.join(targetDir, "app.config.js");
242
+ const baseDir = templateName === "agent-generator-fullstack"
243
+ ? path.join(targetDir, "frontend")
244
+ : targetDir;
245
+
246
+ const appConfigJsPath = path.join(baseDir, "app.config.js");
218
247
 
219
248
  if (fs.existsSync(appConfigJsPath)) {
220
249
  // update dynamic config
221
250
  await updateAppConfigJs(appConfigJsPath, projectName);
222
251
  } else {
223
252
  // update JSON configs
224
- await updateAppJson("app.json");
225
- await updateAppJson("app.staging.json", "staging");
226
- await updateAppJson("app.prod.json", "production");
253
+ const updateAppJsonWithPath = async (file, env = null) => {
254
+ const filePath = path.join(baseDir, file);
255
+ if (!fs.existsSync(filePath)) return;
256
+
257
+ const json = await fs.readJson(filePath);
258
+
259
+ json.expo = json.expo || {};
260
+ json.expo.name = projectName;
261
+ json.expo.slug = projectName.toLowerCase().replace(/\s+/g, "-");
262
+
263
+ json.expo.ios = json.expo.ios || {};
264
+ json.expo.android = json.expo.android || {};
265
+
266
+ json.expo.ios.bundleIdentifier = `com.${projectName.toLowerCase()}.app`;
267
+ json.expo.android.package = `com.${projectName.toLowerCase()}.app`;
268
+
269
+ json.expo.scheme = projectName.toLowerCase();
270
+
271
+ if (json.expo.extra && json.expo.extra.eas) {
272
+ json.expo.extra.eas.projectId = "";
273
+ }
274
+
275
+ if (env) {
276
+ json.expo.extra = json.expo.extra || {};
277
+ json.expo.extra.ENV = env;
278
+ json.expo.extra.BASE_URL = "";
279
+ }
280
+
281
+ await fs.writeJson(filePath, json, { spaces: 2 });
282
+ };
283
+
284
+ await updateAppJsonWithPath("app.json");
285
+ await updateAppJsonWithPath("app.staging.json", "staging");
286
+ await updateAppJsonWithPath("app.prod.json", "production");
227
287
  }
228
288
 
229
289
  spinner.succeed(`✅ Template "${templateName}" has been created!`);
@@ -237,8 +297,15 @@ async function main() {
237
297
  if (autoInstall) {
238
298
  const installSpinner = ora("📦 Installing dependencies...").start();
239
299
  try {
240
- execSync("npm install", { cwd: targetDir, stdio: "inherit" });
241
- installSpinner.succeed("✅ Dependencies installed successfully!");
300
+ if (templateName === "agent-generator-fullstack") {
301
+ // Install frontend dependencies
302
+ const frontendPath = path.join(targetDir, "frontend");
303
+ execSync("npm install", { cwd: frontendPath, stdio: "inherit" });
304
+ installSpinner.succeed("✅ Frontend dependencies installed successfully!");
305
+ } else {
306
+ execSync("npm install", { cwd: targetDir, stdio: "inherit" });
307
+ installSpinner.succeed("✅ Dependencies installed successfully!");
308
+ }
242
309
  } catch (err) {
243
310
  installSpinner.fail("❌ Failed to install dependencies.");
244
311
  console.error(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ern-boilerplate",
3
- "version": "0.0.52",
3
+ "version": "0.0.54",
4
4
  "description": "Expo React Native boilerplate generator",
5
5
  "bin": {
6
6
  "create-ern-boilerplate": "./create.js",
@@ -0,0 +1,80 @@
1
+ # OSX
2
+ .DS_Store
3
+
4
+ # Xcode
5
+ build/
6
+ *.pbxuser
7
+ !default.pbxuser
8
+ *.mode1v3
9
+ !default.mode1v3
10
+ *.mode2v3
11
+ !default.mode2v3
12
+ *.perspectivev3
13
+ !default.perspectivev3
14
+ xcuserdata
15
+ *.xccheckout
16
+ *.moved-aside
17
+ DerivedData
18
+ *.hmap
19
+ *.ipa
20
+ *.xcuserstate
21
+ project.xcworkspace
22
+
23
+ # Android
24
+ *.iml
25
+ .gradle
26
+ /local.properties
27
+ /.idea/caches
28
+ /.idea/libraries
29
+ /.idea/modules.xml
30
+ /.idea/workspace.xml
31
+ /.idea/navEditor.xml
32
+ /.idea/assetWizardSettings.xml
33
+ .DS_Store
34
+ /build
35
+ /captures
36
+ .externalNativeBuild
37
+ .cxx
38
+
39
+ # Node
40
+ node_modules/
41
+ npm-debug.log
42
+ yarn-error.log
43
+
44
+ # Expo
45
+ .expo/
46
+ dist/
47
+ web-build/
48
+
49
+ # Environment
50
+ .env
51
+ .env.local
52
+ .env.development.local
53
+ .env.test.local
54
+ .env.production.local
55
+
56
+ # TypeScript
57
+ *.tsbuildinfo
58
+
59
+ # Metro
60
+ .metro-health-check*
61
+
62
+ # Debug
63
+ *.log*
64
+ # @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb
65
+ # The following patterns were generated by expo-cli
66
+
67
+ expo-env.d.ts
68
+ # @end expo-cli
69
+
70
+ # Other
71
+ structure.txt
72
+ .claude
73
+ examples
74
+ ai-context.json
75
+ AI_GUIDE.md
76
+ CONVENTIONS.md
77
+ GENERATE_RULES.md
78
+ SERVER_GUIDE.md
79
+ TEMPLATE_VARIANTS.md
80
+ CUSTOMIZATION.md
@@ -0,0 +1,233 @@
1
+ # AI Agent Guide
2
+
3
+ Quick start guide for AI agents working with this boilerplate.
4
+
5
+ ## 🚀 First Time Setup
6
+
7
+ When you first enter this project, read these files **in order**:
8
+
9
+ 1. **This file** (AI_GUIDE.md) - Quick start and navigation
10
+ 2. **`ai-context.json`** - Path mappings for code generation
11
+ 3. **`CUSTOMIZATION.md`** - Choose template variant for your app
12
+ 4. **`PATTERNS.md`** - Code generation rules and tech stack
13
+ 5. **`CONVENTIONS.md`** - Coding standards and best practices
14
+ 6. **`SERVER_GUIDE.md`** - Mock API and dummy data (if using API)
15
+ 7. **`examples/`** - Working code patterns
16
+
17
+ ## 📖 Documentation Map
18
+
19
+ Each file has a specific purpose:
20
+
21
+ | File | Purpose | When to Read |
22
+ |------|---------|--------------|
23
+ | **AI_GUIDE.md** | Navigation & quick start | First time in project |
24
+ | **ai-context.json** | Path mappings | When generating code |
25
+ | **CUSTOMIZATION.md** | Template variants | Choosing app architecture |
26
+ | **PATTERNS.md** | Tech stack & generation rules | Before writing code |
27
+ | **CONVENTIONS.md** | Coding standards | When writing code |
28
+ | **SERVER_GUIDE.md** | Mock API & dummy data | When adding data models |
29
+ | **examples/** | Working code patterns | Before implementing features |
30
+
31
+ ## 🚨 Critical Rules Summary
32
+
33
+ **Full details in respective files. This is just a quick reference.**
34
+
35
+ ### 🔴 MOST IMPORTANT: Mock API Default (See SERVER_GUIDE.md)
36
+
37
+ **ALWAYS use Mock API unless user EXPLICITLY requests otherwise!**
38
+
39
+ - ✅ **DEFAULT BEHAVIOR: Use Mock API** - Always create mock API for any feature
40
+ - ✅ Use `service-with-mock.example.ts` pattern for services
41
+ - ✅ Add 2-4 sample items to `server/db.json`
42
+ - ✅ Create mock API file in `src/services/mockApi/`
43
+ - ❌ **NEVER connect to real API** unless user explicitly says:
44
+ - "use real API"
45
+ - "connect to actual backend"
46
+ - "no mock, use production API"
47
+ - ❌ **NEVER skip mock API** for online features
48
+
49
+ **Exception: Only skip Mock API if user requests:**
50
+ 1. **Offline-only app** (use AsyncStorage - see `offline-service.example.ts`)
51
+ 2. **Explicit real API request** ("connect to real API", "use production backend")
52
+
53
+ ### Tech Stack (See PATTERNS.md)
54
+ - ⚠️ **NEVER add new dependencies** without permission
55
+ - ✅ Use only packages in package.json
56
+ - 📦 React 19.1.0, React Native 0.81.4, Expo SDK 54
57
+
58
+ ### Coding Standards (See CONVENTIONS.md)
59
+ - ✅ Use TypeScript with proper types
60
+ - ✅ Use path aliases `@/` not `../../`
61
+ - ✅ Support light/dark theme always
62
+ - ✅ Handle loading and error states
63
+
64
+ ## 🎯 Quick Decision Guide
65
+
66
+ ### Choose Your Template Variant
67
+
68
+ **See `CUSTOMIZATION.md` for full guide. Quick reference:**
69
+
70
+ ```
71
+ Does your app need user accounts?
72
+ ├─ NO
73
+ │ ├─ Need API? → NO → Variant: Offline (examples/apps/todo-offline/)
74
+ │ │ ✅ Use: offline-service.example.ts
75
+ │ │
76
+ │ └─ Need API? → YES → Variant: Public Content (examples/apps/news-no-auth/)
77
+ │ ✅ DEFAULT: Use Mock API with service-with-mock.example.ts
78
+ │ ❌ NEVER use real API unless user explicitly requests it
79
+
80
+ └─ YES
81
+ └─ Need API? → YES → Variant: Protected (examples/apps/dashboard-with-auth/)
82
+ ✅ DEFAULT: Use Mock API with service-with-mock.example.ts
83
+ ❌ NEVER use real API unless user explicitly requests it
84
+ ```
85
+
86
+ **🔴 IMPORTANT:** When user says "Need API", it means **Mock API by default**!
87
+
88
+ ### Choose Your Examples
89
+
90
+ **See `examples/` folder. Quick reference:**
91
+
92
+ #### Screen Patterns (`examples/screens/`)
93
+ - **Public list** → `list-screen-no-auth.example.tsx`
94
+ - **Protected list** → `list-screen-with-auth.example.tsx`
95
+ - **Forms** → `form-screen.example.tsx`
96
+ - **Detail pages** → `detail-screen.example.tsx`
97
+
98
+ #### Service Patterns (`examples/services/`)
99
+ - **✅ DEFAULT: API with mock** → `service-with-mock.example.ts` (Use this for any online feature)
100
+ - **❌ Direct API only** → `service-without-mock.example.ts` (Only if user explicitly requests real API)
101
+ - **Offline storage** → `offline-service.example.ts` (Only for offline-only apps)
102
+
103
+ #### Complete Apps (`examples/apps/`)
104
+ - **Offline app** → `todo-offline/README.md`
105
+ - **Public content** → `news-no-auth/README.md`
106
+ - **Protected dashboard** → `dashboard-with-auth/README.md`
107
+
108
+ ## 📋 Code Generation Workflow
109
+
110
+ **See `PATTERNS.md` for detailed patterns.**
111
+
112
+ ### Quick Steps:
113
+ 1. ✅ Understand user request
114
+ 2. ✅ **Determine API strategy:**
115
+ - **DEFAULT: Use Mock API** (unless explicitly told otherwise)
116
+ - Only use offline storage if user says "offline-only app"
117
+ - Only skip mock if user says "use real API" or "connect to actual backend"
118
+ 3. ✅ Check `examples/` for similar pattern
119
+ 4. ✅ Check `CUSTOMIZATION.md` for variant
120
+ 5. ✅ Create types in `src/types/`
121
+ 6. ✅ **Add sample data to `server/db.json`** (if using Mock API - which is DEFAULT)
122
+ 7. ✅ **Create mock API in `src/services/mockApi/`** (if using Mock API - which is DEFAULT)
123
+ 8. ✅ Create service in `src/services/` (use `service-with-mock.example.ts` pattern by DEFAULT)
124
+ 9. ✅ Create components in `src/components/`
125
+ 10. ✅ Create screens in `app/(tabs)/`
126
+ 11. ✅ Update navigation
127
+
128
+ ## 📁 File Locations
129
+
130
+ **See `ai-context.json` for complete mappings.**
131
+
132
+ Quick reference:
133
+ ```
134
+ app/(tabs)/ → Screens
135
+ src/components/ → Components
136
+ src/hooks/ → Custom hooks
137
+ src/services/ → API services
138
+ src/services/mockApi/ → Mock API implementations (auth, users only)
139
+ src/store/ → Zustand stores
140
+ src/types/ → TypeScript types
141
+ server/db.json → Mock data (users only by default)
142
+ examples/ → Code examples
143
+ examples/services/mockApi/ → Mock API pattern examples (basic & advanced CRUD)
144
+ examples/types/ → Type definition examples (generic resource types)
145
+ ```
146
+
147
+ ## ⚠️ Common Mistakes to Avoid
148
+
149
+ **Full list in `CONVENTIONS.md`. Quick reference:**
150
+
151
+ 1. ❌ **Don't skip Mock API** - Always use mock API by default for online features
152
+ 2. ❌ **Don't connect to real API** - Unless user explicitly requests it
153
+ 3. ❌ Don't add new dependencies
154
+ 4. ❌ Don't use relative imports (`../../`)
155
+ 5. ❌ Don't skip theme support
156
+ 6. ❌ Don't skip loading/error states
157
+ 7. ❌ Don't ignore examples - always check first!
158
+
159
+ ## 💡 Pro Tips
160
+
161
+ 1. **When in doubt, check examples/** - Don't reinvent patterns
162
+ 2. **Use ai-context.json** - All paths are there
163
+ 3. **Check CUSTOMIZATION.md first** - Choose right variant
164
+ 4. **Read PATTERNS.md** - Understand tech stack rules
165
+ 5. **Follow CONVENTIONS.md** - Consistent code style
166
+ 6. **Use SERVER_GUIDE.md** - When adding data models
167
+
168
+ ## 📞 Quick Commands
169
+
170
+ ```bash
171
+ # Read documentation in order
172
+ cat AI_GUIDE.md # ← Start here
173
+ cat ai-context.json # Path mappings
174
+ cat CUSTOMIZATION.md # Choose variant
175
+ cat PATTERNS.md # Generation rules
176
+ cat CONVENTIONS.md # Coding standards
177
+ cat SERVER_GUIDE.md # Mock API guide
178
+
179
+ # Check examples
180
+ ls examples/screens/ # Screen patterns
181
+ ls examples/services/ # Service patterns
182
+ ls examples/services/mockApi/ # Mock API pattern examples
183
+ ls examples/types/ # Type definition examples
184
+ ls examples/apps/ # Complete app examples
185
+
186
+ # Check current structure
187
+ cat server/db.json # Mock data (users only)
188
+ ls src/types/ # Type definitions (auth, user types)
189
+ ls src/services/mockApi/ # Active mock API files (auth, users)
190
+ ```
191
+
192
+ ## ✅ Success Checklist
193
+
194
+ Your generated code is good if:
195
+
196
+ - [ ] **Uses Mock API by default** (unless explicitly told to use real API or offline-only)
197
+ - [ ] Uses `service-with-mock.example.ts` pattern for services (DEFAULT)
198
+ - [ ] Dummy data (2-4 items) added to `server/db.json`
199
+ - [ ] Mock API file created in `src/services/mockApi/`
200
+ - [ ] Uses ONLY existing packages from package.json
201
+ - [ ] Follows examples/ patterns
202
+ - [ ] Uses TypeScript with proper types
203
+ - [ ] Uses path aliases (`@/`)
204
+ - [ ] Supports light/dark theme
205
+ - [ ] Handles loading/error states
206
+ - [ ] Uses NativeWind classes
207
+ - [ ] Follows naming conventions
208
+
209
+ ## 🎓 Learning Path
210
+
211
+ ### For News App:
212
+ 1. Read `CUSTOMIZATION.md` → Choose "Public Content" variant
213
+ 2. Read `examples/apps/news-no-auth/README.md`
214
+ 3. Follow `examples/screens/list-screen-no-auth.example.tsx`
215
+ 4. Follow `examples/services/service-with-mock.example.ts`
216
+
217
+ ### For Todo App:
218
+ 1. Read `CUSTOMIZATION.md` → Choose "Offline" variant
219
+ 2. Read `examples/apps/todo-offline/README.md`
220
+ 3. Follow `examples/services/offline-service.example.ts`
221
+
222
+ ### For Dashboard:
223
+ 1. Read `CUSTOMIZATION.md` → Keep "Protected" variant (default)
224
+ 2. Read `examples/apps/dashboard-with-auth/README.md`
225
+ 3. Follow `examples/screens/list-screen-with-auth.example.tsx`
226
+
227
+ ---
228
+
229
+ **Remember:**
230
+ - This file is your **navigation guide**
231
+ - For details, see the **specific documentation files**
232
+ - Always **check examples/** before generating code
233
+ - Keep it **simple** and follow existing patterns