The Ultimate Guide to Setting Up Open-Source Cal.com Locally!

The Ultimate Guide to Setting Up Open-Source Cal.com Locally!

Your ultimate resource for installing Open-Source Cal.com!

Introduction

Hey there, fellow developers! If you've ever felt the frustration of struggling with local deployment, you're not alone. I've been there, and that's why I'm excited to share my journey with you. In this comprehensive guide, I'll walk you through the process step by step, making local deployment a breeze. Whether you're a seasoned developer or just getting started, this guide is designed to help you navigate the complexities and intricacies of setting up Open-Source Cal.com on your local machine like a Pro.

Prerequisites

  • Git Bash

  • Yarn ( Recommended )

  • Node.Js (Version: >=18.x)

  • Docker and Docker Compose

  • Local or Cloud PostgreSQL server ( Supabase )

What is Cal.com?

Cal.com is an open-source alternative to Calendly. With complete control over data, appearance, and workflow, Cal.com offers self-hosting or managed options, white-label customization, API integration, domain deployment, event customization, and data security. Experience scheduling freedom and efficiency while maintaining full ownership of your scheduling process.

Steps to setup the Cal.com locally

Let's get started without any further delay

Step 1: Project setup

  1. Fork the project from Calcom/cal.com to your personal GitHub.

  2. Clone the repo into your local Windows machine using Git bash with Admin privileges

     git clone -c core.symlinks=true https://github.com/calcom/cal.com.git
    
  3. Open the project folder in your IDE and Install packages with yarn.

     yarn
    
  4. If you don't have yarn install it using the command:

     npm install --global yarn
    
  5. Check that yarn is installed by running:

     yarn --version
    

Step 2: Database Setup

  1. Here I've used Supabase ( an open-source cloud database service ) to work with the database.

  2. Create a new project and set the password.

Copy the URI from Project Settings > Database > Connection String > URI

Step 3: Docker Setup

  1. Check if your Docker is running or not.

  2. If not then start the Docker Desktop Service.

Step 4: .env Setup

  1. Duplicate .env.example to .env using the command:

     cp .env.example .env
    
  2. Replace the copied database URI with the DATABASE_URL & add your project password.

  3. Generate a NEXTAUTH_SECRET using:

     openssl rand -base64 32
    
  4. Generate a CALENDSO_ENCRYPTION_KEY using:

     openssl rand -base64 24
    
  5. If you don't have openssl in your local machine then you can run the command on Git Bash also.

  6. Also, add NEXT_PUBLC_DEBUG=1 anywhere in the .env.

     echo 'NEXT_PUBLIC_DEBUG=1' >> .env
    
  7. Finally, make PRISMA_GENERATE_DATAPROXY=true.

Step 5: Running the project locally

  1. Start the local server using the command yarn dx on the terminal

     yarn dx
    
  2. Open another new terminal and run the command to set up the development environment using the Prisma schema:

     yarn workspace @calcom/prisma db-migrate
    
  3. In a production environment, run:

     yarn workspace @calcom/prisma db-deploy
    
  4. If the project is not running then use the command:

     yarn dev
    

Step 6: Setting up your first user

  1. Open Prisma Studio to look at or modify the database content:

     yarn db-studio
    
  2. It should open on http://localhost:5555/

  3. Click on the user model to add a new user record.

  4. Fill out the fields email, username, password, and set metadata to empty {}

  5. Don't forget to encrypt your password with BCrypt and click Save 1 Record to create your first user.

  6. Open a browser to http://localhost:3000 and login with your just created, first user.

Conclusion:

So in the end I hope that this guide not only helps you set up Cal.com locally but also sparks a sense of achievement in your developer's heart. Happy coding, fellow adventurers!