Skip to content

calcom/platform-starter-kit

Repository files navigation

Logo

Cal.com Platform Starter Kit

Build your pixel-perfect booking experience

Demo · Video Tutorial · Docs · Deploy on Vercel

Discord · Website · Issues

Platform Starter Kit Example

Cal.com Platform Starter Kit showcases the new Cal.com Platform API and Cal.com Atoms. It was built using the T3 Stack with Supabase as the Postgres Database and Image Storage host.

Deploy your own

Deploy with Vercel

How to use

npx @calcom/starter-kit my-platform

OR

1. Clone the repository

HTTPS:

git clone https://github.com/calcom/platform-starter-kit.git

GitHub CLI:

gh repo clone calcom/platform-starter-kit

2. Move into the Starter

cd platform-starter-kit/

3. Install dependencies

Important

Package Manager: This repository is deployed as-is and therefore contains a pnpm-lock.yaml file. As a result, you currently have to use pnpm as your package manager to ensure that the dependencies are installed correctly.

pnpm install

4. Set Environment Variables

We provide most environment variables out of the box (including Cal-related variables).

So get started by copying the .env.example:

cp .env.example .env

4.1 Database

This project uses Postgres with Supabase. You can create a free project at database.new.

Then, get the Database URL from the Supabase dashboard and update the respective values in your .env file:

POSTGRES_PRISMA_URL="postgres://postgres.YOUR-PROJECT-REF:[YOUR-PASSWORD]@aws-0-[REGION].pooler.supabase.com:6543/postgres?pgbouncer=true&connection_limit=1" # Transaction Mode
POSTGRES_URL_NON_POOLING="postgres://postgres.YOUR-PROJECT-REF:[YOUR-PASSWORD]@aws-0-[REGION].pooler.supabase.com:5432/postgres"  # Session Mode

When working locally you can use the DB URL: postgresql://postgres:postgres@127.0.0.1:54322/postgres outputted by the supabase start command for both vairables.

[Only needed when deploying manually] Initialize the database:

Note that if you used the Vercel Deploy link from above, the Supabase Vercel integration sets this up automatically for you!

pnpm db:init
pnpm db:seed # Will throw an error if DB is already seeded, which you can ignore.

Prisma will create a _prisma_migrations table on the public database schema. In Supabase, the public schema is exposed via the API by default. To secure the table, navigate to the Table Editor, click on "RLS diasbaled" > "Enable RLS for this table".

Alternatively, you can run the follow SQL statement on your database, e.g. via the SQL Editor in the Supabase Dashboard:

ALTER TABLE "public"."_prisma_migrations" ENABLE ROW LEVEL SECURITY;

Lastly, in your Supabase Dashboard create a public avatars bucket to store the profile pictures.

4.2 Authentication

Generate a NextAuth secret and add it to your .env file:

openssl rand -hex 32
# Next Auth
# You can generate a new secret on the command line with
# openssl rand -base64 32
# <https://next-auth.js.org/configuration/options#secret>

AUTH_SECRET="SQhGk****"

4.3 Cal

For development, you're all set! We've provided you with our sandbox keys that you can find the .env.example file.

For production, keep in mind that you'll have to update the NEXT_PUBLIC_REFRESH_URL variable to make it point to your deployment, e.g.:

# 3/ *REFRESH URL.* You have to expose an endpoint that will be used from calcom: https://cal.com/docs/platform/quick-start#4.-backend:-setting-up-refresh-token-endpoint

NEXT_PUBLIC_REFRESH_URL="https://<your-project>.vercel.app/api/cal/refresh"

5. Development Server From here, you're all set. Just start the development server & get going.

pnpm dev

What's next? How do I make an app with this?

We try to keep this project as simple as possible, so you can start with Cal.com Platform and the scaffolding we set up for you, and add additional things later when they become necessary.

If you are not familiar with the different technologies used in this project, please refer to the respective docs.

Learn More about Cal.com Platform

Visit our documentation at cal.com/docs/platform or join our Discord.

Contact sales to purchase a commercial API key here: cal.com/sales.

Learn More about T3

To learn more about the T3 Stack, take a look at the following resources:

You can check out the create-t3-app GitHub repository — your feedback and contributions are welcome!

Learn More about Supabase

Supabase is the fastest way to get up and running with Next.js and Postgres. Check out this video to learn more!

Releases

No releases published

Packages

No packages published