# 0seat.dev -- 7-Day Launch Refactoring Plan
**Date:** 2026-03-28
**Status:** READY FOR EXECUTION
**Goal:** Ship a working AI-powered customer support platform in 7 days
**Principle:** Only build what a paying customer touches on day one
---
## The Problem With the Current Codebase
The project (formerly DEBLO Intelligence) has:
- **15 database tables** -- 2 are needed for launch
- **17 dashboard modules** -- 1 is needed for launch
- **50+ AI agents with personalities** -- 1 generic agent is needed for launch
- **4 working API routes** -- ~10 are needed for launch
- **5 marketing pages** -- 1 is needed for launch
- **6 AI models in the UI** -- 1 is needed for launch
- **A Solid.js + Bun + InstantDB stack** -- needs migration
Everything is over-designed and under-implemented. The refactoring is not about adding features -- it is about cutting 90% of the scope and making the remaining 10% actually work.
---
## Tech Stack Decision
### Current Stack (KEEP or MIGRATE?)
| Component | Current | Decision | Reason |
|-----------|---------|----------|--------|
| Frontend framework | Solid.js | **MIGRATE to Svelte 5 + SvelteKit** | ZeroSuite standard. We master it. SSR, auth, API routes built-in. |
| Backend framework | ElysiaJS + Bun | **REPLACE with SvelteKit API routes** | Eliminate a separate API server. One deployment. |
| Database | InstantDB | **MIGRATE to PostgreSQL + Prisma** | ZeroSuite standard. Proven with sh0-website. No vendor lock-in. |
| Styling | Tailwind 3 | **UPGRADE to Tailwind 4** | ZeroSuite standard. |
| Auth | Custom JWT + magic code | **Keep pattern, implement properly** | Magic link auth is good UX. Just wire up email delivery. |
| AI | None (mock data) | **Anthropic SDK (Haiku)** | Same pattern as sh0.dev helpdesk. Proven. |
| Monorepo | Nx + pnpm workspaces | **FLATTEN to single SvelteKit app** | No need for monorepo at this scale. |
### Target Stack
```
Framework: SvelteKit 2 + Svelte 5 runes
Database: PostgreSQL (Prisma ORM)
Styling: TailwindCSS 4
AI: Anthropic SDK (Haiku for chat, Sonnet for analysis)
Auth: Magic link email (Nodemailer/Resend)
Payments: Stripe (usage-based)
Hosting: sh0.dev (dogfooding)
Widget: Vanilla JS embed (`
- Injects floating button + chat panel into host page
- Markdown rendering (include lightweight marked.js build)
- DOMPurify sanitization
- localStorage for session persistence
- Works on any website (isolated styles, shadow DOM or scoped CSS)
- Serve widget.js from SvelteKit static route
**Deliverable:** Paste one script tag on any website, get a working AI chat widget.
### Day 3: Agent Inbox
**Morning:**
- Dashboard layout: sidebar nav + main content area
- `GET /api/conversations` -- List conversations (paginated, filterable by status)
- `GET /api/conversations/[id]` -- Full conversation with messages
- `PATCH /api/conversations/[id]` -- Update status
**Afternoon:**
- Inbox page (`/inbox`):
- Left: conversation list (visitor name, first message preview, status badge, time)
- Right: selected conversation transcript (chat-bubble layout)
- Status dropdown (open -> resolved -> spam)
- Visitor info header (name, email, IP, page URL)
- Real-time polling (fetch every 10 seconds, or SSE push later)
**Deliverable:** Tenant logs in, sees all conversations from their widget, reads transcripts, marks resolved.
### Day 4: Knowledge Base + Settings
**Morning:**
- Settings page (`/settings`):
- Tenant name, slug
- Knowledge base textarea (with guidance: "Paste your FAQ, product descriptions, pricing, etc.")
- Widget embed code (read-only, copy button)
- Widget key (read-only)
- API key (secret key, revealable)
**Afternoon:**
- Knowledge base integration into AI prompt:
```
You are a support agent for {tenant.name}.
{tenant.knowledgeBase}
Answer visitor questions using this knowledge base. Be concise and helpful.
If you don't know the answer, say so and suggest they contact support.
```
- Widget customization API (later -- for now, default sh0-style cyan theme)
**Deliverable:** Tenant pastes their FAQ, widget immediately gives informed answers.
### Day 5: Billing
**Morning:**
- Stripe integration:
- `POST /api/billing/checkout` -- Create Stripe Checkout session (Pro plan, $29/month)
- `POST /api/billing/webhook` -- Handle Stripe webhooks (subscription created/updated/cancelled)
- `GET /api/billing/portal` -- Redirect to Stripe Customer Portal
- Free tier enforcement: count conversations this month, reject widget requests at limit (100/month)
**Afternoon:**
- Billing page (`/billing`):
- Current plan badge (Free / Pro)
- Usage: X / 100 conversations this month (free) or "Unlimited" (pro)
- Upgrade button -> Stripe Checkout
- Manage subscription -> Stripe Portal
- Conversation limit check in widget endpoint
**Deliverable:** Free users hit 100-conversation limit. Upgrade button works. Stripe charges $29/month.
### Day 6: Landing Page + Polish
**Morning:**
- Landing page (`/`):
- Hero: "AI support for your website. One script tag. $0 to start."
- Live demo: embedded widget on the landing page itself (meta: 0seat answers questions about 0seat)
- How it works: 3 steps (Sign up -> Paste widget -> Visitors get answers)
- Pricing: Free (100 convos/month) | Pro ($29/month, unlimited)
- CTA: "Get started free"
**Afternoon:**
- Polish:
- Error states, loading states, empty states in all pages
- Mobile responsive inbox
- Widget dark mode detection (match host site)
- Meta tags, OG images, favicon
- `robots.txt`, `sitemap.xml`
**Deliverable:** A complete marketing + product experience.
### Day 7: Deploy + Launch
**Morning:**
- Deploy to sh0.dev (dogfooding)
- DNS: 0seat.dev -> sh0 server
- SSL via Caddy (automatic)
- Test full flow: sign up -> onboard -> embed widget -> visitor chats -> agent reads transcript
- Stripe production keys
**Afternoon:**
- Write launch announcement
- Post on Twitter/X, LinkedIn
- Submit to Product Hunt (schedule)
- Email first 10 potential customers (businesses already using sh0.dev)
- Monitor: conversations, errors, billing
**Deliverable:** 0seat.dev is live. First customers onboarding.
---
## What to Salvage From the Old Codebase
### KEEP (as reference in `/legacy/`)
| Asset | Why | Where to use |
|-------|-----|-------------|
| Data model concepts | Multi-tenant schema, conversation/message structure | Simplified in new Prisma schema |
| Inbox UI design | 3-column layout, conversation cards, status badges | Rebuild in Svelte 5 with real data |
| LiveChat 4-column layout | Customer intelligence panel, AI suggestions | Future pro feature |
| Approval workflow design | AI-powered approval UX | Future module |
| Marketing copy | Feature descriptions, pricing philosophy | Adapt for landing page |
| AI agent personality system | Tone, style, industry specialization | Future customization feature |
| SMS provider schema | Multi-provider, reliability scoring | Future channel |
| Plugin architecture | Tenant-aware feature flags | Future extensibility |
### DELETE (do not port)
- All mock data and hardcoded metrics
- The 17-module dashboard grid
- The 50+ AI agent showcase
- The multi-model routing UI (Claude + GPT + Grok + Llama)
- The prelaunch modal and email-to-localStorage
- The keyword-based fake AI assistant
- The Nx monorepo configuration
- The Bun runtime dependency
- The InstantDB integration
- All workspace packages (@deblo/ui-kit, @deblo/contexts, @deblo/plugins, etc.)
- The 3,318-line homepage
---
## Post-Launch Roadmap (Only When Customers Ask)
| Feature | Trigger |
|---------|---------|
| Agent replies (human takeover) | First customer who asks to reply manually |
| Email notifications for new conversations | First customer who misses a conversation |
| WhatsApp channel | First customer who needs WhatsApp support |
| Multiple seats / team members | First customer with >1 agent |
| Custom widget branding (colors, logo) | First customer who asks for white-label |
| Conversation analytics | 100+ conversations in the system |
| SMS channel | First African customer who needs SMS |
| Campaign broadcasts | First customer who wants proactive outreach |
| API for integrations | First developer customer |
| Multi-language AI | First non-English/French customer |
**The rule:** No feature gets built until a customer -- a real person paying real money or actively using the free tier -- requests it. Ideas go in a backlog. The backlog is not a commitment. It is a parking lot.
---
## Success Metrics (Day 30)
| Metric | Target |
|--------|--------|
| Tenants signed up | 50+ |
| Active widgets (>1 conversation) | 20+ |
| Total conversations | 1,000+ |
| Paying customers (Pro plan) | 5+ |
| MRR | $145+ |
| Widget load time | < 200ms |
| AI response time (first token) | < 1.5s |
| Uptime | 99.9% |
---
## File Structure (New)
```
0seat.dev/
├── legacy/ # Old codebase (read-only reference)
│ ├── apps/api/
│ ├── apps/web-dashboard/
│ └── apps/web-public/
├── prisma/
│ └── schema.prisma # 4 tables
├── src/
│ ├── lib/
│ │ ├── server/
│ │ │ ├── db.ts # Prisma client
│ │ │ ├── auth.ts # Magic link + session
│ │ │ ├── ai.ts # Anthropic client + prompt builder
│ │ │ └── billing.ts # Stripe integration
│ │ ├── components/
│ │ │ ├── Inbox.svelte # Conversation list
│ │ │ ├── Transcript.svelte # Message thread
│ │ │ └── layout/
│ │ └── stores/
│ ├── routes/
│ │ ├── +layout.svelte # Root layout
│ │ ├── +page.svelte # Landing page
│ │ ├── (app)/ # Auth-protected routes
│ │ │ ├── inbox/+page.svelte
│ │ │ ├── settings/+page.svelte
│ │ │ └── billing/+page.svelte
│ │ ├── api/
│ │ │ ├── auth/
│ │ │ ├── widget/chat/ # Public widget endpoint
│ │ │ ├── conversations/
│ │ │ └── billing/
│ │ └── widget.js/+server.ts # Serve embeddable widget script
├── static/
│ └── widget/ # Widget assets (compiled JS)
├── CLAUDE.md
├── REFACTORING-PLAN.md # This file
├── package.json
└── svelte.config.js
```
---
*This plan was written after exploring every file in the old codebase. The old code is not wasted -- it is education. The new code will be smaller, real, and live.*