Factory Collective is a fully server-rendered commerce starter built on Next.js 16. It couples Stripe-based product management and checkout with Firebase authentication + profile storage so you can launch collectible marketplaces with confidence.
- Latest Next.js 16 app router with caching (
revalidate: 300) for the storefront and dynamic rendering where cookies are involved (cart + dashboard). - Stripe integration for listing products, generating checkout sessions, and graceful fallbacks when API keys are missing.
- Cookie-backed shopping cart implemented with server actions so state persists across devices and is never exposed to the client.
- Firebase Auth + Firestore to gate the
/dashboardroute and store shipping, billing, and payment preferences. When credentials are absent, it falls back to an in-memory profile store for local development. - Dashboard for updating address, shipping, and payment metadata using server actions and Zod validation.
- Install dependencies
npm install
- Copy
.env.exampleto.env.localand add your secrets (see below). - Run the dev server
npm run dev
- Visit
http://localhost:3000for the storefront,/cartfor the manifest,/loginto authenticate, and/dashboardfor the authenticated profile editor.
Create .env.local with the following values:
# Stripe
STRIPE_SECRET_KEY=sk_test_...
NEXT_PUBLIC_APP_URL=http://localhost:3000
# Firebase client SDK
NEXT_PUBLIC_FIREBASE_API_KEY=...
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=...
NEXT_PUBLIC_FIREBASE_PROJECT_ID=...
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=...
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=...
NEXT_PUBLIC_FIREBASE_APP_ID=...
# Firebase admin SDK
FIREBASE_PROJECT_ID=...
FIREBASE_CLIENT_EMAIL=...
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\\n..."Stripe + Firebase are optional for local UI testing. Without keys, the app will serve mock products, disable checkout redirection, and keep dashboard data inside the dev runtime.
If you need to react to checkout events, create a webhook endpoint (e.g., /api/stripe/webhook) and point your Stripe CLI to it. This starter keeps checkout creation isolated in /api/checkout.
npm run lint— ensure TypeScript + ESLint pass.- Stripe keys present — confirm
/api/checkoutreturns a session URL. - Firebase client + admin keys present — create an account via
/loginand verify/dashboardloads with persisted data in Firestore.
Deploy on any Next-ready host (Vercel, Render, etc.). Ensure env variables are set in the hosting provider.