FlashCart AI is a lightweight, end-to-end app that helps merchants go from products to ready-to-use promotions in seconds. Instead of manually writing campaign copy and building UI, users can select products and generate both marketing content and a React showcase component using Codex.
- Next.js App Router + TypeScript
- CockroachDB + Prisma ORM
- NextAuth credentials authentication
- Tailwind CSS
- Vitest
- OpenAI API (Codex
gpt-5.2-codexmodel) for campaign generation
- User signup and login with hashed passwords
- Starter sample products automatically added for first-time users
- Product creation, listing, and deletion
- Campaign builder with multi-product selection
- Codex-powered campaign generation
- Campaign detail page with stored generation output and preview
- Vitest coverage for product creation, campaign creation, and campaign generation API behavior
.
├── app
│ ├── api
│ ├── auth
│ ├── campaigns
│ ├── dashboard
│ ├── globals.css
│ ├── layout.tsx
│ └── page.tsx
├── components
├── lib
├── prisma
├── tests
├── .env.example
├── package.json
└── vitest.config.ts
- Copy
.env.exampleto.env. - Make sure CockroachDB is running and
DATABASE_URLpoints to it. - Install dependencies:
PNPM_HOME=/tmp/pnpm-home PATH="/tmp/pnpm-home:$PATH" pnpm install
- Generate Prisma client:
PNPM_HOME=/tmp/pnpm-home PATH="/tmp/pnpm-home:$PATH" pnpm prisma:generate
- Run the first migration:
PNPM_HOME=/tmp/pnpm-home PATH="/tmp/pnpm-home:$PATH" pnpm prisma:migrate --name init
- Start the app:
PNPM_HOME=/tmp/pnpm-home PATH="/tmp/pnpm-home:$PATH" pnpm dev
- Run tests:
PNPM_HOME=/tmp/pnpm-home PATH="/tmp/pnpm-home:$PATH" pnpm test
If CockroachDB blocks a Prisma schema change because one of the FlashCart tables is schema-locked, unlock the app tables first:
cockroach sql --url "$DATABASE_URL" -f prisma/cockroach-unlock.sql
Or use the package script:
pnpm db:unlock
DATABASE_URL: CockroachDB connection stringNEXTAUTH_SECRET: secret for NextAuth JWT signingNEXTAUTH_URL: application base URLOPENAI_API_KEY: OpenAI API key for campaign generationOPENAI_MODEL: optional override, defaults togpt-5.2-codex
- Campaign generation uses the OpenAI Responses API and stores the prompt plus raw JSON response in CockroachDB.
- The preview section renders a safe visual interpretation of the generated output rather than executing model-authored React code directly in the browser.