# Virgin Beans — Be My First

Full-stack specialty coffee webshop: animated storefront, cart & checkout, subscription box
builder, blog, and a complete back office (products, orders, subscriptions, finance, marketing,
social planner, suppliers, media, CMS, users & roles, payments configuration, activity monitor).

## Stack

- **Frontend:** React 19, TypeScript, Vite, Tailwind CSS, framer-motion, react-router
- **Backend:** Hono + tRPC 11, Drizzle ORM
- **Database:** MySQL-compatible (MySQL 8 / TiDB)
- **Auth:** Kimi OAuth (JWT sessions)

## Run locally

```bash
npm install
cp .env.example .env    # fill in your values (see below)
npx drizzle-kit push    # create/upgrade the database schema
npx tsx db/seed.ts      # demo data: products, coupons, blog, content…
npx tsx db/seed-v2.ts   # Kenitra + House Blend + payment methods
npm run dev             # development
```

Production:

```bash
npm run build
npm start               # serves everything on port 3000
```

## Environment variables

See `.env.example`. Required:

| Variable | Purpose |
|---|---|
| `APP_ID`, `APP_SECRET` | App credentials (JWT signing) |
| `DATABASE_URL` | MySQL connection string |
| `KIMI_AUTH_URL`, `KIMI_OPEN_URL`, `VITE_KIMI_AUTH_URL`, `VITE_APP_ID` | Kimi OAuth |
| `OWNER_UNION_ID` | Union ID of the owner account — gets the admin/owner role |

## Deploy with Docker

```bash
docker build -t virgin-beans .
docker run -p 3000:3000 --env-file .env virgin-beans
```

## Structure

```
api/          tRPC routers (shop, admin, auth) + roles & middleware
db/           Drizzle schema + seed scripts
src/          storefront + admin UI (src/pages/admin)
public/       logo, city photos, static assets
contracts/    shared types between frontend and backend
```

## Notes

- The back office lives at `/admin`; sign-in via Kimi OAuth, roles managed under Users & roles
  (owner → admin → manager → sales → user).
- Payment providers (COD, CMI, Stripe, PayPal, bank transfer) are configured under
  Payments in the back office; credentials never reach the storefront.
- All storefront copy (hero, ticker, manifesto…) is editable under Site content.
