Standalone Product 1 - Generative UI, Asset Management, and Prompt Engineering
The AI Editor is a standalone Full-Stack Package (FSP) that provides generative UI capabilities, asset management, and prompt engineering features. It is designed to run independently, even if Commerce or CMS packages are missing.
- Generative UI components
- Asset Management
- Prompt Engineering
- Asynchronous AI processing (via BullMQ workers)
This package must run even if Commerce or CMS are missing. It owns its own data schema (EditorSchema) and can function as a standalone module.
This package follows the Full-Stack Package (FSP) pattern:
- UI Components - React components (Client and Server)
- Server Actions - Next.js Server Actions ('use server')
- Route Handlers - API route factories for mounting
- Workers - BullMQ workers for async processing
- Data Schema - Own Prisma schema with distinct table names
Owns EditorSchema - manages its own Prisma schema and database client.
Tables:
- editor_assets - Asset storage with AI descriptions
- editor_prompt_history - Prompt and generation history
\\�ash pnpm install @repo/ai-editor \\
\\ ypescript import { VisualEditor } from '@repo/ai-editor/ui'; \\
\\ ypescript import { generateText } from '@repo/ai-editor/actions';
// In a Server Component or Server Action const result = await generateText(prompt); \\
\\ ypescript // apps/platform/app/api/ai/[...slug]/route.ts import { createAIHandler } from '@repo/ai-editor/api';
const handler = createAIHandler({ apiKey: process.env.OPENAI_API_KEY, redisUrl: process.env.REDIS_URL, });
export const POST = handler.POST; export const GET = handler.GET; \\
\\ ypescript // apps/platform/scripts/start-worker.ts import { createAIWorker } from '@repo/ai-editor/worker'; import Redis from 'ioredis';
const redis = new Redis(process.env.REDIS_URL!); const worker = createAIWorker(redis); \\
This package uses subpath exports for better tree-shaking:
- @repo/ai-editor - Main entry (components, actions, lib)
- @repo/ai-editor/ui - UI components only
- @repo/ai-editor/api - Route handler factories
- @repo/ai-editor/actions - Server Actions
- @repo/ai-editor/worker - Worker factories
- @repo/ai-editor/types - TypeScript types and Zod schemas
\\�ash
pnpm install
pnpm prisma:generate
pnpm build
pnpm prisma:migrate \\
- react - UI components
- next - Server Actions and Route Handlers (peer dependency)
- prisma - Database ORM
- zod - Schema validation
- bullmq - Queue management
- ioredis - Redis connection
- server-only - Prevents server code from leaking to client
MIT License - see LICENSE file for details.