@adlas/create-app 1.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.
- package/README.md +476 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +39 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/figma.d.ts +16 -0
- package/dist/commands/figma.d.ts.map +1 -0
- package/dist/commands/figma.js +172 -0
- package/dist/commands/figma.js.map +1 -0
- package/dist/commands/index.d.ts +5 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +5 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +8 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +1471 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/swagger.d.ts +16 -0
- package/dist/commands/swagger.d.ts.map +1 -0
- package/dist/commands/swagger.js +404 -0
- package/dist/commands/swagger.js.map +1 -0
- package/dist/commands/update.d.ts +15 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +93 -0
- package/dist/commands/update.js.map +1 -0
- package/package.json +63 -0
- package/templates/.vscode/extensions.json +9 -0
- package/templates/.vscode/launch.json +26 -0
- package/templates/.vscode/settings.json +67 -0
- package/templates/.vscode/tasks.json +21 -0
- package/templates/boilerplate/config/fonts.ts +10 -0
- package/templates/boilerplate/config/navigationUrls.ts +47 -0
- package/templates/boilerplate/config/site.ts +96 -0
- package/templates/boilerplate/libs/I18n.ts +15 -0
- package/templates/boilerplate/libs/I18nNavigation.ts +5 -0
- package/templates/boilerplate/libs/I18nRouting.ts +9 -0
- package/templates/boilerplate/libs/env.ts +21 -0
- package/templates/boilerplate/libs/react-query/ReactQueryProvider.tsx +21 -0
- package/templates/boilerplate/libs/react-query/index.ts +2 -0
- package/templates/boilerplate/libs/react-query/queryClient.ts +62 -0
- package/templates/boilerplate/libs/react-query/queryKeys.ts +5 -0
- package/templates/boilerplate/public/images/index.ts +1 -0
- package/templates/boilerplate/reset.d.ts +2 -0
- package/templates/boilerplate/styles/globals.css +308 -0
- package/templates/boilerplate/types/i18n.ts +10 -0
- package/templates/boilerplate/types/locale.ts +8 -0
- package/templates/boilerplate/utils/file/fileConfig.ts +123 -0
- package/templates/boilerplate/utils/file/fileValidation.ts +78 -0
- package/templates/boilerplate/utils/file/imageCompression.ts +182 -0
- package/templates/boilerplate/utils/file/index.ts +3 -0
- package/templates/boilerplate/utils/helpers.ts +55 -0
- package/templates/boilerplate/validations/auth.validation.ts +92 -0
- package/templates/boilerplate/validations/commonValidations.ts +258 -0
- package/templates/boilerplate/validations/zodErrorMap.ts +101 -0
- package/templates/configs/.env.example +8 -0
- package/templates/configs/.prettierignore +23 -0
- package/templates/configs/.prettierrc.cjs +26 -0
- package/templates/configs/.prettierrc.icons.cjs +11 -0
- package/templates/configs/Dockerfile +6 -0
- package/templates/configs/commitlint.config.ts +8 -0
- package/templates/configs/eslint.config.mjs +119 -0
- package/templates/configs/knip.config.ts +32 -0
- package/templates/configs/lefthook.yml +42 -0
- package/templates/configs/lint-staged.config.js +8 -0
- package/templates/configs/next.config.template.ts +77 -0
- package/templates/configs/next.config.ts +43 -0
- package/templates/configs/package.json +75 -0
- package/templates/configs/postcss.config.mjs +15 -0
- package/templates/configs/svgr.config.mjs +129 -0
- package/templates/configs/tsconfig.json +75 -0
- package/templates/docs/AI_QUICK_REFERENCE.md +379 -0
- package/templates/docs/ARCHITECTURE_PATTERNS.md +927 -0
- package/templates/docs/DOCUMENTATION_INDEX.md +411 -0
- package/templates/docs/FIGMA_TO_CODE_GUIDE.md +768 -0
- package/templates/docs/IMPLEMENTATION_GUIDE.md +892 -0
- package/templates/docs/PROJECT_OVERVIEW.md +302 -0
- package/templates/docs/REFACTOR_PROGRESS.md +1113 -0
- package/templates/docs/SHADCN_TO_HEROUI_MIGRATION.md +1375 -0
- package/templates/docs/UI_COMPONENTS_GUIDE.md +893 -0
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
# AI Quick Reference Guide
|
|
2
|
+
|
|
3
|
+
This is your go-to reference for implementing features in the Berndorf e-commerce project. Use this guide to quickly understand the critical rules, available components, and common patterns.
|
|
4
|
+
|
|
5
|
+
## Critical Rules
|
|
6
|
+
|
|
7
|
+
### DO
|
|
8
|
+
|
|
9
|
+
- **ALWAYS use existing UI components** from `/src/components/ui/`
|
|
10
|
+
- **ALWAYS use existing element components** from `/src/components/elements/`
|
|
11
|
+
- **ALWAYS follow the service module pattern** for new features
|
|
12
|
+
- **ALWAYS use react-hook-form** for forms
|
|
13
|
+
- **ALWAYS use Zod** for validation
|
|
14
|
+
- **ALWAYS use Zustand** for global state
|
|
15
|
+
- **ALWAYS use React Query** (@tanstack/react-query) for data fetching
|
|
16
|
+
- **ALWAYS use next-intl** for translations (English: `en.json`, German: `de.json`)
|
|
17
|
+
- **ALWAYS use HeroUI components** as the base for UI
|
|
18
|
+
- **ALWAYS use Tailwind CSS** for styling
|
|
19
|
+
- **ALWAYS check existing patterns** before implementing new features
|
|
20
|
+
|
|
21
|
+
### DON'T
|
|
22
|
+
|
|
23
|
+
- **NEVER install new UI libraries** (we use HeroUI)
|
|
24
|
+
- **NEVER install new state management libraries** (we use Zustand)
|
|
25
|
+
- **NEVER install new form libraries** (we use react-hook-form)
|
|
26
|
+
- **NEVER install new validation libraries** (we use Zod)
|
|
27
|
+
- **NEVER create custom UI components** if HeroUI provides them
|
|
28
|
+
- **NEVER use inline styles** (use Tailwind classes)
|
|
29
|
+
- **NEVER hardcode strings** (use translations)
|
|
30
|
+
- **NEVER fetch data without React Query**
|
|
31
|
+
- **NEVER create global state without Zustand**
|
|
32
|
+
|
|
33
|
+
## Available UI Components
|
|
34
|
+
|
|
35
|
+
All components are from **HeroUI** and extended in `/src/components/ui/`:
|
|
36
|
+
|
|
37
|
+
### Form Components
|
|
38
|
+
- **Input** - Text input with label placement outside
|
|
39
|
+
- **PasswordInput** - Password field with show/hide toggle
|
|
40
|
+
- **Textarea** - Multi-line text input
|
|
41
|
+
- **Select** - Dropdown selection
|
|
42
|
+
- **Autocomplete** - Searchable dropdown
|
|
43
|
+
- **Checkbox** - Single checkbox
|
|
44
|
+
- **RadioGroup** - Radio button group
|
|
45
|
+
- **NumberInput** - Numeric input
|
|
46
|
+
- **FileInput** - File upload
|
|
47
|
+
- **DocumentUpload** - Document upload with validation
|
|
48
|
+
- **DatePicker** - Date selection
|
|
49
|
+
|
|
50
|
+
### Display Components
|
|
51
|
+
- **Button** - Action button with variants
|
|
52
|
+
- **Chip** - Small badge/tag
|
|
53
|
+
- **Modal** - Dialog/popup
|
|
54
|
+
- **Tabs** - Tab navigation
|
|
55
|
+
- **Breadcrumbs** - Breadcrumb navigation
|
|
56
|
+
- **Carousel** - Image/content carousel
|
|
57
|
+
- **Icon** - Icon component
|
|
58
|
+
|
|
59
|
+
### Form System
|
|
60
|
+
- **Form** - Form wrapper with validation
|
|
61
|
+
- **FormItem** - Individual form field wrapper
|
|
62
|
+
- **FormGenerator** - Dynamic form generation
|
|
63
|
+
|
|
64
|
+
## Code Templates
|
|
65
|
+
|
|
66
|
+
### 1. Service Module Structure
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// src/services/[feature]/index.ts
|
|
70
|
+
export * from './api/[feature].api';
|
|
71
|
+
export * from './queries/[feature].queries';
|
|
72
|
+
export * from './hooks/use[Feature]';
|
|
73
|
+
export * from './types/[feature].types';
|
|
74
|
+
export * from './actions/[feature].actions';
|
|
75
|
+
export * from './store/[feature].store';
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 2. API Client
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
// src/services/[feature]/api/[feature].api.ts
|
|
82
|
+
import { apiRequest } from '@/lib/apiRequest';
|
|
83
|
+
import type { FeatureResponse } from '../types/[feature].types';
|
|
84
|
+
|
|
85
|
+
export async function getFeatureData(): Promise<FeatureResponse> {
|
|
86
|
+
const response = await apiRequest<FeatureResponse>({
|
|
87
|
+
url: '/api/feature',
|
|
88
|
+
method: 'GET',
|
|
89
|
+
});
|
|
90
|
+
return response;
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 3. React Query Hook
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
// src/services/[feature]/queries/[feature].queries.ts
|
|
98
|
+
import { useQuery } from '@tanstack/react-query';
|
|
99
|
+
import { getFeatureData } from '../api/[feature].api';
|
|
100
|
+
|
|
101
|
+
export function useFeatureQuery() {
|
|
102
|
+
return useQuery({
|
|
103
|
+
queryKey: ['feature'],
|
|
104
|
+
queryFn: getFeatureData,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 4. Zustand Store
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
// src/services/[feature]/store/[feature].store.ts
|
|
113
|
+
import { create } from 'zustand';
|
|
114
|
+
|
|
115
|
+
interface FeatureStore {
|
|
116
|
+
data: string | null;
|
|
117
|
+
setData: (data: string) => void;
|
|
118
|
+
reset: () => void;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const useFeatureStore = create<FeatureStore>((set) => ({
|
|
122
|
+
data: null,
|
|
123
|
+
setData: (data) => set({ data }),
|
|
124
|
+
reset: () => set({ data: null }),
|
|
125
|
+
}));
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 5. Form with Validation
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
// Component with form
|
|
132
|
+
'use client';
|
|
133
|
+
import { useForm } from 'react-hook-form';
|
|
134
|
+
import { z } from 'zod';
|
|
135
|
+
import { Form } from '@/components/ui/form/Form';
|
|
136
|
+
import { Input } from '@/components/ui/Input';
|
|
137
|
+
import { Button } from '@/components/ui/Button';
|
|
138
|
+
|
|
139
|
+
const schema = z.object({
|
|
140
|
+
email: z.string().email('Errors.validation.email'),
|
|
141
|
+
name: z.string().min(1, 'Errors.validation.required'),
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
type FormData = z.infer<typeof schema>;
|
|
145
|
+
|
|
146
|
+
export function MyForm() {
|
|
147
|
+
const form = useForm<FormData>({
|
|
148
|
+
resolver: zodResolver(schema),
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
const onSubmit = (data: FormData) => {
|
|
152
|
+
console.log(data);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
return (
|
|
156
|
+
<Form form={form} validationSchema={schema}>
|
|
157
|
+
<Form.Item name="email">
|
|
158
|
+
{(props) => <Input {...props} label="Email" />}
|
|
159
|
+
</Form.Item>
|
|
160
|
+
<Form.Item name="name">
|
|
161
|
+
{(props) => <Input {...props} label="Name" />}
|
|
162
|
+
</Form.Item>
|
|
163
|
+
<Button onPress={form.handleSubmit(onSubmit)}>Submit</Button>
|
|
164
|
+
</Form>
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### 6. Server Action
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
// src/services/[feature]/actions/[feature].actions.ts
|
|
173
|
+
'use server';
|
|
174
|
+
import { cookies } from 'next/headers';
|
|
175
|
+
|
|
176
|
+
export async function featureAction(data: FormData) {
|
|
177
|
+
try {
|
|
178
|
+
const response = await fetch('https://api.example.com/feature', {
|
|
179
|
+
method: 'POST',
|
|
180
|
+
body: JSON.stringify(data),
|
|
181
|
+
headers: {
|
|
182
|
+
'Content-Type': 'application/json',
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
if (!response.ok) {
|
|
187
|
+
return { success: false, error: 'Action failed' };
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return { success: true };
|
|
191
|
+
} catch (error) {
|
|
192
|
+
return { success: false, error: 'Unexpected error' };
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### 7. Translation Usage
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
// In a client component
|
|
201
|
+
'use client';
|
|
202
|
+
import { useTranslations } from 'next-intl';
|
|
203
|
+
|
|
204
|
+
export function MyComponent() {
|
|
205
|
+
const t = useTranslations('MyNamespace');
|
|
206
|
+
|
|
207
|
+
return <h1>{t('title')}</h1>;
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Add to `/src/locales/en.json`:
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"MyNamespace": {
|
|
215
|
+
"title": "My Title"
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Styling Quick Reference
|
|
221
|
+
|
|
222
|
+
### Tailwind CSS Classes
|
|
223
|
+
|
|
224
|
+
```tsx
|
|
225
|
+
// Layout
|
|
226
|
+
className="flex flex-col gap-4"
|
|
227
|
+
className="grid grid-cols-2 gap-6"
|
|
228
|
+
className="container mx-auto px-4"
|
|
229
|
+
|
|
230
|
+
// Spacing
|
|
231
|
+
className="p-4 m-4" // padding & margin
|
|
232
|
+
className="px-6 py-4" // horizontal & vertical
|
|
233
|
+
className="gap-4" // gap between items
|
|
234
|
+
|
|
235
|
+
// Typography
|
|
236
|
+
className="text-sm font-medium leading-5"
|
|
237
|
+
className="text-base font-semibold leading-6"
|
|
238
|
+
className="text-xl font-bold"
|
|
239
|
+
|
|
240
|
+
// Colors (HeroUI tokens)
|
|
241
|
+
className="text-default-600" // gray text
|
|
242
|
+
className="bg-primary" // primary background
|
|
243
|
+
className="border-default-400" // border color
|
|
244
|
+
|
|
245
|
+
// Responsive
|
|
246
|
+
className="max-sm:hidden" // hide on small screens
|
|
247
|
+
className="max-xs:col-span-10" // full width on extra small
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### HeroUI Color Tokens
|
|
251
|
+
|
|
252
|
+
- **default** - Gray scale (50, 100, 200, ..., 900)
|
|
253
|
+
- **primary** - Primary brand color
|
|
254
|
+
- **secondary** - Secondary brand color
|
|
255
|
+
- **success** - Green for success states
|
|
256
|
+
- **warning** - Yellow for warnings
|
|
257
|
+
- **danger** - Red for errors
|
|
258
|
+
- **foreground** - Text color
|
|
259
|
+
- **background** - Background color
|
|
260
|
+
|
|
261
|
+
## Common Patterns
|
|
262
|
+
|
|
263
|
+
### 1. Protected Route
|
|
264
|
+
|
|
265
|
+
```tsx
|
|
266
|
+
// Use middleware.ts for route protection
|
|
267
|
+
export function middleware(request: NextRequest) {
|
|
268
|
+
const token = request.cookies.get('auth-token');
|
|
269
|
+
|
|
270
|
+
if (!token && request.nextUrl.pathname.startsWith('/dashboard')) {
|
|
271
|
+
return NextResponse.redirect(new URL('/auth/login', request.url));
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### 2. Mutation with Toast
|
|
277
|
+
|
|
278
|
+
```tsx
|
|
279
|
+
import { useMutation } from '@tanstack/react-query';
|
|
280
|
+
import { toast } from 'sonner';
|
|
281
|
+
|
|
282
|
+
const mutation = useMutation({
|
|
283
|
+
mutationFn: submitData,
|
|
284
|
+
onSuccess: () => {
|
|
285
|
+
toast.success('Success!');
|
|
286
|
+
},
|
|
287
|
+
onError: (error) => {
|
|
288
|
+
toast.error(error.message);
|
|
289
|
+
},
|
|
290
|
+
});
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### 3. Conditional Rendering
|
|
294
|
+
|
|
295
|
+
```tsx
|
|
296
|
+
// Using conditional
|
|
297
|
+
{isLoading ? <Spinner /> : <Content />}
|
|
298
|
+
|
|
299
|
+
// Using optional chaining
|
|
300
|
+
{data?.items?.map(item => <Item key={item.id} {...item} />)}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### 4. Image Handling
|
|
304
|
+
|
|
305
|
+
```tsx
|
|
306
|
+
import Image from 'next/image';
|
|
307
|
+
|
|
308
|
+
<Image
|
|
309
|
+
src="/images/logo.png"
|
|
310
|
+
alt="Logo"
|
|
311
|
+
width={200}
|
|
312
|
+
height={100}
|
|
313
|
+
className="object-cover"
|
|
314
|
+
/>
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Implementation Workflow
|
|
318
|
+
|
|
319
|
+
1. **Analyze Figma Design**
|
|
320
|
+
- Use Figma MCP Server to inspect design
|
|
321
|
+
- Map colors, spacing, typography to existing tokens
|
|
322
|
+
- Identify which UI components to use
|
|
323
|
+
|
|
324
|
+
2. **Create Service Module**
|
|
325
|
+
- Create folder: `/src/services/[feature]/`
|
|
326
|
+
- Add: `api/`, `queries/`, `hooks/`, `types/`, `actions/`, `store/`
|
|
327
|
+
- Export all from `index.ts`
|
|
328
|
+
|
|
329
|
+
3. **Add Translations**
|
|
330
|
+
- Add English keys to `/src/locales/en.json`
|
|
331
|
+
- Add German keys to `/src/locales/de.json`
|
|
332
|
+
|
|
333
|
+
4. **Build Components**
|
|
334
|
+
- Use existing UI components from `/src/components/ui/`
|
|
335
|
+
- Use existing elements from `/src/components/elements/`
|
|
336
|
+
- Never install new UI libraries
|
|
337
|
+
|
|
338
|
+
5. **Implement Forms**
|
|
339
|
+
- Use `react-hook-form` + `zod`
|
|
340
|
+
- Use `Form` and `Form.Item` from `/src/components/ui/form/`
|
|
341
|
+
- Add validation schemas
|
|
342
|
+
|
|
343
|
+
6. **Test & Validate**
|
|
344
|
+
- Test form validation
|
|
345
|
+
- Test API calls
|
|
346
|
+
- Test translations
|
|
347
|
+
- Test responsive design
|
|
348
|
+
|
|
349
|
+
## Quick Checklist
|
|
350
|
+
|
|
351
|
+
Before implementing any feature:
|
|
352
|
+
|
|
353
|
+
- [ ] Checked existing components in `/src/components/ui/`
|
|
354
|
+
- [ ] Checked existing elements in `/src/components/elements/`
|
|
355
|
+
- [ ] Checked existing patterns in `/src/services/`
|
|
356
|
+
- [ ] Reviewed Figma design thoroughly
|
|
357
|
+
- [ ] Mapped design tokens to existing values
|
|
358
|
+
- [ ] Planned service module structure
|
|
359
|
+
- [ ] Prepared translation keys
|
|
360
|
+
- [ ] No new UI libraries needed
|
|
361
|
+
|
|
362
|
+
## Common Pitfalls
|
|
363
|
+
|
|
364
|
+
1. **Installing new libraries** - Use existing tech stack
|
|
365
|
+
2. **Hardcoding strings** - Always use translations
|
|
366
|
+
3. **Creating custom UI components** - Use HeroUI extended components
|
|
367
|
+
4. **Direct fetch calls** - Use React Query
|
|
368
|
+
5. **Untyped data** - Always define TypeScript types
|
|
369
|
+
6. **Missing translations** - Add to both en.json and de.json
|
|
370
|
+
7. **Inconsistent spacing** - Use Tailwind spacing scale
|
|
371
|
+
8. **Ignoring responsive design** - Test on all screen sizes
|
|
372
|
+
|
|
373
|
+
## Need More Details?
|
|
374
|
+
|
|
375
|
+
- **UI Components** → See `UI_COMPONENTS_GUIDE.md`
|
|
376
|
+
- **Architecture** → See `ARCHITECTURE_PATTERNS.md`
|
|
377
|
+
- **Implementation Steps** → See `IMPLEMENTATION_GUIDE.md`
|
|
378
|
+
- **Figma to Code** → See `FIGMA_TO_CODE_GUIDE.md`
|
|
379
|
+
- **Documentation Index** → See `DOCUMENTATION_INDEX.md`
|