# Plan: SnelStart Productiekoppeling
## Doel
Van maatwerkkoppeling naar productiekoppeling zodat:
1. Gebruikers via een webportal hun SnelStart administratie kunnen koppelen
2. Meerdere gebruikers de MCP server kunnen gebruiken
3. SnelStart certificering behaald wordt
---
## Fase 1: Voorbereiding & Aanvraag (Week 1)
### 1.1 SnelStart Aanvraag Indienen
- [ ] Formulier invullen op https://www.snelstart.nl/api
- [ ] Webhook URL opgeven (nog te bepalen)
- [ ] Wachten op goedkeuring (max 3 weken)
### 1.2 Infrastructuur Voorbereiden
- [ ] Supabase project aanmaken voor user management
- [ ] Domein kiezen (bijv. `snelstart-connector.nl` of subdomain)
- [ ] Vercel/hosting setup
---
## Fase 2: Web Portal Bouwen (Parallel aan wachten)
### 2.1 Project Setup
```
snelstart-portal/
├── app/ # Next.js App Router
│ ├── page.tsx # Landing page
│ ├── auth/
│ │ ├── login/ # Supabase auth
│ │ └── callback/ # OAuth callback
│ ├── dashboard/ # User dashboard
│ │ ├── page.tsx # Overzicht gekoppelde administraties
│ │ └── connect/ # SnelStart OAuth flow starten
│ ├── api/
│ │ ├── webhooks/ # SnelStart webhooks
│ │ └── mcp-token/ # Token voor MCP server
│ └── docs/ # Installatie instructies
├── components/
├── lib/
│ ├── supabase/
│ └── snelstart/
└── ...
```
### 2.2 Database Schema (Supabase)
```sql
-- Users (via Supabase Auth)
-- Gekoppelde administraties
CREATE TABLE connections (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID REFERENCES auth.users(id),
snelstart_admin_id TEXT NOT NULL,
admin_name TEXT,
access_token_encrypted TEXT,
refresh_token_encrypted TEXT,
token_expires_at TIMESTAMPTZ,
scopes TEXT[],
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW()
);
-- MCP tokens (voor CLI authenticatie)
CREATE TABLE mcp_tokens (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID REFERENCES auth.users(id),
token_hash TEXT UNIQUE NOT NULL,
name TEXT,
last_used_at TIMESTAMPTZ,
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- Webhook events log
CREATE TABLE webhook_events (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
connection_id UUID REFERENCES connections(id),
event_type TEXT NOT NULL,
payload JSONB,
processed_at TIMESTAMPTZ,
created_at TIMESTAMPTZ DEFAULT NOW()
);
```
### 2.3 Core Features
- [ ] User registration/login (Supabase Auth)
- [ ] SnelStart OAuth connect flow
- [ ] Dashboard met gekoppelde administraties
- [ ] MCP token genereren/beheren
- [ ] Webhook endpoint voor SnelStart events
---
## Fase 3: MCP Server Aanpassen
### 3.1 Token-based Authentication
```typescript
// Nieuwe auth flow
// npx snelstart-mcp --token=mcp_xxx
// Server haalt credentials op via API:
// GET https://portal.example.com/api/mcp/credentials
// Authorization: Bearer mcp_xxx
// Response: { connections: [...], tokens: [...] }
```
### 3.2 Nieuwe Configuratie Opties
```bash
# Huidige manier (maatwerk, blijft werken)
SNELSTART_ADMINS=vca
SNELSTART_VCA_KEY=xxx
SNELSTART_VCA_SUBSCRIPTION=yyy
# Nieuwe manier (productie)
SNELSTART_MCP_TOKEN=mcp_xxx
SNELSTART_PORTAL_URL=https://portal.example.com
```
### 3.3 Multi-tenant Support
- [ ] Token validatie tegen portal API
- [ ] Credentials caching met TTL
- [ ] Automatische token refresh via portal
---
## Fase 4: Webhook Implementatie
### 4.1 Webhook Events Afhandelen
```typescript
// POST /api/webhooks/snelstart
{
"event": "boeking.created",
"administratie_id": "xxx",
"data": { ... }
}
```
### 4.2 Mogelijke Use Cases
- Real-time notificaties naar gebruikers
- Cache invalidatie
- Audit logging
---
## Fase 5: Certificering
### 5.1 Voorbereiden
- [ ] Alle endpoints testen
- [ ] Error handling verifiëren
- [ ] Rate limiting implementeren
- [ ] Logging voor audit trail
### 5.2 Certificering Aanvragen
- [ ] Formulier invullen bij SnelStart
- [ ] 12 dagen monitoring periode
- [ ] Permanente productiesleutel ontvangen
---
## Fase 6: Launch
### 6.1 Documentatie
- [ ] README updaten met portal instructies
- [ ] Video tutorial maken
- [ ] FAQ pagina
### 6.2 Release
- [ ] npm package publishen
- [ ] GitHub release
- [ ] Aankondiging
---
## Tijdlijn
| Week | Activiteit |
|------|------------|
| 1 | Aanvraag indienen, Supabase setup, project scaffolding |
| 2-3 | Web portal bouwen (parallel aan wachten op SnelStart) |
| 3-4 | OAuth flow implementeren zodra credentials binnen |
| 4-5 | MCP server aanpassen, testen |
| 5-6 | Webhook implementatie |
| 6-7 | Certificering aanvragen + periode |
| 8 | Launch 🚀 |
---
## Open Vragen voor SnelStart
1. Welke scopes zijn beschikbaar voor OAuth?
2. Welke webhook events worden ondersteund?
3. Rate limits voor productie?
4. Zijn er sandbox/test administraties beschikbaar?
---
## Technische Stack
| Component | Technologie |
|-----------|-------------|
| Portal Frontend | Next.js 14, Tailwind, shadcn/ui |
| Portal Backend | Next.js API Routes |
| Database | Supabase (Postgres) |
| Auth | Supabase Auth + SnelStart OAuth |
| Hosting | Vercel |
| MCP Server | Node.js/TypeScript (bestaand) |
| Package | npm (publiek) |