CodeGenie is an AI engineering workspace that turns a product brief into a runnable Next.js application. It combines a conversational build loop with generated source files and a live sandbox preview.
- A user signs in with Clerk and describes a product.
- tRPC stores the project and dispatches an Inngest event.
- A durable generation job is dispatched to Inngest with per-project concurrency and cancellation.
- TokenRouter runs Qwen Coder first and a configurable stronger repair model once when validation fails.
- E2B runs the generated project in an isolated sandbox with constrained file tools and no arbitrary package installation.
- CodeGenie validates and saves an immutable, downloadable artifact. Temporary previews can be recreated from it.
- Next.js 15 and React 19
- Clerk authentication
- tRPC and TanStack Query
- Prisma with PostgreSQL
- Inngest background functions
- TokenRouter through the OpenAI-compatible Agent Kit adapter
- E2B cloud sandboxes
- Tailwind CSS, shadcn/ui, and AI Elements
Use Node.js 22 and install dependencies:
nvm use
npm install
npx prisma generateStart the app on port 3008:
npm run devIn a second terminal, start Inngest:
npx inngest-cli@latest dev -u http://localhost:3008/api/inngestOpen http://localhost:3008 and sign in to create a project.
Copy .env.example to .env.local and configure PostgreSQL, Clerk, TokenRouter, E2B, and Inngest. Use a pooled DATABASE_URL for the application and DIRECT_URL for migrations when the database provider supports separate connection strings. Never commit secrets.
The default model policy is:
- Primary:
qwen/qwen3-coder-next - One repair fallback:
openai/gpt-5.4-mini
Both are configurable through environment variables.
- Back up PostgreSQL, then run
npx prisma migrate deploy. - Deploy through Vercel and connect the official Inngest integration to
/api/inngest. - Check
/api/health/live, then call/api/health/readywith thex-health-secretheader. - In Inngest, confirm both
code-agent-v2andcancel-generation-sandboxare registered in the current environment. - Run a small staging generation and confirm it reaches a terminal state, creates an artifact, and settles exactly one credit.
Generation failures are persisted with a sanitized failure code and reference ID. Prompt text, generated files, authentication data, and API keys are filtered from Sentry events. Session Replay is not enabled.
This project is maintained at ArjunDeshwal/codegenie.