-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathnextjs-ecommerce-template.patch
More file actions
8389 lines (8355 loc) · 208 KB
/
nextjs-ecommerce-template.patch
File metadata and controls
8389 lines (8355 loc) · 208 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
From 59847d8db2b922051eadbed98cfaa25a12afd209 Mon Sep 17 00:00:00 2001
From: Claude <noreply@anthropic.com>
Date: Fri, 7 Nov 2025 09:22:29 +0000
Subject: [PATCH 1/4] Add complete Next.js + WooCommerce eCommerce template
This commit adds a production-ready Next.js eCommerce template with comprehensive
infrastructure for building maintainable eCommerce applications.
Key Features:
- Complete design token system (CSS custom properties)
- 6 foundational components (Button, Card, Input, Form, Modal, Table)
- WooCommerce REST API integration with type-safe client
- Stripe payment integration
- Example products feature demonstrating all patterns
- Custom Claude Code skill for pattern enforcement
- Full TypeScript coverage with strict typing
- CSS Modules with design token enforcement
- Features-first architecture for scalability
Core Principles Enforced:
- DRY (Don't Repeat Yourself)
- SRP (Single Responsibility Principle)
- NO inline styles - all styling through Component.module.css
- Design tokens only - no hardcoded colors/spacing/values
Components Created:
- Button: 5 variants, 3 sizes, loading states, full accessibility
- Card: Flexible layout with header/body/footer sections
- Input: Text/email/password/textarea with validation & icons
- Form: Structured forms with error handling
- Modal: Accessible dialogs with focus trapping
- Table: Sortable, responsive data tables
Integration Libraries:
- WooCommerce client (src/lib/woocommerce/)
- Stripe client (src/lib/stripe/)
- Complete TypeScript type definitions
Documentation:
- Comprehensive README with examples
- Quick start SETUP_GUIDE
- Claude Code skill with detailed patterns
- Inline documentation throughout
Configuration:
- TypeScript with strict checking
- ESLint + Prettier
- Next.js 14 with App Router
- Path aliases for clean imports
This template provides everything needed to start a new Next.js + WooCommerce
eCommerce project with enforced best practices from day one.
---
.../nextjs-ecommerce-guidelines/SKILL.md | 488 +++++++++++++++
nextjs-ecommerce-template/.env.example | 16 +
nextjs-ecommerce-template/.eslintrc.json | 34 ++
nextjs-ecommerce-template/.prettierrc | 10 +
nextjs-ecommerce-template/README.md | 561 ++++++++++++++++++
nextjs-ecommerce-template/SETUP_GUIDE.md | 499 ++++++++++++++++
nextjs-ecommerce-template/next.config.js | 35 ++
nextjs-ecommerce-template/package.json | 44 ++
.../src/components/Button/Button.module.css | 197 ++++++
.../src/components/Button/Button.tsx | 91 +++
.../src/components/Button/index.ts | 6 +
.../src/components/Card/Card.module.css | 113 ++++
.../src/components/Card/Card.tsx | 137 +++++
.../src/components/Card/index.ts | 11 +
.../src/components/Form/Form.module.css | 88 +++
.../src/components/Form/Form.tsx | 127 ++++
.../src/components/Form/index.ts | 11 +
.../src/components/Input/Input.module.css | 174 ++++++
.../src/components/Input/Input.tsx | 158 +++++
.../src/components/Input/index.ts | 6 +
.../src/components/Modal/Modal.module.css | 173 ++++++
.../src/components/Modal/Modal.tsx | 212 +++++++
.../src/components/Modal/index.ts | 6 +
.../src/components/Table/Table.module.css | 178 ++++++
.../src/components/Table/Table.tsx | 242 ++++++++
.../src/components/Table/index.ts | 6 +
.../src/features/products/api/productsApi.ts | 137 +++++
.../components/ProductCard.module.css | 132 +++++
.../products/components/ProductCard.tsx | 193 ++++++
.../components/ProductGrid.module.css | 67 +++
.../products/components/ProductGrid.tsx | 86 +++
.../src/features/products/components/index.ts | 9 +
.../src/features/products/types/index.ts | 85 +++
.../src/lib/stripe/client.ts | 107 ++++
.../src/lib/woocommerce/client.ts | 267 +++++++++
.../src/lib/woocommerce/index.ts | 19 +
.../src/lib/woocommerce/types.ts | 243 ++++++++
.../src/styles/globals.css | 196 ++++++
.../src/styles/tokens.css | 261 ++++++++
.../src/styles/tokens.ts | 205 +++++++
nextjs-ecommerce-template/tsconfig.json | 65 ++
41 files changed, 5695 insertions(+)
create mode 100644 nextjs-ecommerce-template/.claude/skills/nextjs-ecommerce-guidelines/SKILL.md
create mode 100644 nextjs-ecommerce-template/.env.example
create mode 100644 nextjs-ecommerce-template/.eslintrc.json
create mode 100644 nextjs-ecommerce-template/.prettierrc
create mode 100644 nextjs-ecommerce-template/README.md
create mode 100644 nextjs-ecommerce-template/SETUP_GUIDE.md
create mode 100644 nextjs-ecommerce-template/next.config.js
create mode 100644 nextjs-ecommerce-template/package.json
create mode 100644 nextjs-ecommerce-template/src/components/Button/Button.module.css
create mode 100644 nextjs-ecommerce-template/src/components/Button/Button.tsx
create mode 100644 nextjs-ecommerce-template/src/components/Button/index.ts
create mode 100644 nextjs-ecommerce-template/src/components/Card/Card.module.css
create mode 100644 nextjs-ecommerce-template/src/components/Card/Card.tsx
create mode 100644 nextjs-ecommerce-template/src/components/Card/index.ts
create mode 100644 nextjs-ecommerce-template/src/components/Form/Form.module.css
create mode 100644 nextjs-ecommerce-template/src/components/Form/Form.tsx
create mode 100644 nextjs-ecommerce-template/src/components/Form/index.ts
create mode 100644 nextjs-ecommerce-template/src/components/Input/Input.module.css
create mode 100644 nextjs-ecommerce-template/src/components/Input/Input.tsx
create mode 100644 nextjs-ecommerce-template/src/components/Input/index.ts
create mode 100644 nextjs-ecommerce-template/src/components/Modal/Modal.module.css
create mode 100644 nextjs-ecommerce-template/src/components/Modal/Modal.tsx
create mode 100644 nextjs-ecommerce-template/src/components/Modal/index.ts
create mode 100644 nextjs-ecommerce-template/src/components/Table/Table.module.css
create mode 100644 nextjs-ecommerce-template/src/components/Table/Table.tsx
create mode 100644 nextjs-ecommerce-template/src/components/Table/index.ts
create mode 100644 nextjs-ecommerce-template/src/features/products/api/productsApi.ts
create mode 100644 nextjs-ecommerce-template/src/features/products/components/ProductCard.module.css
create mode 100644 nextjs-ecommerce-template/src/features/products/components/ProductCard.tsx
create mode 100644 nextjs-ecommerce-template/src/features/products/components/ProductGrid.module.css
create mode 100644 nextjs-ecommerce-template/src/features/products/components/ProductGrid.tsx
create mode 100644 nextjs-ecommerce-template/src/features/products/components/index.ts
create mode 100644 nextjs-ecommerce-template/src/features/products/types/index.ts
create mode 100644 nextjs-ecommerce-template/src/lib/stripe/client.ts
create mode 100644 nextjs-ecommerce-template/src/lib/woocommerce/client.ts
create mode 100644 nextjs-ecommerce-template/src/lib/woocommerce/index.ts
create mode 100644 nextjs-ecommerce-template/src/lib/woocommerce/types.ts
create mode 100644 nextjs-ecommerce-template/src/styles/globals.css
create mode 100644 nextjs-ecommerce-template/src/styles/tokens.css
create mode 100644 nextjs-ecommerce-template/src/styles/tokens.ts
create mode 100644 nextjs-ecommerce-template/tsconfig.json
diff --git a/nextjs-ecommerce-template/.claude/skills/nextjs-ecommerce-guidelines/SKILL.md b/nextjs-ecommerce-template/.claude/skills/nextjs-ecommerce-guidelines/SKILL.md
new file mode 100644
index 0000000..9a6e1f0
--- /dev/null
+++ b/nextjs-ecommerce-template/.claude/skills/nextjs-ecommerce-guidelines/SKILL.md
@@ -0,0 +1,488 @@
+---
+name: nextjs-ecommerce-guidelines
+version: 1.0.0
+description: Development guidelines for Next.js + WooCommerce eCommerce applications
+type: guardrail
+enforcement: block
+---
+
+# Next.js eCommerce Development Guidelines
+
+**PURPOSE**: Enforce consistent patterns, DRY principles, SRP, design token usage, and Component.module.css styling across the Next.js + WooCommerce eCommerce application.
+
+## Core Principles
+
+### 1. DRY (Don't Repeat Yourself)
+- Reuse foundational components (Button, Card, Input, Form, Table, Modal)
+- Extract repeated logic into custom hooks
+- Create utility functions for common operations
+- Use TypeScript generics for type reusability
+
+### 2. SRP (Single Responsibility Principle)
+- Each component has ONE clear purpose
+- Features directory for domain-specific logic
+- Components directory for truly reusable UI elements
+- Separation of concerns: UI, business logic, data fetching
+
+### 3. NO Inline Styles
+**CRITICAL RULE**: NO hardcoded colors, spacing, or design values in components.
+
+❌ **FORBIDDEN**:
+```tsx
+<div style={{ color: '#2196f3', padding: '16px' }}>
+```
+
+✅ **REQUIRED**:
+```tsx
+<div className={styles.container}>
+```
+
+```css
+/* Component.module.css */
+.container {
+ color: var(--color-primary-600);
+ padding: var(--spacing-4);
+}
+```
+
+### 4. Design Tokens Only
+ALL styling values MUST come from design tokens defined in `src/styles/tokens.css`.
+
+**Available token categories**:
+- Colors: `--color-primary-500`, `--color-text-primary`, etc.
+- Spacing: `--spacing-4`, `--spacing-6`, etc.
+- Typography: `--font-size-base`, `--font-weight-medium`, etc.
+- Borders: `--border-radius-md`, `--border-width-thin`, etc.
+- Shadows: `--shadow-md`, `--shadow-lg`, etc.
+- Transitions: `--transition-base`, etc.
+
+## File Organization
+
+### Project Structure
+
+```
+src/
+ app/ # Next.js App Router pages
+ page.tsx
+ layout.tsx
+ products/
+ page.tsx
+ [id]/page.tsx
+
+ components/ # Reusable UI components
+ Button/
+ Button.tsx
+ Button.module.css
+ index.ts
+ Card/
+ Input/
+ Modal/
+ Form/
+ Table/
+
+ features/ # Domain-specific features
+ products/
+ api/ # API service layer
+ productsApi.ts
+ components/ # Feature-specific components
+ ProductCard.tsx
+ ProductCard.module.css
+ ProductGrid.tsx
+ hooks/ # Custom hooks
+ useProducts.ts
+ types/ # TypeScript types
+ index.ts
+
+ lib/ # Shared libraries
+ woocommerce/
+ client.ts
+ types.ts
+ stripe/
+ client.ts
+ utils/
+
+ hooks/ # App-level hooks
+ useCart.ts
+
+ types/ # Global types
+
+ styles/ # Global styles & tokens
+ tokens.css
+ globals.css
+ tokens.ts
+```
+
+### When to use features/ vs components/
+
+**Use `features/` when**:
+- Component is specific to a business domain (products, orders, customers)
+- Tightly coupled to specific data structures
+- Contains business logic
+- Used in specific contexts
+
+**Use `components/` when**:
+- Component is truly reusable across the app
+- No business logic
+- Pure UI component
+- Used in 3+ different places
+
+## Component Patterns
+
+### Component Structure
+
+Every component MUST follow this pattern:
+
+```tsx
+/**
+ * ComponentName Component
+ *
+ * Clear description of what this component does.
+ *
+ * @example
+ * ```tsx
+ * <ComponentName prop1="value" onAction={handler} />
+ * ```
+ */
+
+'use client'; // Only if using client features
+
+import React from 'react';
+import type { ReactNode } from 'react';
+import styles from './ComponentName.module.css';
+
+export interface ComponentNameProps {
+ /** Prop description */
+ prop1: string;
+ /** Optional prop */
+ prop2?: number;
+ /** Event handler */
+ onAction?: () => void;
+ children?: ReactNode;
+}
+
+export const ComponentName: React.FC<ComponentNameProps> = ({
+ prop1,
+ prop2 = 0,
+ onAction,
+ children,
+}) => {
+ // Component logic here
+
+ return (
+ <div className={styles.container}>
+ {children}
+ </div>
+ );
+};
+
+export default ComponentName;
+```
+
+### CSS Module Structure
+
+Every `Component.module.css` MUST follow this pattern:
+
+```css
+/**
+ * ComponentName Component Styles
+ *
+ * RULES:
+ * - All values MUST use design tokens from tokens.css
+ * - NO hardcoded colors, spacing, or other values
+ * - Maintain consistent UX across all instances
+ */
+
+.container {
+ display: flex;
+ flex-direction: column;
+ gap: var(--spacing-4);
+ padding: var(--spacing-6);
+ background-color: var(--color-background);
+ border-radius: var(--border-radius-lg);
+}
+
+.title {
+ font-size: var(--font-size-xl);
+ font-weight: var(--font-weight-semibold);
+ color: var(--color-text-primary);
+ margin: 0;
+}
+
+/* Responsive */
+@media (max-width: 768px) {
+ .container {
+ padding: var(--spacing-4);
+ }
+}
+```
+
+## TypeScript Standards
+
+### Type Definitions
+
+```tsx
+// ✅ GOOD: Explicit prop types with JSDoc
+export interface ButtonProps {
+ /** Button visual variant */
+ variant?: 'primary' | 'secondary' | 'outline';
+ /** Button size */
+ size?: 'sm' | 'md' | 'lg';
+ /** Click handler */
+ onClick?: () => void;
+ children: ReactNode;
+}
+
+// ❌ BAD: No documentation
+interface Props {
+ variant?: string;
+ size?: string;
+ onClick?: any;
+}
+```
+
+### Path Aliases
+
+Use configured path aliases for imports:
+
+```tsx
+// ✅ GOOD
+import { Button } from '~components/Button';
+import { Product } from '~features/products/types';
+import { formatPrice } from '~lib/utils';
+
+// ❌ BAD
+import { Button } from '../../../components/Button';
+```
+
+## Data Fetching Patterns
+
+### API Routes (Server-Side)
+
+```tsx
+// app/api/products/route.ts
+import { NextResponse } from 'next/server';
+import { getWooCommerceClient } from '~lib/woocommerce';
+
+export async function GET(request: Request) {
+ try {
+ const wc = getWooCommerceClient();
+ const { data } = await wc.getProducts();
+
+ return NextResponse.json(data);
+ } catch (error) {
+ return NextResponse.json(
+ { error: 'Failed to fetch products' },
+ { status: 500 }
+ );
+ }
+}
+```
+
+### Client-Side Service Layer
+
+```tsx
+// features/products/api/productsApi.ts
+export const getProducts = async (): Promise<Product[]> => {
+ const response = await fetch('/api/products');
+
+ if (!response.ok) {
+ throw new Error('Failed to fetch products');
+ }
+
+ return response.json();
+};
+```
+
+### Custom Hooks
+
+```tsx
+// features/products/hooks/useProducts.ts
+'use client';
+
+import { useState, useEffect } from 'react';
+import { getProducts } from '../api/productsApi';
+import type { Product } from '../types';
+
+export const useProducts = () => {
+ const [products, setProducts] = useState<Product[]>([]);
+ const [loading, setLoading] = useState(true);
+ const [error, setError] = useState<string | null>(null);
+
+ useEffect(() => {
+ const fetchProducts = async () => {
+ try {
+ setLoading(true);
+ const data = await getProducts();
+ setProducts(data);
+ } catch (err) {
+ setError(err instanceof Error ? err.message : 'Unknown error');
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ fetchProducts();
+ }, []);
+
+ return { products, loading, error };
+};
+```
+
+## Form Handling
+
+Use the Form foundational component:
+
+```tsx
+<Form onSubmit={handleSubmit} error={formError}>
+ <FormGroup>
+ <Input
+ label="Email"
+ type="email"
+ required
+ value={email}
+ onChange={(e) => setEmail(e.target.value)}
+ />
+ <Input
+ label="Password"
+ type="password"
+ required
+ value={password}
+ onChange={(e) => setPassword(e.target.value)}
+ />
+ </FormGroup>
+
+ <FormActions>
+ <Button type="button" variant="outline" onClick={onCancel}>
+ Cancel
+ </Button>
+ <Button type="submit" loading={isSubmitting}>
+ Submit
+ </Button>
+ </FormActions>
+</Form>
+```
+
+## WooCommerce Integration
+
+### Server-Side Only
+
+WooCommerce API credentials MUST never be exposed to the client:
+
+```tsx
+// ✅ GOOD: API Route (server-side)
+import { getWooCommerceClient } from '~lib/woocommerce';
+
+export async function GET() {
+ const wc = getWooCommerceClient();
+ const products = await wc.getProducts();
+ return NextResponse.json(products);
+}
+
+// ❌ BAD: Client component
+'use client';
+const wc = getWooCommerceClient(); // This will throw error!
+```
+
+### Type Mapping
+
+Map WooCommerce types to simplified frontend types:
+
+```tsx
+// lib/woocommerce/mappers.ts
+export const mapWooProductToProduct = (
+ wooProduct: WooCommerceProduct
+): Product => ({
+ id: wooProduct.id,
+ name: wooProduct.name,
+ price: parseFloat(wooProduct.price),
+ regularPrice: parseFloat(wooProduct.regular_price),
+ salePrice: wooProduct.sale_price ? parseFloat(wooProduct.sale_price) : null,
+ // ... map other fields
+});
+```
+
+## Error Handling
+
+Always handle errors gracefully:
+
+```tsx
+try {
+ const data = await fetchData();
+ setData(data);
+} catch (error) {
+ const message = error instanceof Error ? error.message : 'Unknown error';
+ setError(message);
+ console.error('Failed to fetch data:', error);
+}
+```
+
+## Performance
+
+### Image Optimization
+
+Always use Next.js Image component:
+
+```tsx
+import Image from 'next/image';
+
+<Image
+ src={product.image}
+ alt={product.name}
+ width={300}
+ height={300}
+ sizes="(max-width: 768px) 100vw, 50vw"
+/>
+```
+
+### Code Splitting
+
+Use dynamic imports for heavy components:
+
+```tsx
+import dynamic from 'next/dynamic';
+
+const HeavyComponent = dynamic(() => import('./HeavyComponent'), {
+ loading: () => <div>Loading...</div>,
+});
+```
+
+## Accessibility
+
+- Use semantic HTML
+- Provide alt text for images
+- Ensure keyboard navigation works
+- Use ARIA labels where needed
+- Test with screen readers
+
+## Testing Checklist
+
+Before committing:
+
+✅ No inline styles
+✅ All design tokens used correctly
+✅ TypeScript types defined
+✅ Components follow structure pattern
+✅ CSS modules use tokens only
+✅ No WooCommerce/Stripe keys on client
+✅ Error handling in place
+✅ Responsive design tested
+✅ Accessibility checked
+
+## Common Mistakes to Avoid
+
+1. ❌ Hardcoded colors/spacing
+2. ❌ Inline styles
+3. ❌ Exposing API credentials to client
+4. ❌ Missing TypeScript types
+5. ❌ Not using foundational components
+6. ❌ Mixing business logic in UI components
+7. ❌ Not using path aliases
+8. ❌ Missing error handling
+9. ❌ No responsive design
+10. ❌ Poor accessibility
+
+---
+
+**Remember**: Consistency is key. Follow these patterns strictly to maintain a clean, maintainable codebase.
+
+For more detailed information, see the resources/ directory.
diff --git a/nextjs-ecommerce-template/.env.example b/nextjs-ecommerce-template/.env.example
new file mode 100644
index 0000000..3dff321
--- /dev/null
+++ b/nextjs-ecommerce-template/.env.example
@@ -0,0 +1,16 @@
+# Site Configuration
+NEXT_PUBLIC_SITE_URL=http://localhost:3000
+
+# WooCommerce Configuration
+NEXT_PUBLIC_WOOCOMMERCE_URL=https://your-woocommerce-site.com
+WOOCOMMERCE_CONSUMER_KEY=ck_your_consumer_key_here
+WOOCOMMERCE_CONSUMER_SECRET=cs_your_consumer_secret_here
+
+# Stripe Configuration
+NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_your_publishable_key_here
+STRIPE_SECRET_KEY=sk_test_your_secret_key_here
+STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret_here
+
+# Optional: Analytics, Monitoring, etc.
+# NEXT_PUBLIC_GA_TRACKING_ID=
+# SENTRY_DSN=
diff --git a/nextjs-ecommerce-template/.eslintrc.json b/nextjs-ecommerce-template/.eslintrc.json
new file mode 100644
index 0000000..38953b6
--- /dev/null
+++ b/nextjs-ecommerce-template/.eslintrc.json
@@ -0,0 +1,34 @@
+{
+ "extends": [
+ "next/core-web-vitals",
+ "plugin:@typescript-eslint/recommended",
+ "prettier"
+ ],
+ "parser": "@typescript-eslint/parser",
+ "plugins": ["@typescript-eslint"],
+ "root": true,
+ "rules": {
+ // TypeScript rules
+ "@typescript-eslint/no-unused-vars": [
+ "error",
+ {
+ "argsIgnorePattern": "^_",
+ "varsIgnorePattern": "^_"
+ }
+ ],
+ "@typescript-eslint/no-explicit-any": "warn",
+ "@typescript-eslint/explicit-module-boundary-types": "off",
+ "@typescript-eslint/no-non-null-assertion": "warn",
+
+ // React rules
+ "react/react-in-jsx-scope": "off",
+ "react/prop-types": "off",
+ "react-hooks/rules-of-hooks": "error",
+ "react-hooks/exhaustive-deps": "warn",
+
+ // General rules
+ "no-console": ["warn", { "allow": ["warn", "error"] }],
+ "prefer-const": "error",
+ "no-var": "error"
+ }
+}
diff --git a/nextjs-ecommerce-template/.prettierrc b/nextjs-ecommerce-template/.prettierrc
new file mode 100644
index 0000000..3171de5
--- /dev/null
+++ b/nextjs-ecommerce-template/.prettierrc
@@ -0,0 +1,10 @@
+{
+ "semi": true,
+ "trailingComma": "es5",
+ "singleQuote": true,
+ "printWidth": 80,
+ "tabWidth": 2,
+ "useTabs": false,
+ "arrowParens": "always",
+ "endOfLine": "lf"
+}
diff --git a/nextjs-ecommerce-template/README.md b/nextjs-ecommerce-template/README.md
new file mode 100644
index 0000000..bdb02a0
--- /dev/null
+++ b/nextjs-ecommerce-template/README.md
@@ -0,0 +1,561 @@
+# Next.js + WooCommerce eCommerce Template
+
+A production-ready Next.js eCommerce template with WooCommerce backend integration, strict architectural patterns, and comprehensive Claude Code skill enforcement.
+
+## 🎯 Core Principles
+
+This template enforces four critical principles from day one:
+
+1. **DRY (Don't Repeat Yourself)** - Reusable components, hooks, and utilities
+2. **SRP (Single Responsibility Principle)** - Clear separation of concerns
+3. **NO Inline Styles** - All styling through Component.module.css
+4. **Design Tokens Only** - No hardcoded colors, spacing, or values
+
+## ✨ Features
+
+- ✅ **Next.js 14** with App Router
+- ✅ **TypeScript** with strict type checking
+- ✅ **WooCommerce Integration** via REST API
+- ✅ **Stripe Payments** ready
+- ✅ **Design Token System** for consistent UX
+- ✅ **Foundational Components** (Button, Card, Input, Form, Table, Modal)
+- ✅ **CSS Modules** with design token enforcement
+- ✅ **Features-First Architecture** for scalability
+- ✅ **Claude Code Skill** for pattern enforcement
+- ✅ **Full TypeScript Coverage**
+- ✅ **Responsive Design** out of the box
+- ✅ **Accessibility** built-in
+
+## 📁 Project Structure
+
+```
+nextjs-ecommerce-template/
+├── src/
+│ ├── app/ # Next.js App Router
+│ │ ├── page.tsx
+│ │ ├── layout.tsx
+│ │ └── api/ # API routes
+│ │
+│ ├── components/ # Reusable UI components
+│ │ ├── Button/
+│ │ │ ├── Button.tsx
+│ │ │ ├── Button.module.css
+│ │ │ └── index.ts
+│ │ ├── Card/
+│ │ ├── Input/
+│ │ ├── Modal/
+│ │ ├── Form/
+│ │ └── Table/
+│ │
+│ ├── features/ # Domain-specific features
+│ │ └── products/
+│ │ ├── api/ # API service layer
+│ │ ├── components/ # Feature components
+│ │ ├── hooks/ # Custom hooks
+│ │ └── types/ # TypeScript types
+│ │
+│ ├── lib/ # Shared libraries
+│ │ ├── woocommerce/ # WooCommerce client
+│ │ ├── stripe/ # Stripe client
+│ │ └── utils/ # Utilities
+│ │
+│ ├── hooks/ # App-level hooks
+│ ├── types/ # Global types
+│ │
+│ └── styles/ # Global styles
+│ ├── tokens.css # Design tokens
+│ ├── tokens.ts # TypeScript tokens
+│ └── globals.css # Global styles
+│
+├── .claude/ # Claude Code configuration
+│ └── skills/
+│ └── nextjs-ecommerce-guidelines/
+│ └── SKILL.md # Development guidelines
+│
+├── package.json
+├── tsconfig.json
+├── next.config.js
+├── .eslintrc.json
+├── .prettierrc
+└── .env.example
+```
+
+## 🚀 Getting Started
+
+### 1. Copy Template to Your Project
+
+```bash
+# From the showcase repository
+cp -r nextjs-ecommerce-template/* your-project-name/
+cd your-project-name
+```
+
+### 2. Install Dependencies
+
+```bash
+npm install
+```
+
+### 3. Configure Environment Variables
+
+```bash
+cp .env.example .env.local
+```
+
+Edit `.env.local` with your credentials:
+
+```env
+# Site Configuration
+NEXT_PUBLIC_SITE_URL=http://localhost:3000
+
+# WooCommerce Configuration
+NEXT_PUBLIC_WOOCOMMERCE_URL=https://your-woocommerce-site.com
+WOOCOMMERCE_CONSUMER_KEY=your_consumer_key
+WOOCOMMERCE_CONSUMER_SECRET=your_consumer_secret
+
+# Stripe Configuration
+NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=your_publishable_key
+STRIPE_SECRET_KEY=your_secret_key
+STRIPE_WEBHOOK_SECRET=your_webhook_secret
+```
+
+### 4. Run Development Server
+
+```bash
+npm run dev
+```
+
+Open [http://localhost:3000](http://localhost:3000) to see your application.
+
+## 🎨 Design Token System
+
+All styling MUST use design tokens from `src/styles/tokens.css`.
+
+### Available Tokens
+
+```css
+/* Colors */
+--color-primary-500
+--color-secondary-600
+--color-success-500
+--color-error-600
+--color-text-primary
+--color-background
+
+/* Spacing */
+--spacing-1 /* 4px */
+--spacing-4 /* 16px */
+--spacing-6 /* 24px */
+
+/* Typography */
+--font-size-base
+--font-weight-medium
+
+/* And many more... */
+```
+
+### Usage Example
+
+```css
+/* Component.module.css */
+.button {
+ padding: var(--spacing-2) var(--spacing-4);
+ background-color: var(--color-primary-600);
+ color: white;
+ border-radius: var(--border-radius-md);
+ font-size: var(--font-size-base);
+ transition: var(--transition-base);
+}
+
+.button:hover {
+ background-color: var(--color-primary-700);
+}
+```
+
+❌ **NEVER DO THIS**:
+```css
+.button {
+ padding: 8px 16px; /* Hardcoded! */
+ background-color: #2196f3; /* Hardcoded! */
+}
+```
+
+## 🧩 Foundational Components
+
+Use these everywhere instead of creating new ones:
+
+### Button
+
+```tsx
+import { Button } from '~components/Button';
+
+<Button variant="primary" size="md" onClick={handleClick}>
+ Click Me
+</Button>
+```
+
+### Card
+
+```tsx
+import { Card, CardHeader, CardBody, CardFooter } from '~components/Card';
+
+<Card variant="elevated" padding="md">
+ <CardHeader>Title</CardHeader>
+ <CardBody>Content</CardBody>
+ <CardFooter>Footer</CardFooter>
+</Card>
+```
+
+### Input
+
+```tsx
+import { Input } from '~components/Input';
+
+<Input
+ label="Email"
+ type="email"
+ required
+ error={errors.email}
+ value={email}
+ onChange={(e) => setEmail(e.target.value)}
+/>
+```
+
+### Form
+
+```tsx
+import { Form, FormGroup, FormActions } from '~components/Form';
+
+<Form onSubmit={handleSubmit} error={error}>
+ <FormGroup>
+ <Input label="Email" type="email" />
+ <Input label="Password" type="password" />
+ </FormGroup>
+ <FormActions>
+ <Button type="submit">Submit</Button>
+ </FormActions>
+</Form>
+```
+
+### Modal
+
+```tsx
+import { Modal, ModalBody, ModalFooter } from '~components/Modal';
+
+<Modal open={isOpen} onClose={handleClose} title="Confirm">
+ <ModalBody>Are you sure?</ModalBody>
+ <ModalFooter>
+ <Button variant="outline" onClick={handleClose}>Cancel</Button>
+ <Button variant="primary" onClick={handleConfirm}>Confirm</Button>
+ </ModalFooter>
+</Modal>
+```
+
+### Table
+
+```tsx
+import { Table } from '~components/Table';
+
+<Table
+ columns={[
+ { key: 'name', label: 'Name', sortable: true },
+ { key: 'price', label: 'Price', align: 'right' }
+ ]}
+ data={products}
+ striped
+ hoverable
+/>
+```
+
+## 🏗️ Creating New Features
+
+### Feature Structure
+
+```
+features/
+ your-feature/
+ api/
+ yourFeatureApi.ts # API service layer
+ components/
+ YourComponent.tsx # Feature-specific components
+ YourComponent.module.css
+ hooks/
+ useYourFeature.ts # Custom hooks
+ types/
+ index.ts # TypeScript types