|
| 1 | +I need you to implement a comprehensive library feature for Syntax & Sips (Next.js 15 + Supabase platform). |
| 2 | + |
| 3 | +STUDY THESE DOCUMENTS FIRST (in order): |
| 4 | +1. docs/library/LIBRARY_FEATURE_PLAN.md - Executive overview and roadmap |
| 5 | +2. docs/library/library-feature-summary.md - Detailed feature specifications |
| 6 | +3. docs/library/library-feature-implementation-plan.md - Technical roadmap |
| 7 | +4. docs/library/library-technical-spec.md - Complete database schema and SQL |
| 8 | +5. docs/library/library-implementation-guide.md - Step-by-step implementation guide |
| 9 | + |
| 10 | +IMPLEMENTATION REQUIREMENTS: |
| 11 | + |
| 12 | +Phase 1: Database Schema (START HERE) |
| 13 | +- Create: supabase/migrations/0015_create_user_library_schema.sql |
| 14 | +- Include: All 6 tables (user_lists, list_items, saved_lists, highlights, reading_history, bookmarks) |
| 15 | +- Add: All indexes, RLS policies, triggers, constraints |
| 16 | +- Follow: Exact schema from library-technical-spec.md |
| 17 | + |
| 18 | +Phase 2: TypeScript Types |
| 19 | +- Update: src/utils/types.ts (add all library types) |
| 20 | +- Create: src/lib/library/validation.ts (Zod schemas) |
| 21 | +- Create: src/lib/library/types.ts (helper types) |
| 22 | +- Follow: Type definitions from library-technical-spec.md |
| 23 | + |
| 24 | +Phase 3: Backend API Routes |
| 25 | +- Create: src/app/api/library/* (complete API structure) |
| 26 | +- Routes: /lists, /highlights, /history, /bookmarks, /saved-lists, /stats |
| 27 | +- Include: Authentication, validation, error handling, RLS |
| 28 | +- Follow: Existing patterns in src/app/api/admin/posts/route.ts |
| 29 | + |
| 30 | +Phase 4: Frontend Routes |
| 31 | +- Migrate: /me from admin redirect to library dashboard |
| 32 | +- Create: /me/lists, /me/highlights, /me/history, /me/responses, /me/accounts |
| 33 | +- Add: Authentication guards, loading states, error boundaries |
| 34 | +- Follow: Next.js 15 App Router patterns |
| 35 | + |
| 36 | +Phase 5: UI Components |
| 37 | +- Create: src/components/library/* (all components) |
| 38 | +- Style: Neo-brutalism (thick borders, hard shadows, bold colors) |
| 39 | +- Include: LibraryDashboard, ListsManager, HighlightsViewer, ReadingHistory, BookmarkButton |
| 40 | +- Follow: Design system in neobrutalismthemecomp.MD |
| 41 | + |
| 42 | +Phase 6: Integration |
| 43 | +- Add: Bookmark buttons to post pages |
| 44 | +- Add: Highlight selection UI |
| 45 | +- Add: Reading history tracking |
| 46 | +- Connect: All features end-to-end |
| 47 | + |
| 48 | +CRITICAL RULES: |
| 49 | +1. Study ALL documentation before starting |
| 50 | +2. Follow existing codebase patterns (check src/app/api/*, src/components/*) |
| 51 | +3. Use createServerComponentClient() for server, createBrowserClient() for client |
| 52 | +4. Implement RLS policies on ALL tables |
| 53 | +5. Use Zod for ALL input validation |
| 54 | +6. Follow neo-brutalism design system exactly |
| 55 | +7. Add proper error handling and loading states |
| 56 | +8. Ensure WCAG 2.1 AA accessibility |
| 57 | +9. Write tests for all functionality |
| 58 | +10. Update documentation as you implement |
| 59 | + |
| 60 | +STUDY THESE EXISTING FILES FOR PATTERNS: |
| 61 | +- supabase/migrations/0012_create_gamification_schema.sql (complex schema) |
| 62 | +- src/app/api/admin/posts/route.ts (CRUD operations) |
| 63 | +- src/components/auth/UserAccountPanel.tsx (complex dashboard) |
| 64 | +- src/lib/gamification/types.ts (type patterns) |
| 65 | + |
| 66 | +START WITH: Creating the database migration file following the exact schema in library-technical-spec.md |
| 67 | + |
| 68 | +SECURITY CHECKLIST: |
| 69 | +✓ RLS enabled on all tables |
| 70 | +✓ Authentication validated in all routes |
| 71 | +✓ Input validation with Zod |
| 72 | +✓ No SQL injection vulnerabilities |
| 73 | +✓ Proper error messages (no sensitive data) |
| 74 | + |
| 75 | +DESIGN CHECKLIST: |
| 76 | +✓ Thick black borders (border-4 border-black) |
| 77 | +✓ Hard shadows (shadow-[16px_16px_0px_0px_rgba(0,0,0,0.2)]) |
| 78 | +✓ Bold colors (#9723C9, #FF69B4, #87CEEB, #90EE90) |
| 79 | +✓ Rounded corners (rounded-[32px]) |
| 80 | +✓ Mobile-first responsive design |
| 81 | + |
| 82 | +Ready to start? Begin with Phase 1: Database Migration. |
| 83 | + |
0 commit comments