Skip to content

vittalpai/FlashCart

Repository files navigation

FlashCart AI

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.

Stack

  • Next.js App Router + TypeScript
  • CockroachDB + Prisma ORM
  • NextAuth credentials authentication
  • Tailwind CSS
  • Vitest
  • OpenAI API (Codex gpt-5.2-codex model) for campaign generation

Features

  • 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

Project Structure

.
├── app
│   ├── api
│   ├── auth
│   ├── campaigns
│   ├── dashboard
│   ├── globals.css
│   ├── layout.tsx
│   └── page.tsx
├── components
├── lib
├── prisma
├── tests
├── .env.example
├── package.json
└── vitest.config.ts

Setup

  1. Copy .env.example to .env.
  2. Make sure CockroachDB is running and DATABASE_URL points to it.
  3. Install dependencies:
    • PNPM_HOME=/tmp/pnpm-home PATH="/tmp/pnpm-home:$PATH" pnpm install
  4. Generate Prisma client:
    • PNPM_HOME=/tmp/pnpm-home PATH="/tmp/pnpm-home:$PATH" pnpm prisma:generate
  5. Run the first migration:
    • PNPM_HOME=/tmp/pnpm-home PATH="/tmp/pnpm-home:$PATH" pnpm prisma:migrate --name init
  6. Start the app:
    • PNPM_HOME=/tmp/pnpm-home PATH="/tmp/pnpm-home:$PATH" pnpm dev
  7. Run tests:
    • PNPM_HOME=/tmp/pnpm-home PATH="/tmp/pnpm-home:$PATH" pnpm test

CockroachDB Note

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

Environment Variables

  • DATABASE_URL: CockroachDB connection string
  • NEXTAUTH_SECRET: secret for NextAuth JWT signing
  • NEXTAUTH_URL: application base URL
  • OPENAI_API_KEY: OpenAI API key for campaign generation
  • OPENAI_MODEL: optional override, defaults to gpt-5.2-codex

Notes

  • 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.

About

FlashCart AI is an AI-powered campaign builder that helps merchants instantly generate marketing content and product showcase components from selected products.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages