@mr.dj2u/knowledge 0.1.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 (83) hide show
  1. package/dist/content/checklists/ship-test-loop.md +16 -0
  2. package/dist/content/checklists/unified-agent-bundle-validation.md +8 -0
  3. package/dist/content/examples/ship-test-loop.md +13 -0
  4. package/dist/content/examples/unified-agent-bundle-bootstrap.md +8 -0
  5. package/dist/content/guides/animation-performance.md +30 -0
  6. package/dist/content/guides/post-create-onboarding.md +113 -0
  7. package/dist/content/patterns/api/api-routes.md +314 -0
  8. package/dist/content/patterns/api/error-handling.md +311 -0
  9. package/dist/content/patterns/database/drizzle-schema.md +280 -0
  10. package/dist/content/patterns/database/migrations.md +365 -0
  11. package/dist/content/patterns/database/query-organization.md +537 -0
  12. package/dist/content/patterns/database/relations.md +450 -0
  13. package/dist/content/patterns/deployment/build-configuration.md +452 -0
  14. package/dist/content/patterns/deployment/ci-cd-patterns.md +448 -0
  15. package/dist/content/patterns/deployment/environment-config.md +380 -0
  16. package/dist/content/patterns/deployment/hosting-setup.md +425 -0
  17. package/dist/content/patterns/project/configuration-patterns.md +459 -0
  18. package/dist/content/patterns/project/documentation-org.md +506 -0
  19. package/dist/content/patterns/project/folder-structure.md +398 -0
  20. package/dist/content/patterns/project/library-exports.md +465 -0
  21. package/dist/content/patterns/project/monorepo-structure.md +500 -0
  22. package/dist/content/patterns/routing/dynamic-routes.md +221 -0
  23. package/dist/content/patterns/routing/file-based-routing.md +186 -0
  24. package/dist/content/patterns/routing/route-groups.md +429 -0
  25. package/dist/content/patterns/state/persistence-middleware.md +521 -0
  26. package/dist/content/patterns/state/selector-hooks.md +538 -0
  27. package/dist/content/patterns/state/store-organization.md +539 -0
  28. package/dist/content/patterns/state/zustand-patterns.md +348 -0
  29. package/dist/content/patterns/styling/component-styling.md +468 -0
  30. package/dist/content/patterns/styling/responsive-patterns.md +398 -0
  31. package/dist/content/patterns/styling/theme-configuration.md +426 -0
  32. package/dist/content/patterns/styling/uniwind-setup.md +412 -0
  33. package/dist/content/prompts/continue-development.md +27 -0
  34. package/dist/content/prompts/create-expo-super-stack.md +29 -0
  35. package/dist/content/prompts/fix-seo.md +29 -0
  36. package/dist/content/prompts/onboard-new-expo-app.md +11 -0
  37. package/dist/content/prompts/prepare-deploy.md +29 -0
  38. package/dist/content/prompts/project-research-plan.md +29 -0
  39. package/dist/content/prompts/review-expo-project.md +29 -0
  40. package/dist/content/prompts/run-doctor.md +30 -0
  41. package/dist/content/prompts/ship-test-loop.md +24 -0
  42. package/dist/content/reference/create-expo-stack-uniwind.md +29 -0
  43. package/dist/content/reference/doctor-dogfood.md +42 -0
  44. package/dist/content/reference/mcp-sdk-transport.md +30 -0
  45. package/dist/content/reference/package-ci-patterns.md +24 -0
  46. package/dist/content/reference/reference-repo-evacuation.md +31 -0
  47. package/dist/content/resource-index.json +67 -0
  48. package/dist/content/rules/app-folder-architecture.md +13 -0
  49. package/dist/content/rules/env-hygiene.md +9 -0
  50. package/dist/content/rules/seo-metadata.md +7 -0
  51. package/dist/content/rules/ssr-safety.md +9 -0
  52. package/dist/content/skills/api-routes.md +33 -0
  53. package/dist/content/skills/continue-development.md +31 -0
  54. package/dist/content/skills/debugging.md +31 -0
  55. package/dist/content/skills/deployment.md +32 -0
  56. package/dist/content/skills/dev-server-management.md +31 -0
  57. package/dist/content/skills/env-vars.md +32 -0
  58. package/dist/content/skills/expo-router-architecture.md +33 -0
  59. package/dist/content/skills/expo-ssr-safety.md +32 -0
  60. package/dist/content/skills/plugin-creation.md +41 -0
  61. package/dist/content/skills/production-server-patterns.md +31 -0
  62. package/dist/content/skills/project-onboarding.md +31 -0
  63. package/dist/content/skills/research-plan-intake.md +31 -0
  64. package/dist/content/skills/seo-metadata.md +31 -0
  65. package/dist/content/skills/super-stack-startup.md +31 -0
  66. package/dist/content/skills/uniwind-theming.md +32 -0
  67. package/dist/index.d.ts +46 -0
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +369 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/patterns/index.d.ts +78 -0
  72. package/dist/patterns/index.d.ts.map +1 -0
  73. package/dist/patterns/index.js +264 -0
  74. package/dist/patterns/index.js.map +1 -0
  75. package/dist/prompts/index.d.ts +35 -0
  76. package/dist/prompts/index.d.ts.map +1 -0
  77. package/dist/prompts/index.js +270 -0
  78. package/dist/prompts/index.js.map +1 -0
  79. package/dist/skills/index.d.ts +3 -0
  80. package/dist/skills/index.d.ts.map +1 -0
  81. package/dist/skills/index.js +2 -0
  82. package/dist/skills/index.js.map +1 -0
  83. package/package.json +50 -0
