Files
triqura-ecd/lib/supabase
colinislit a789bebe96 feat: rapportage API, speech recorder refactor, docs reorganisatie
Multiple features and improvements:

Reports/Rapportage API:
- Created REST API endpoints: /api/reports (GET/POST), /api/reports/[id] (GET/PATCH/DELETE)
- Added /api/reports/classify endpoint for AI classification
- Supabase migrations: reports table + RLS policies
- Server utilities: api-client.ts for DRY fetch logic
- Type definitions: lib/types/report.ts with Zod schemas
- Removed old rapportage-modal component (replaced by split-view)

Speech Recorder Refactor:
- Moved speech-recorder from intake-specific to shared components/
- Updated treatment-advice-form to use new location
- Updated intake actions for speech functionality

UI Components (shadcn):
- Added dialog, dropdown-menu, toast, toaster components
- Added use-toast hook for toast notifications

Documentation:
- Reorganized docs/release/ → docs/reports/ for better structure
- Archived old specs to docs/specs/archive/
- Added screening-system.mdx documentation
- Added rapportage-split-view-design.md
- Added UI screenshots for troubleshooting

Dependencies:
- Updated package.json and pnpm-lock.yaml
- Regenerated database.types.ts from Supabase

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 14:14:06 +01:00
..

Supabase Configuration

Deze folder bevat de Supabase client configuratie voor het Mini-EPD project.

Bestanden

  • client.ts - Client-side Supabase client (browser-safe, gebruikt anon key)
  • server.ts - Server-side Supabase client (admin, gebruikt service role key)
  • types.ts - TypeScript types (auto-gegenereerd uit database schema)
  • index.ts - Export file voor makkelijke imports

Gebruik

Client-side (React components)

import { supabase } from '@/lib/supabase'

// Voorbeeld: ophalen van clients
const { data, error } = await supabase
  .from('clients')
  .select('*')

Server-side (API routes, Server Components)

import { supabaseAdmin } from '@/lib/supabase/server'

// Voorbeeld: admin operatie
const { data, error } = await supabaseAdmin
  .from('clients')
  .insert({ ... })

TypeScript Types Genereren

Na het aanmaken van database schema (EP01), run:

pnpm run types:generate

Dit genereert TypeScript types uit je Supabase database schema.

Environment Variables

Zorg dat deze variabelen in .env.local staan:

NEXT_PUBLIC_SUPABASE_URL=https://dqugbrpwtisgyxscpefg.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=...
SUPABASE_SERVICE_ROLE_KEY=...

Security

⚠️ Belangrijk:

  • NEXT_PUBLIC_* variabelen zijn zichtbaar in de browser
  • SUPABASE_SERVICE_ROLE_KEY moet NOOIT naar de client worden gestuurd
  • Gebruik supabase (client) voor frontend operaties
  • Gebruik supabaseAdmin (server) alleen in API routes en Server Components

Volgende Stappen

  1. EP00-ST03: Supabase configuratie (Done)
  2. EP01-ST01: Database schema aanmaken
  3. EP01-ST02: Row Level Security policies
  4. EP02-ST01: Authentication implementeren