An e-commerce experiment named Antigravity: a React storefront, an Express and Prisma backend, guest checkout and cron-driven abandoned cart emails sent with Resend.
A full-stack e-commerce experiment built under the name Antigravity. It has a React storefront with guest checkout and an Express backend that emails shoppers who leave items in their cart. A cron job finds abandoned carts and sends an HTML reminder through Resend.
It is useful as a worked example of the abandoned-cart flow, from cart API to scheduled email.
- Guest checkout: no account is needed to buy.
- Abandoned cart recovery: a cron job runs every 15 minutes and emails shoppers with product images, quantities, prices, the cart total and a link back to checkout.
- Cart API: create or get a cart, add items, set the cart email and check out.
- Connection resilience: retry with exponential backoff (3 attempts), 10-second request timeouts and a connection status banner in the UI.
- Logging and health checks: request logging, cart and email operation logs, and
GET /healthwith database status. - Email fallback: falls back to Ethereal for emails when Resend is not configured.
- Tests: a test script for email sending and curl examples for the cart API.
| Layer | Tool |
|---|---|
| Frontend | React, TypeScript, Vite, Tailwind CSS |
| UI | shadcn/ui, React Router, Sonner |
| Backend | Node.js with Express |
| Database | Prisma with SQLite |
| Resend | |
| Scheduling | node-cron |
- Node.js 18 or later and npm
- A Resend API key
git clone https://github.com/Studio1HQ/Antigravity-experiment.git
cd Antigravity-experiment
npm install
cd backend && npm install
cd ../frontend && npm install
cd ../backend
cp .env.example .env
npx prisma generate
npx prisma db pushEdit backend/.env.
| Variable | Description |
|---|---|
DATABASE_URL |
Prisma database URL. Use file:./dev.db for SQLite in development. |
RESEND_API_KEY |
Resend API key from resend.com/api-keys. Verify your domain in Resend for production. |
PORT |
Optional backend port, 4000 by default. |
Start both servers from the project root with the root script:
npm run devOr run them separately:
cd backend && npm run dev
cd frontend && npm run dev- Frontend: http://localhost:5173
- Backend: http://localhost:4000
- Health check: http://localhost:4000/health
Test email sending and the cart API:
cd backend
node src/test-email.js your-email@example.com
curl -X POST http://localhost:4000/api/cart -H "Content-Type: application/json" -d '{}'
curl -X POST http://localhost:4000/api/cart/items -H "Content-Type: application/json" \
-d '{"cartId":"YOUR_CART_ID","productId":"1","quantity":1,"price":299.99}'- The user browses products and adds to the cart (
POST /api/cart/items). - The user enters an email (
POST /api/cart/email). - If they leave, the cart stays active.
- The cron job in
backend/src/services/cronService.jsruns every 15 minutes (*/15 * * * *), finds abandoned carts and sends the email. - The email links back to checkout, and the purchase completes with
POST /api/cart/checkout.
| Endpoint | Purpose |
|---|---|
POST /api/cart |
Create or get a cart |
POST /api/cart/items |
Add an item |
POST /api/cart/email |
Update the cart email |
POST /api/cart/checkout |
Complete checkout |
GET / |
API status |
GET /health |
Health check with database status |
To change the schedule, edit cronService.js. To change the email template or colors, edit sendAbandonedCartEmail in backend/src/services/resendService.js. To add products, edit frontend/src/data/products.ts and backend/src/data/products.js.
frontend/ React storefront (components, CartContext, pages, config.ts)
backend/ Express API (controllers, routes, services, Prisma schema)
The backend also includes services/tensorlake.js and a receipt controller. Both are mock stubs that log events and return sample items. They do not call a live API.
For production, use PostgreSQL or MySQL, set DATABASE_URL, run npx prisma migrate deploy, deploy the backend to a Node host, build the frontend with npm run build for static hosting and set API_BASE_URL in frontend/src/config.ts.
- Resend: email API used for reminders.
- Prisma: ORM for the cart data.
- shadcn/ui: UI components.
- Pixabay: source of the product images.
Built by Studio1, the technical content and DevRel partner for devtool teams.
Browse more open-source examples at github.com/Studio1HQ.
studio1hq.com · Technical content, docs, video and DevRel for devtools