# NALU AI — Site Brief

> Reference doc for context after compaction. Last updated: 2026-05-09.
> Comics/quadrinhos sections: placeholders only — user generates images in Gemini separately.
> APIs: ALL 12 validators already implemented and functional in the backend.

## Stack

- Razor Pages + TailwindCSS + HTMX (inside same ASP.NET Core 9 project)
- Stripe (analyze qrrapido for patterns — price_data dynamic, idempotency keys)
- Database: TBD (confirm schema before implementing)
- MCP: Streamable HTTP primary + SSE fallback

## Pages

```
/                    Landing (one-page, all sections)
/playground          Public test, no auth, 50 calls/IP/day
/docs                Docs hub
/docs/quickstart
/docs/api-reference
/docs/mcp
/docs/state-machine  State machine concept + Mermaid diagrams
/validadores         Grid of 12 validators
/validadores/{id}    Individual validator page
/casos               Use case hub (SEO)
/casos/extrator-de-nome
/casos/parcelas-48x
/casos/cep-via-conversa
/casos/cpf-em-chatbot
/precos              Plans + Stripe checkout
/login
/painel              Dashboard + keys + plan + invoices
/sobre
```

## Identity / Branding

- Name: **NALU AI** — NAtural Language Understanding
- Color rule: NA (Natural) = light color, LU = dark color, same across logo + subtitle
- Font: Inter or Plus Jakarta Sans (Google Fonts)
- Minimal, developer-friendly, white background
- Icons: Lucide (line icons)

## Landing sections (in order)

1. Hero — tagline "Seu chatbot está gravando 'Bom Dia' como nome do cliente"
2. Before/after demo (3 examples: name, parcelas 48x, CEP errado)
3. How it works (3 steps)
4. **[COMIC PLACEHOLDER 1]** — `<img src="/images/comic-1-pt.webp">`
5. Validator catalog grid (Universal 7 + Brasil 5)
6. State machine section — how validators chain into flows
7. **[COMIC PLACEHOLDER 2]** — `<img src="/images/comic-2-pt.webp">`
8. Code snippets (tabs: cURL | JS | C# | Python | n8n)
9. Pricing summary (3 cols)
10. FAQ (5 questions)
11. **[COMIC PLACEHOLDER 3 — optional]** — `<img src="/images/comic-3-pt.webp">`
12. Final CTA + footer

## Plans / Pricing

| Plan       | Price      | Requests/month |
|------------|------------|----------------|
| Free       | R$ 0       | 2.000 (100/day rolling) |
| Indie      | R$ 49/mês  | 25.000 |
| Pro        | R$ 149/mês | 100.000 |
| Enterprise | Consulta   | 500k+ |

## Playground

- Endpoint: `POST /v1/playground/extract/{validator}` (no auth, rate limit by IP)
- Rate limit: 50 calls/IP/day — on exceed: prompt to sign up
- Shows side-by-side: "bot tradicional" vs "NALU AI"
- Dropdown with all validators + pre-loaded examples from `.md` files
- "Ver código" button shows cURL/JS/C# equivalent

## Stripe (CRITICAL — replicate qrrapido patterns)

- `price_data` dynamic — NO hardcoded `price_id`
- Idempotency keys on all mutations
- Webhooks with idempotence table (`webhook_events` with `event_id` PK)
- Mandatory events: checkout.session.completed, subscription.updated, subscription.deleted, invoice.payment_failed
- Validate `Stripe-Signature` header on every webhook

## API Keys

- Prefix: `nalu_` + hash
- Show full key ONCE after creation only
- Store HASH only (not plaintext)
- Allow multiple keys per account
- Soft-delete for revocation (keep for audit)
- Rate limit tied to PLAN, not to individual key

## MCP / Smithery

- Analyze qrrapido for ALL adjustments made for Smithery compatibility
- Transport: Streamable HTTP (`POST /mcp`) primary, SSE fallback (`GET /sse`)
- Header required: `MCP-Protocol-Version: 2025-11-25`
- `smithery.yaml` with API key config schema
- CORS: allow Smithery origin + MCP client origins

## Database schema (to confirm before implementing)

Tables needed:
- `users` (id, email, plan, stripe_customer_id, created_at)
- `api_keys` (id, user_id, key_hash, prefix, name, revoked_at, created_at)
- `usage` (id, api_key_id, date, count)
- `webhook_events` (event_id PK, event_type, processed_at)

## SEO pages (/casos)

Template per page:
1. H1: "Como [resolver X] em chatbots"
2. Intro: real problem story
3. "O bug em ação" — dialogue diagram
4. "Como NALU resolve" — API response
5. Code tabs
6. CTA → playground

## Priority order

Landing → Playground → Precos+Stripe → Painel → Docs → Casos

## DO NOT implement now (V2+)

- Detailed call logs
- Custom validators
- Advanced analytics
- Team management
- Comic images (user generates externally)
