# Cal.com Scheduling Platform

> Cal.com open-source scheduling platform for appointments and meetings.

- Category: Productivity & Collaboration
- Difficulty: intermediate
- Components: calcom, postgres, prisma-studio
- Tags: calcom, scheduling, calendar, booking, calendly-alternative
- Source: https://docker.recipes/productivity/cal-com-scheduling

## Overview

Cal.com is an open-source scheduling platform that emerged as a privacy-focused alternative to Calendly and other proprietary booking solutions. Originally founded by Bailey Pumfleet and Peer Richelsen, Cal.com gained significant traction by offering complete data ownership, extensive customization options, and transparent source code. The platform handles appointment scheduling, calendar integration, and automated booking workflows while maintaining full control over user data and branding.

This deployment combines Cal.com's Next.js-based application with PostgreSQL for robust data persistence and Prisma Studio for database administration. PostgreSQL's ACID compliance ensures booking integrity and prevents double-bookings, while its JSON support handles Cal.com's flexible event metadata and user preferences. Prisma Studio provides a visual interface for managing appointments, user profiles, and calendar integrations directly within the database.

This stack is ideal for businesses requiring self-hosted scheduling solutions, developers building custom booking workflows, and organizations with strict data sovereignty requirements. The combination offers enterprise-grade reliability through PostgreSQL's proven stability while maintaining the flexibility to customize booking logic, integrate with internal systems, and comply with regional data protection regulations.

## Features

- Multi-calendar integration with Google Calendar, Outlook, and CalDAV providers for unified availability
- Embeddable booking widgets with custom branding for website integration
- Event type templates with buffer times, location options, and custom questions
- Team scheduling with round-robin assignment and collective availability
- Webhook support for CRM integration and automated workflow triggers
- PostgreSQL-backed appointment conflict resolution and timezone handling
- Prisma Studio visual database browser for booking analytics and user management
- Self-hosted data control with GDPR compliance and custom data retention policies

## Use cases

- Healthcare clinics managing patient appointments with custom intake forms
- Consulting firms offering client discovery calls with team member routing
- Educational institutions scheduling student advisement and office hours
- SaaS companies providing demo bookings with CRM integration
- Service businesses replacing Calendly with branded self-hosted solution
- Development teams building custom scheduling features using Cal.com's API
- Organizations requiring data sovereignty for sensitive client interactions

## Prerequisites

- Minimum 2GB RAM for PostgreSQL database operations and Cal.com application
- Available ports 3000 (Cal.com), 5432 (PostgreSQL), and 5555 (Prisma Studio)
- Environment variables for database credentials and NextAuth configuration
- Valid domain name or localhost setup for calendar provider OAuth callbacks
- Basic understanding of PostgreSQL database management and Prisma ORM
- Calendar provider API credentials (Google, Microsoft) for integration setup

## docker-compose.yml

```yaml
services:
  calcom:
    image: calcom/cal.com:latest
    container_name: calcom
    environment:
      - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/calcom
      - NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
      - CALENDSO_ENCRYPTION_KEY=${CALENDSO_ENCRYPTION_KEY}
      - NEXT_PUBLIC_WEBAPP_URL=${NEXT_PUBLIC_WEBAPP_URL}
      - NEXT_PUBLIC_API_V2_URL=${NEXT_PUBLIC_WEBAPP_URL}/api/v2
      - NEXT_PUBLIC_LICENSE_CONSENT=agree
      - CALCOM_TELEMETRY_DISABLED=1
    ports:
      - "3000:3000"
    depends_on:
      postgres:
        condition: service_healthy
    networks:
      - calcom-network

  postgres:
    image: postgres:16-alpine
    container_name: calcom-db
    environment:
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=calcom
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
      interval: 10s
      timeout: 5s
      retries: 5
    networks:
      - calcom-network

  prisma-studio:
    image: timothyjmiller/prisma-studio:latest
    container_name: calcom-prisma
    environment:
      - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/calcom
    ports:
      - "5555:5555"
    depends_on:
      - postgres
    networks:
      - calcom-network

volumes:
  postgres_data:

networks:
  calcom-network:
    driver: bridge
```

## .env

```bash
# Cal.com
POSTGRES_USER=calcom
POSTGRES_PASSWORD=calcom_password
NEXTAUTH_SECRET=your-nextauth-secret-32-chars
CALENDSO_ENCRYPTION_KEY=your-encryption-key-32-chars
NEXT_PUBLIC_WEBAPP_URL=http://localhost:3000
```

## Usage notes

- App at http://localhost:3000
- Prisma Studio at http://localhost:5555
- Run database migrations first
- Supports Google, Outlook calendars
- Embeddable booking widgets

## Troubleshooting

- Database connection refused: Verify POSTGRES_USER and POSTGRES_PASSWORD match between services and check PostgreSQL container health status
- NextAuth configuration errors: Ensure NEXTAUTH_SECRET is set to a secure random string and NEXT_PUBLIC_WEBAPP_URL matches your domain
- Calendar integration failures: Verify OAuth callback URLs in Google/Microsoft console match your NEXT_PUBLIC_WEBAPP_URL domain
- Prisma Studio connection timeout: Confirm DATABASE_URL format and ensure PostgreSQL container is fully initialized before Prisma startup
- Booking conflicts not prevented: Check PostgreSQL timezone settings and verify Cal.com database migrations completed successfully
- CALENDSO_ENCRYPTION_KEY errors: Generate a secure 32-character encryption key for booking data protection

