Self-hosting coming soon

We're still working on the self-hosting release. This guide will be available when we launch. For now, use CroissantPay Cloud or get in touch to be notified when self-hosting is ready.

Self-Hosting Guide

Deploy CroissantPay on your own infrastructure with Docker. (Coming soon.)

Requirements

  • Docker and Docker Compose installed
  • At least 1 GB RAM and 10 GB storage
  • PostgreSQL 14+ (included in Docker Compose)
  • Domain with SSL for webhooks (optional for development)

Quick Start

The fastest way to get CroissantPay running locally.

Terminal
# Clone the repository
git clone https://github.com/croissantpay/croissantpay.git
cd croissantpay

# Start with Docker Compose
docker compose up -d

# CroissantPay is now running at http://localhost:3000

Configuration

Create a .env file to configure CroissantPay.

.env
# Database
DATABASE_URL=postgresql://croissantpay:croissantpay@localhost:5432/croissantpay

# Deployment mode (self-hosted or cloud)
CROISSANTPAY_DEPLOYMENT_MODE=self-hosted

# Authentication
BETTER_AUTH_SECRET=your-secret-key-at-least-32-chars
BETTER_AUTH_URL=http://localhost:3000

# Optional: Email notifications (using Resend)
RESEND_API_KEY=re_xxxxxxxxxxxxx
EMAIL_FROM="CroissantPay <noreply@yourdomain.com>"

Database Setup

Run database migrations to create the required tables.

Terminal
# Using Docker
docker compose exec web pnpm db:push

# Or locally
cd apps/web
pnpm db:push

Production Deployment

For production, you'll want to configure SSL and use a proper domain.

SSL / HTTPS

Apple and Google webhooks require HTTPS. Use a reverse proxy like Nginx or Traefik with Let's Encrypt.

docker-compose.prod.yml (with Traefik)
services:
  traefik:
    image: traefik:v2.10
    command:
      - "--providers.docker=true"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.letsencrypt.acme.tlschallenge=true"
      - "--certificatesresolvers.letsencrypt.acme.email=you@example.com"
      - "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"
    ports:
      - "443:443"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "./letsencrypt:/letsencrypt"

  web:
    labels:
      - "traefik.http.routers.croissantpay.rule=Host(`croissantpay.yourdomain.com`)"
      - "traefik.http.routers.croissantpay.tls.certresolver=letsencrypt"

Production Environment

.env.production
# Use a managed PostgreSQL in production
DATABASE_URL=postgresql://user:password@your-db-host:5432/croissantpay

# Production URL
BETTER_AUTH_URL=https://croissantpay.yourdomain.com

# Strong secret (generate with: openssl rand -base64 32)
BETTER_AUTH_SECRET=your-very-long-random-secret-here

# Enable production mode
NODE_ENV=production

Webhook Configuration

Configure Apple and Google to send webhook notifications to your instance.

Apple App Store

In App Store Connect → App → App Store Server Notifications

https://croissantpay.yourdomain.com/api/webhooks/apple

Google Play

In Play Console → App → Monetization → Real-time notifications

https://croissantpay.yourdomain.com/api/webhooks/google

Backups

Set up automated database backups for production.

backup.sh
#!/bin/bash
# Daily PostgreSQL backup
DATE=$(date +%Y-%m-%d)
pg_dump $DATABASE_URL | gzip > "/backups/croissantpay-$DATE.sql.gz"

# Keep last 30 days
find /backups -name "croissantpay-*.sql.gz" -mtime +30 -delete

Important Notes

  • • Keep your BETTER_AUTH_SECRET secure and never commit it to git
  • • Store Apple/Google credentials securely, consider using a secrets manager
  • • Monitor disk space as webhook logs can grow over time
  • • Test your webhook endpoints after deployment