@@ -0,0 +1,398 @@
1
+ # Project Folder Structure Pattern
2
+
3
+ ## Description
4
+
5
+ Project folder structure establishes a consistent, scalable organization for single-package Expo apps and feature-based libraries. This pattern balances discoverability with maintainability, grouping related functionality while keeping the root shallow and navigable.
6
+
7
+ ## When to Use
8
+
9
+ **Organize project folders when:**
10
+ - ✅ Setting up a new Expo app
11
+ - ✅ Scaling from prototype to production
12
+ - ✅ Adding new features or modules
13
+ - ✅ Sharing code across platforms (web/native)
14
+ - ✅ Building reusable component libraries
15
+ - ✅ Organizing API routes and services
16
+
17
+ ## Core Concepts
18
+
19
+ **Folder Strategy:**
20
+ - Root-level shallow (max 10-15 entries)
21
+ - Feature-driven organization within `src/`
22
+ - Shared utilities isolated from business logic
23
+ - Platform-specific code colocated with shared code
24
+
25
+ ## Code Examples
26
+
27
+ ### Recommended Folder Structure
28
+
29
+ ```
30
+ project-root/
31
+ ├── src/
32
+ │ ├── app/ # Expo Router routes (file-based)
33
+ │ │ ├── _layout.tsx # Root layout, providers
34
+ │ │ ├── +html.tsx # Custom HTML (web)
35
+ │ │ ├── +not-found.tsx # 404 route
36
+ │ │ ├── index.tsx # Home page
37
+ │ │ ├── (drawer)/ # Drawer navigation group
38
+ │ │ │ ├── _layout.tsx # Drawer layout
39
+ │ │ │ ├── (tabs)/ # Tab navigation
40
+ │ │ │ │ ├── _layout.tsx
41
+ │ │ │ │ ├── index.tsx # Home tab
42
+ │ │ │ │ └── profile.tsx
43
+ │ │ │ └── settings.tsx
44
+ │ │ ├── auth/
45
+ │ │ │ ├── sign-in.tsx
46
+ │ │ │ └── sign-up.tsx
47
+ │ │ └── api/
48
+ │ │ └── +api.ts # API routes
49
+ │ │
50
+ │ ├── components/ # Reusable UI components
51
+ │ │ ├── Animation/ # Animated components
52
+ │ │ ├── Auth/ # Auth-related components
53
+ │ │ ├── Cards/ # Card variants
54
+ │ │ ├── Forms/ # Form components
55
+ │ │ ├── Lists/ # List components
56
+ │ │ ├── Navigation/ # Nav components
57
+ │ │ ├── Text/ # Text variants
58
+ │ │ └── UI/ # Generic UI (Button, Modal, etc.)
59
+ │ │
60
+ │ ├── features/ # Feature-specific business logic
61
+ │ │ ├── auth/
62
+ │ │ │ ├── hooks/ # useAuth, useLogin
63
+ │ │ │ ├── services/ # Auth service
64
+ │ │ │ ├── types.ts # Auth types
65
+ │ │ │ └── index.ts # Barrel export
66
+ │ │ │
67
+ │ │ ├── posts/
68
+ │ │ │ ├── hooks/ # usePost, usePosts
69
+ │ │ │ ├── services/ # Post API service
70
+ │ │ │ ├── store.ts # Zustand store
71
+ │ │ │ ├── types.ts
72
+ │ │ │ └── index.ts
73
+ │ │ │
74
+ │ │ └── social/
75
+ │ │ ├── hooks/
76
+ │ │ ├── services/
77
+ │ │ ├── store.ts
78
+ │ │ └── index.ts
79
+ │ │
80
+ │ ├── hooks/ # Shared custom hooks
81
+ │ │ ├── useApi.ts
82
+ │ │ ├── useForm.ts
83
+ │ │ ├── useLocalStorage.ts
84
+ │ │ ├── useTheme.ts
85
+ │ │ └── index.ts
86
+ │ │
87
+ │ ├── services/ # Shared services
88
+ │ │ ├── api.ts # API client
89
+ │ │ ├── storage.ts # Storage abstraction
90
+ │ │ ├── auth.ts # Auth service
91
+ │ │ └── index.ts
92
+ │ │
93
+ │ ├── store/ # Global state (Zustand)
94
+ │ │ ├── authStore.ts
95
+ │ │ ├── settingsStore.ts
96
+ │ │ └── index.ts
97
+ │ │
98
+ │ ├── utils/ # Utility functions
99
+ │ │ ├── formatting.ts # Date, number formatting
100
+ │ │ ├── validators.ts # Input validation
101
+ │ │ ├── helpers.ts # Generic helpers
102
+ │ │ └── index.ts
103
+ │ │
104
+ │ ├── constants/ # App constants
105
+ │ │ ├── theme.ts # Colors, spacing, typography
106
+ │ │ ├── errors.ts # Error messages
107
+ │ │ └── index.ts
108
+ │ │
109
+ │ ├── types/ # TypeScript types
110
+ │ │ ├── api.ts # API types
111
+ │ │ ├── domain.ts # Business domain types
112
+ │ │ └── index.ts
113
+ │ │
114
+ │ └── context/ # React Context (if needed)
115
+ │ ├── ThemeContext.tsx
116
+ │ └── MapContext.tsx
117
+
118
+ ├── public/ # Static assets
119
+ │ ├── icons/ # App icons, favicons
120
+ │ ├── images/ # Static images
121
+ │ ├── manifest.webmanifest # PWA manifest
122
+ │ └── sw.js # Service worker
123
+
124
+ ├── project/ # Project metadata & docs
125
+ │ ├── info.md # Project description
126
+ │ ├── style.md # Design system
127
+ │ ├── todo.md # Roadmap
128
+ │ └── architecture.md # Architecture decisions
129
+
130
+ ├── .env.example # Environment template
131
+ ├── app.json # Expo config
132
+ ├── app.config.js # Dynamic Expo config
133
+ ├── babel.config.js # Babel presets
134
+ ├── metro.config.js # Metro bundler config
135
+ ├── tailwind.config.js # Tailwind config
136
+ ├── tsconfig.json # TypeScript config
137
+ ├── package.json # Dependencies
138
+ └── README.md # Getting started
139
+ ```
140
+
141
+ ### Alternative: Feature-Based (Monorepo App)
142
+
143
+ ```
144
+ apps/my-app/
145
+ ├── src/
146
+ │ ├── app/ # Routes (same as above)
147
+ │ ├── features/
148
+ │ │ ├── auth/
149
+ │ │ ├── posts/
150
+ │ │ └── social/
151
+ │ ├── shared/ # Shared across features
152
+ │ │ ├── hooks/
153
+ │ │ ├── services/
154
+ │ │ ├── ui/ # Design system
155
+ │ │ └── utils/
156
+ │ └── core/ # App core
157
+ │ ├── store/
158
+ │ ├── context/
159
+ │ └── constants/
160
+ ├── public/
161
+ ├── project/
162
+ └── package.json
163
+ ```
164
+
165
+ ### Platform-Specific Code Organization
166
+
167
+ ```
168
+ src/components/
169
+ ├── Button/
170
+ │ ├── Button.tsx # Shared implementation
171
+ │ ├── Button.web.tsx # Web overrides
172
+ │ ├── Button.native.tsx # iOS/Android overrides
173
+ │ ├── Button.ios.tsx # iOS-specific
174
+ │ ├── Button.android.tsx # Android-specific
175
+ │ └── index.ts
176
+
177
+ └── ThemedText/
178
+ ├── ThemedText.tsx # Default
179
+ ├── ThemedText.web.tsx # Web-specific
180
+ └── index.ts
181
+ ```
182
+
183
+ ### Barrel Exports (index.ts Pattern)
184
+
185
+ ```typescript
186
+ // File: src/components/index.ts
187
+ export * from './Animation';
188
+ export * from './Cards';
189
+ export * from './Forms';
190
+ export * from './UI';
191
+
192
+ // File: src/features/index.ts
193
+ export * as auth from './auth';
194
+ export * as posts from './posts';
195
+ export * as social from './social';
196
+
197
+ // File: src/index.ts
198
+ export * from './components';
199
+ export * from './features';
200
+ export * from './hooks';
201
+ export * from './services';
202
+ export * from './store';
203
+ export * from './utils';
204
+ ```
205
+
206
+ ### Service Organization
207
+
208
+ ```typescript
209
+ // File: src/services/api.ts
210
+ const API_BASE_URL = process.env.EXPO_PUBLIC_API_URL;
211
+
212
+ export const api = {
213
+ users: {
214
+ getAll: () => fetch(`${API_BASE_URL}/users`),
215
+ getById: (id: string) => fetch(`${API_BASE_URL}/users/${id}`),
216
+ create: (data: any) => post(`${API_BASE_URL}/users`, data),
217
+ update: (id: string, data: any) => put(`${API_BASE_URL}/users/${id}`, data),
218
+ delete: (id: string) => delete_(`${API_BASE_URL}/users/${id}`),
219
+ },
220
+
221
+ posts: {
222
+ getAll: () => fetch(`${API_BASE_URL}/posts`),
223
+ create: (data: any) => post(`${API_BASE_URL}/posts`, data),
224
+ },
225
+ };
226
+
227
+ // File: src/features/auth/services/index.ts
228
+ import { api } from '@/services';
229
+
230
+ export const authService = {
231
+ signIn: (email: string, password: string) => {
232
+ return api.post('/auth/sign-in', { email, password });
233
+ },
234
+
235
+ signUp: (email: string, password: string) => {
236
+ return api.post('/auth/sign-up', { email, password });
237
+ },
238
+ };
239
+ ```
240
+
241
+ ### Hook Organization
242
+
243
+ ```typescript
244
+ // File: src/features/posts/hooks/usePosts.ts
245
+ import { useEffect, useState } from 'react';
246
+ import { api } from '@/services';
247
+
248
+ export function usePosts() {
249
+ const [posts, setPosts] = useState([]);
250
+ const [loading, setLoading] = useState(false);
251
+ const [error, setError] = useState(null);
252
+
253
+ useEffect(() => {
254
+ setLoading(true);
255
+ api.posts.getAll()
256
+ .then(setPosts)
257
+ .catch(setError)
258
+ .finally(() => setLoading(false));
259
+ }, []);
260
+
261
+ return { posts, loading, error };
262
+ }
263
+
264
+ // File: src/hooks/useApi.ts - Shared API hook
265
+ export function useApi(url: string, options = {}) {
266
+ const [data, setData] = useState(null);
267
+ const [loading, setLoading] = useState(true);
268
+ const [error, setError] = useState(null);
269
+
270
+ useEffect(() => {
271
+ fetch(url, options)
272
+ .then(r => r.json())
273
+ .then(setData)
274
+ .catch(setError)
275
+ .finally(() => setLoading(false));
276
+ }, [url]);
277
+
278
+ return { data, loading, error };
279
+ }
280
+ ```
281
+
282
+ ### Constants Organization
283
+
284
+ ```typescript
285
+ // File: src/constants/theme.ts
286
+ export const colors = {
287
+ primary: '#007AFF',
288
+ secondary: '#5AC8FA',
289
+ error: '#FF3B30',
290
+ success: '#34C759',
291
+
292
+ light: {
293
+ background: '#FFFFFF',
294
+ text: '#000000',
295
+ },
296
+
297
+ dark: {
298
+ background: '#000000',
299
+ text: '#FFFFFF',
300
+ },
301
+ };
302
+
303
+ export const spacing = {
304
+ xs: 4,
305
+ sm: 8,
306
+ md: 16,
307
+ lg: 24,
308
+ xl: 32,
309
+ };
310
+
311
+ // File: src/constants/errors.ts
312
+ export const ERROR_MESSAGES = {
313
+ NETWORK_ERROR: 'Network connection failed',
314
+ UNAUTHORIZED: 'Not authorized',
315
+ NOT_FOUND: 'Resource not found',
316
+ };
317
+ ```
318
+
319
+ ## Folder Organization Best Practices
320
+
321
+ ### ✅ DO
322
+
323
+ 1. **Keep root-level shallow**
324
+ ```
325
+ src/
326
+ ├── app/
327
+ ├── components/
328
+ ├── features/
329
+ ├── hooks/
330
+ ├── services/
331
+ └── utils/
332
+ ```
333
+
334
+ 2. **Use feature-based organization**
335
+ ```
336
+ features/auth/hooks/
337
+ features/posts/services/
338
+ ```
339
+
340
+ 3. **Colocate platform-specific code**
341
+ ```
342
+ components/Button.tsx
343
+ components/Button.web.tsx
344
+ components/Button.native.tsx
345
+ ```
346
+
347
+ 4. **Use barrel exports (index.ts)**
348
+ ```typescript
349
+ // src/features/auth/index.ts
350
+ export * from './hooks';
351
+ export * from './services';
352
+ export * from './store';
353
+ ```
354
+
355
+ ### ❌ DON'T
356
+
357
+ 1. **Don't mix routes with screens**
358
+ ```
359
+ // ❌ WRONG
360
+ app/ProfileScreen.tsx // Route = screen
361
+
362
+ // ✅ RIGHT
363
+ app/profile.tsx // Route file
364
+ components/ProfileScreen.tsx // Screen component
365
+ ```
366
+
367
+ 2. **Don't nest too deeply**
368
+ ```
369
+ // ❌ WRONG - 6 levels deep
370
+ src/features/posts/screens/components/ui/Button.tsx
371
+
372
+ // ✅ RIGHT - 3 levels
373
+ src/components/Button.tsx
374
+ ```
375
+
376
+ 3. **Don't scatter related code**
377
+ ```
378
+ // ❌ WRONG - Auth scattered
379
+ hooks/useAuth.ts
380
+ services/auth.ts
381
+ store/authStore.ts
382
+
383
+ // ✅ RIGHT - Grouped
384
+ features/auth/hooks/
385
+ features/auth/services/
386
+ features/auth/store.ts
387
+ ```
388
+
389
+ ## Related Patterns
390
+
391
+ - [Documentation Organization](./documentation-org.md) — Docs structure
392
+ - [Configuration Patterns](./configuration-patterns.md) — Config files
393
+ - [Monorepo Structure](./monorepo-structure.md) — Multi-package repos
394
+
395
+ ---
396
+
397
+ *Pattern extracted from production repositories: DJsPortfolio, not-hot-dog, core-monorepo*
398
+ *Examples: app/ structure, features/ organization, src/ layout*