Skip to content

About

Generate React components from plain English with the Cursor SDK. Streaming chat, live sandboxed preview and code view. Next.js 14 + Tailwind. Made for the Cursor Rajkot workshop.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

AI Component Builder

Generate React components from natural language using the Cursor SDK and Next.js 14.

Setup

  1. Install dependencies:
npm install
  1. Copy the environment template and add your API key:
cp .env.local.example .env.local

Get a key from Cursor Dashboard → Integrations.

  1. Start the dev server:
npm run dev

Open http://localhost:3000.

Environment

Variable Description
CURSOR_API_KEY Cursor API key (server-side only)

Architecture

  • Client: Chat panel + output panel (preview/code tabs) via useGenerate hook
  • API: POST /api/generate streams SSE deltas from @cursor/sdk
  • Preview: iframe with Babel standalone + React UMD + Tailwind CDN
  • Syntax highlighting: Shiki with tokyo-night theme

Scripts

npm run dev      # Development server
npm run build    # Production build
npm run start    # Production server
npm run lint     # ESLint
npx tsc --noEmit # Type check

Design

UI follows tokens in DESIGN.md (Cursor design system via getdesign).

Out of scope (v1)

  • Authentication and user accounts
  • Chat persistence
  • Redis-backed rate limiting (in-memory limit resets on cold start)
  • Export to CodeSandbox

Rate limiting

The API allows 10 requests per minute per IP using an in-memory map. For production, replace with Redis or a similar store.

Windows note

@cursor/sdk depends on sqlite3, which requires native bindings. If generation fails with a bindings error, run npm rebuild sqlite3 (Visual Studio Build Tools may be required) or install on WSL/Linux.

About

Generate React components from plain English with the Cursor SDK. Streaming chat, live sandboxed preview and code view. Next.js 14 + Tailwind. Made for the Cursor Rajkot workshop.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages