This is a Next.js project with Payload CMS integration for content management.
- Payload CMS for content management
- Hero Image Slider - Rotating hero images managed through Payload CMS
- Stripe Payment Integration - View and manage Stripe payments in the CMS
- SQLite for local development
- Turso for production database
- Node.js 18+
- npm, yarn, pnpm, or bun
- Install dependencies:
npm install- Set up environment variables:
Create a .env.local file in the root directory with the following variables:
# Payload CMS Configuration
PAYLOAD_SECRET=your-secret-key-change-in-production
PAYLOAD_PUBLIC_SERVER_URL=http://localhost:3000
# Database Configuration (for production with Turso)
# Leave these empty for local development (SQLite will be used automatically)
TURSO_DATABASE_URL=
TURSO_AUTH_TOKEN=
# Stripe Configuration
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
# Node Environment
NODE_ENV=development- Run the development server:
npm run dev- Open http://localhost:3000 to view the site
- Open http://localhost:3000/admin to access Payload CMS admin panel
- When you first access
/admin, you'll be prompted to create an admin user - After creating your admin user, you can:
- Upload media files
- Create hero images for the slider
- View Stripe payments (after setting up webhooks)
- Go to
/adminand navigate to Hero Images collection - Click Create New to add a new hero image
- Fill in:
- Title: The heading text for the slide
- Image: Upload an image (will be related to Media collection)
- Caption: Optional subtitle text
- Link: Optional link URL
- Order: Number to control display order (lower numbers appear first)
- Active: Checkbox to enable/disable the slide
- The hero slider will automatically rotate through active images every 5 seconds
To automatically sync Stripe payments to Payload CMS:
- In your Stripe Dashboard, go to Developers > Webhooks
- Add a new endpoint:
https://your-domain.com/api/stripe-webhook - Select events to listen for:
payment_intent.succeededpayment_intent.payment_failedpayment_intent.canceledcharge.succeededcharge.failed
- Copy the webhook signing secret and add it to your
.env.localasSTRIPE_WEBHOOK_SECRET
You can manually sync existing Stripe payments by calling:
POST /api/sync-stripe-paymentsThis will fetch the last 100 payments from Stripe and sync them to Payload CMS.
All synced payments are available in the Payload CMS admin under Stripe Payments collection. You can view:
- Payment ID
- Amount
- Status
- Customer email
- Payment method
- Description
- Metadata
The project uses SQLite for local development. The database file (payload.db) will be created automatically in the project root when you first run the app.
For production, configure Turso:
- Create a Turso account and database at turso.tech
- Get your database URL and auth token
- Set environment variables:
TURSO_DATABASE_URL: Your Turso database URLTURSO_AUTH_TOKEN: Your Turso auth tokenNODE_ENV=production
The app will automatically use Turso when these environment variables are set in production.
├── payload.config.ts # Payload CMS configuration
├── src/
│ ├── app/
│ │ ├── api/
│ │ │ ├── payload/ # Payload API routes
│ │ │ ├── hero-images/ # Hero images API
│ │ │ └── stripe-webhook/ # Stripe webhook handler
│ │ └── admin/ # Payload admin interface
│ └── components/
│ └── hero.tsx # Hero slider component
This project can be deployed on platforms that support Next.js server-side rendering:
- Vercel
- Netlify
- Railway
- Any Node.js hosting platform
Make sure to set all environment variables in your hosting platform's environment settings.