chore: add dev docs on mintlify (#16935)
* --init * progress... * add more docs * bunch of changes and added back platform * development guides added * more guides in develop with cal * self hosted WIP * deployments * fix deployment steps * self-hosted guides * .. * Removed the development only sections * Removed 'with Cal.com' * use steps component for steps --------- Co-authored-by: Keith Williams <[email protected]>
This commit is contained in:
1 parent
66378160df
commit
da55306a5a
55 files changed
+2964
-681
No files matched your search
@@ -0,0 +1,30 @@
|
||||
---
|
||||
title: "How to setup API in a local instance"
|
||||
---
|
||||
|
||||
To test API in your local instance, you have the following pre-requisites:
|
||||
|
||||
<Steps>
|
||||
<Step title="Clone the cal.com repository">
|
||||
Please close the cal.com repository. You can do it by following the instructions provided in [Installation](/developing/local-development)
|
||||
</Step>
|
||||
<Step title="Add license key in .env">
|
||||
Add a staging license key that goes in as value for `CALCOM_LICENSE_KEY` in your root `.env` file.
|
||||
|
||||
You can use the following as staging license key
|
||||
```
|
||||
1a1f8138-0bfc-4f37-b4af-1e24fd145839
|
||||
```
|
||||
</Step>
|
||||
<Step title="Install API submodule">
|
||||
Next, you need to install API submodule by following the instructions provided in [API submodule](/developing/local-development#api)
|
||||
</Step>
|
||||
<Step title="Start development server and create API key">
|
||||
Start the cal.com server using `yarn dev` on localhost and create the test API keys by visiting `/settings/developer/api-keys`
|
||||
</Step>
|
||||
<Step title="Start API server and test API">
|
||||
Start the API server by running `yarn workspace @calcom/api dev` and start testing your API locally
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Info>By default, the app server runs on port 3000 and the API server runs on port 3003</Info>
|
||||
@@ -0,0 +1,25 @@
|
||||
---
|
||||
title: "Adding your first app"
|
||||
---
|
||||
|
||||
Head over to the **apps** page, where you'll find our app store. We suggest firstly adding a calendar integration, then optionally a video conferencing platform, and then try out the other apps.
|
||||
|
||||
<iframe
|
||||
width="560"
|
||||
height="315"
|
||||
src="https://www.youtube.com/watch?v=V6mwvgcAxi0"
|
||||
title="Adding your first app"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen
|
||||
></iframe>
|
||||
|
||||
Find the app you'd like to install, and either click **Install** in the top right of that app's card to add it right away, or click on the app's card to view more details.
|
||||
|
||||
In the details page you can read more about each app, then click **Install** in the top right of the page to add it to your account.
|
||||
|
||||
<img src="./images/i1599x929-tUttNKwBum0Z_p1vwkt.png"
|
||||
legend="The app details page for Google calendar"
|
||||
/>
|
||||
|
||||
If the app requires authentication, for instance to connect your Google Account, a dialog will be opened prompting you to authenticate. Once complete, the app will be successfully installed.
|
||||
@@ -0,0 +1,95 @@
|
||||
---
|
||||
title: "Build a greeter app"
|
||||
---
|
||||
|
||||
## Building a **Greeter** app
|
||||
|
||||
<Steps>
|
||||
<Step title="Create an app">
|
||||
Create an app with the title "**Greeter".** Run the following command and provide the information it is looking for.
|
||||
|
||||
```bash
|
||||
yarn app-store create
|
||||
```
|
||||
|
||||
<iframe
|
||||
width="560"
|
||||
height="315"
|
||||
src="https://cdn.iframe.ly/AK13z2x"
|
||||
title="Step 1"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen
|
||||
></iframe>
|
||||
</Step>
|
||||
<Step title="Install the app">
|
||||
The app is created in Step 1 and we should install it now.
|
||||
</Step>
|
||||
<Step title="Add the functionality">
|
||||
The app is installed but it doesn't do anything because we haven't written added any functionality to it. Let's add a button in the main navigation that greets the user.
|
||||
|
||||
|
||||
1. Create a component `greeter/components/GreeterButton.tsx` - You can name it whatever you want.
|
||||
|
||||
2. Import this component in `Shell.tsx` and add it wherever you want to so that the button is available on all pages.
|
||||
|
||||
```js
|
||||
/**
|
||||
* GreeterButton.tsx
|
||||
* It creates a button that can be added anywhere. The button is visible only if the app is installed.
|
||||
*/
|
||||
import useApp from "@calcom/lib/hooks/useApp";
|
||||
import showToast from "@calcom/lib/notification";
|
||||
import { Button } from "@calcom/ui";
|
||||
|
||||
import useMeQuery from "@lib/hooks/useMeQuery";
|
||||
|
||||
export default function GreeterButton() {
|
||||
const { data: user } = useMeQuery();
|
||||
const { data: greeterApp } = useApp("greeter");
|
||||
// Make sure that greeterApp is installed. We shouldn't show the button when app is not installed
|
||||
if (!user || !greeterApp) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<Button
|
||||
onClick={() => {
|
||||
showToast("Hello, " + user.name, "success");
|
||||
}}
|
||||
>
|
||||
Greet Me!
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
```;
|
||||
/**
|
||||
* Shell.tsx
|
||||
*/
|
||||
// ...
|
||||
import GreeterButton from "@calcom/app-store/greeter/components/GreeterButton";
|
||||
// ...
|
||||
|
||||
<GreeterButton />;
|
||||
```
|
||||
|
||||
<img src="./images/i1280x250-dXnl-QuzSMbl_xydd9y.png" />
|
||||
|
||||
|
||||
A sample line where I used the component in the demo
|
||||
|
||||
<iframe
|
||||
width="560"
|
||||
height="315"
|
||||
src="https://www.loom.com/embed/b0fd31cc11444799af7a6f12a01d4321"
|
||||
title="Step 3"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen
|
||||
></iframe>
|
||||
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
That's it. You now have a fully functional Greeter app. This is the simplest possible demonstration of how you can build an app and what it can do. There are simply no restrictions on what an app can achieve.
|
||||
@@ -0,0 +1,86 @@
|
||||
---
|
||||
title: "How to build an app"
|
||||
---
|
||||
|
||||
Since Cal.com is open source we encourage developers to create new apps for others to use. This guide is to help you get started.
|
||||
|
||||
You can create an app by simply running the following command. It creates a new directory under [`packages/app-store/`](https://github.com/calcom/cal.com/tree/main/packages/app-store)``
|
||||
|
||||
```bash
|
||||
yarn create-app
|
||||
```
|
||||
|
||||
|
||||
You just need to provide a few inputs and then you will have your app created within a few seconds. [See, how you can build a very simple app that greets your users.](/developing/guides/appstore-and-integration/build-a-greeter-app)
|
||||
|
||||
### Steps in creating an app
|
||||
|
||||
<Steps>
|
||||
<Step title="Create app">
|
||||
Create the app using the `create-app` command. The app can be installed now, but at this moment it isn't doing anything. It is just installed and ready to do what you want it to do.
|
||||
</Step>
|
||||
<Step title="Adding the functionalities">
|
||||
There is pretty much no restriction on what an App can do. For example:
|
||||
|
||||
- Hooking into existing functionalities to enhance them - _In all these cases you need to first check if the app is installed or not. There is_ `_useApp(appSlug)_` _react hook to do that. It gives you the app details if the app is installed._
|
||||
- Apps that need to connect with third parties like Google Calendar, Apple Calendar, Google Meet.
|
||||
- A very powerful app that has its own data and pages - [Routing Forms App](https://github.com/calcom/cal.com/tree/main/packages/app-store/ee/routing_forms) is a great example of this.
|
||||
- There are other powerful apps already in the [App Store](https://app.cal.com/apps) that you can get an idea of the capabilities of apps.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
|
||||
### Structure
|
||||
|
||||
All apps can be found under [`packages/app-store`](https://github.com/calcom/cal.com/tree/main/packages/app-store). In this folder is `_baseApp` which shows the general structure of an app.
|
||||
|
||||
```bash
|
||||
├──_example
|
||||
| ├──config.json -> Autogenerated by cli. You are free to edit it.
|
||||
| ├──api
|
||||
| | ├──add.ts -> Autogenerated by cli. You would want to edit it if your app needs to connect with a third party
|
||||
|
|
||||
| ├──components
|
||||
|
|
||||
| ├──static -> Add all static assets here
|
||||
| | ├──icon.svg -> This is used as the logo for your App.
|
||||
|
||||
| ├──index.ts
|
||||
| ├──package.json
|
||||
| ├──.env.example -> Specify the environmental variables (ex. auth token, API secrets) that your app will need if it's applicable
|
||||
| ├──README.mdx -> Customize your app description. You can add an image slider as well.
|
||||
```
|
||||
|
||||
### Other Commands
|
||||
|
||||
**Deleting an app:**
|
||||
|
||||
```bash
|
||||
yarn app-store delete --slug APP_NAME
|
||||
```
|
||||
|
||||
**Editing an app:**
|
||||
|
||||
```bash
|
||||
yarn app-store edit --slug APP_NAME
|
||||
```
|
||||
|
||||
### Important Points
|
||||
|
||||
* Make sure to have `yarn app-store:watch` command running when developing an app so that autogenerated files are always up to date.
|
||||
|
||||
* If app-store cli fails at this step, try to run this command manually first. Solve that problem and then re-run cli. The command can fail because there are Prisma migrations that can't be applied automatically.
|
||||
|
||||
<img src="./images/i1600x120-WfEdMhsOOLSg_sitk6a.png" />
|
||||
|
||||
A sample failure in create command
|
||||
|
||||
* When you edit an app following things aren't updated.
|
||||
|
||||
* README.mdx - It would still have the old description. Feel free to edit it manually.
|
||||
|
||||
### Publishing Your App to the Cal.com App Store
|
||||
|
||||
Once your app is working in your environment, you can publish it to Cal.com App Store by opening a PR [here](https://github.com/calcom/cal.com).
|
||||
|
||||
If you need any help feel free to join us on [Discord](https://go.cal.com/discord).
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
---
|
||||
title: "Assign people to a call from a CRM or database"
|
||||
---
|
||||
|
||||
## Option 1: Based on CRM integration
|
||||
|
||||
If you are working with a CRM such as Salesforce, Hubspot, Close.com or similar, you can use our integrations to connect to your apps.
|
||||
|
||||
We're using the Assignee APIs from each service to understand which person is assigned to an email of a new lead.
|
||||
|
||||
By prefilling your booking link with [email protected] our integration will look up who has spoken to [email protected] before and skip all round-robin logic.
|
||||
|
||||
Here is an example URL: i.cal.com/sales/[email protected]
|
||||
|
||||
This works with Embeds as well, just add the parameter to your CalLink property.
|
||||
|
||||
## Option 2: Based on Emails
|
||||
|
||||
If you are using a different product that we don't integrate with, or you need something more custom you can also achieve this with our Organization plan.
|
||||
|
||||
We've built our Organization system in a way where every email can be turned into a scheduling link with your company subdomain:
|
||||
|
||||
[email protected] → acme.cal.com/jane (or schedule.acme.com/jane)
|
||||
|
||||
This means if you have a table
|
||||
|
||||
| User | AccountExecutive |
|
||||
| :----------- | :----------- |
|
||||
| [email protected] | [email protected] |
|
||||
|
||||
You could show [email protected] an embed inside your application simply by using the value from AccountExecutive to build the link:
|
||||
|
||||
[email protected] → acme.cal.com/jane either with a string replace function or a simple regex.
|
||||
@@ -0,0 +1,33 @@
|
||||
---
|
||||
title: "Integration with HubSpot"
|
||||
---
|
||||
|
||||
To use Cal.com with HubSpot, you only need two things:
|
||||
|
||||
<Steps>
|
||||
<Step title="Pre-requisite">
|
||||
You need to have an account on both platforms
|
||||
</Step>
|
||||
<Step title="Install Hubspot App">
|
||||
You'll need to go to the [HubSpot app page](https://app.cal.com/apps/hubspot) and click the "Install" button ⬇
|
||||
|
||||
<img src="./images/i1599x807-x2DRUUT-DkbF_yljih9.png" />
|
||||
|
||||
|
||||
</Step>
|
||||
<Step title="Choose hubspot account">
|
||||
After clicking the "Install" button, you will need to select the HubSpot account you want to use Cal.com with⬇
|
||||
|
||||
<img src="./images/i1600x1287-XKGU-PMvAkrB_zq004d.png" />
|
||||
</Step>
|
||||
<Step title="Connect app">
|
||||
Then, you will need to give the listed permissions to Cal.com clicking the button "Connect app" in order to manage certain aspects of your account, in order to provide you with the functionality you are looking for. By the way, we are making our app official with HubSpot, so you will not be seeing the warning very soon ⬇
|
||||
|
||||
<img src="./images/i1600x1253-8BQ3KGqrqGTp_xrhqzd.png" />
|
||||
|
||||
</Step>
|
||||
</Steps>
|
||||
---
|
||||
Done! You will be redirected to Cal.com Installed Apps showing your newly installed app ready for you to take advantage of ⬇
|
||||
|
||||
<img src="./images/i1600x813-fFKsveiL2GuM_wk8cv1.png" />
|
||||
@@ -0,0 +1,70 @@
|
||||
---
|
||||
title: "How to use OAuth to authorize apps"
|
||||
---
|
||||
|
||||
As an example, you can view our OAuth flow in action on Zapier. Try to connect your cal.com account [here](https://zapier.com/apps/calcom/integrations).
|
||||
To enable OAuth in one of your apps, you will need a Client ID, Client Secret, Authorization URL, Access Token Request URL, and Refresh Token Request URL.
|
||||
|
||||
<img src="./images/oauth-zapier.png" />
|
||||
|
||||
### OAuth Client Credentials
|
||||
Only the cal.com team can create new OAuth clients. Please contact us at [[email protected]](mailto:[email protected]) with the following details: client name, redirect URI (provided by the app), app logo, and a link to the app.
|
||||
|
||||
The Cal.com team will register the app and provide you with the Client ID and Client Secret. Keep these credentials confidential and secure.
|
||||
|
||||
### Authorization URL
|
||||
To initiate the OAuth flow, direct users to the following authorization URL:
|
||||
- `https://app.cal.com/auth/oauth2/authorize`
|
||||
- URL Parameters:
|
||||
- *client_id*
|
||||
- *state*: A securely generated random string to mitigate CSRF attacks
|
||||
- *redirect_uri*: This is where users will be redirected after authorization
|
||||
- *scope*: Specify the required scopes. Current scopes include READ_BOOKING and READ_PROFILE. Additional scopes can be added as needed.
|
||||
|
||||
After users click *Allow*, they will be redirected to the redirect_uri with the code (authorization code) and state as URL parameters.
|
||||
|
||||
### Access Token Request
|
||||
Endpoint: `POST https://app.cal.com/api/auth/oauth/token`
|
||||
|
||||
Request Body:
|
||||
- *code*: The authorization code received in the redirect URI
|
||||
- *client_id*
|
||||
- *client_secret*
|
||||
- *grant_type*: "authorization_code"
|
||||
- *redirect_uri*
|
||||
|
||||
Response:
|
||||
```json
|
||||
{
|
||||
access_token: “exampleAccessToken”
|
||||
refresh_token: “exampleRefreshToken”
|
||||
}
|
||||
```
|
||||
|
||||
### Refresh Token Request
|
||||
Endpoint: `POST https://app.cal.com/api/auth/oauth/refreshToken`
|
||||
|
||||
Request Body:
|
||||
- *grant_type*: "refresh_token"
|
||||
- *client_id*
|
||||
- *client_secret*
|
||||
|
||||
Response:
|
||||
```json
|
||||
{
|
||||
access_token: “exampleAccessToken”
|
||||
}
|
||||
```
|
||||
|
||||
### Testing OAuth Credentials
|
||||
To verify the correct setup and functionality of OAuth credentials you can use the following endpoint:
|
||||
`GET https://app.cal.com/api/auth/oauth/me`
|
||||
|
||||
Headers:
|
||||
- Authorization: Bearer *exampleAccessToken*
|
||||
|
||||
|
||||
### Authorize requests with Bearer token
|
||||
Ensure that Cal.com endpoints accessed by the app support authentication via Bearer Token.
|
||||
If this is not the case, it will be necessary to update the code accordingly.
|
||||
Here is an example of an endpoint that supports both apiKey and Bearer token authentication: [/listBookings endpoint](https://github.com/calcom/cal.com/blob/main/packages/app-store/zapier/api/subscriptions/listBookings.ts)
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
title: "Setting up OIDC with okta"
|
||||
---
|
||||
|
||||
<Steps>
|
||||
<Step title="Create an application with your OIDC provider">
|
||||
For example, in Okta, once you create an account, you can click on Applications on the sidebar menu:
|
||||
<img src="./images/i1600x900-oVjaQ0tU3AnO_wrzp85.png" />
|
||||
</Step>
|
||||
<Step title="Click on Create App Integration">
|
||||
<img src="./images/i1600x900-wrIlZkLdZ6kL_wf7mxn.png" />
|
||||
</Step>
|
||||
<Step title="Select OIDC in the modal form, along with Web App, and click Next">
|
||||
<img src="./images/i1600x900-IfRWYg8XuCMI_tkwyft.png" />
|
||||
</Step>
|
||||
<Step title="Enter the Sign in redirect URL and sign out URL">
|
||||
Enter the Sign in redirect URL (or auth URL) as:
|
||||
```
|
||||
https://app.cal.com/api/auth/oidc
|
||||
```
|
||||
And the sign out URL as:
|
||||
```
|
||||
https://app.cal.com/auth/login
|
||||
```
|
||||
<img src="./images/i1600x900-TqgDJpBoiR-C_onrwit.png" />
|
||||
</Step>
|
||||
<Step title="Gather Client Secret, Client ID, and Well Known URL">
|
||||
Now you should have the Client Secret and Client ID with you. You would also need the Well Known URL which for Okta is generally of the type:
|
||||
```
|
||||
https://{yourOktaDomain}/.well-known/openid-configuration
|
||||
```
|
||||
So, if your Okta domain is `dev-123456.okta.com`, your well known URL would be:
|
||||
```
|
||||
https://dev-123456.okta.com/.well-known/openid-configuration
|
||||
```
|
||||
</Step>
|
||||
<Step title="Log in">
|
||||
Log in with the Organization Admin user.
|
||||
</Step>
|
||||
<Step title="Go to Organization SSO Settings">
|
||||
Visit `https://app.cal.com/settings/organizations/sso` and you should see something like this:
|
||||
<img src="./images/i1600x900-8ufcUyCOVwV6_hdudno.png" />
|
||||
</Step>
|
||||
<Step title="Configure SSO with OIDC">
|
||||
Click on Configure SSO with OIDC, and then enter the Client Secret, Client ID, and Well Known URL from Step 5, and click save.
|
||||
<img src="./images/i1600x900-GN1NLgrcf5r4_tmhni3.png" />
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
That's it. Now when you try to login with SSO, your application on Okta will handle the authentication.
|
||||
@@ -0,0 +1,82 @@
|
||||
<Steps>
|
||||
<Step title="Create an application with your OIDC provider">
|
||||
For example, in Okta, once you create an account, you can click on Applications on the sidebar menu:
|
||||
<img src="./images/i1600x900-oVjaQ0tU3AnO_wrzp85.png" />
|
||||
</Step>
|
||||
<Step title="Click on Create App Integration">
|
||||
<img src="./images/i1600x900-wrIlZkLdZ6kL_wf7mxn.png" />
|
||||
</Step>
|
||||
<Step title="Select SAML or OIDC and Web App, then click Next">
|
||||
Note you will have to fill in the appropriate fields for the SAML or OIDC setup to continue.
|
||||
- [SAML Setup](/developing/guides/auth-and-provision/sso-setup#setting-up-saml-login)
|
||||
- [OIDC Setup](/developing/guides/auth-and-provision/sso-setup#setting-up-oidc-login)
|
||||
<img src="./images/i1600x900-IfRWYg8XuCMI_tkwyft.png" />
|
||||
</Step>
|
||||
<Step title="Enable SCIM provisioning">
|
||||
Once the application is created, under General -> App Settings, click "Edit" and then the checkbox "Enable SCIM provisioning".
|
||||
<img src="./images/scim/app-settings-enable-scim.webp" />
|
||||
</Step>
|
||||
<Step title="Go to Directory Sync in Cal.com">
|
||||
Next, go to your instance of Cal.com and navigate to `https://app.cal.com/settings/organization/dsync` and click configure.
|
||||
<img src="./images/scim/dsync-configure.webp" />
|
||||
</Step>
|
||||
<Step title="Configure Directory Sync">
|
||||
In the "Configure Directory Sync" form, choose a directory sync name and select "Okta SCIM v2.0" as the "Directory Provider".
|
||||
<img src="./images/scim/dsync-configure-provider.webp" />
|
||||
</Step>
|
||||
<Step title="Take note of SCIM Base URL and SCIM Bearer Token">
|
||||
<img src="./images/scim/dsync-configure-info.webp" />
|
||||
</Step>
|
||||
<Step title="Setup Provisioning in Okta">
|
||||
In Okta, go to your application. Navigate to the "Provisioning" tab and click "Integration" under "Settings".
|
||||
<img src="./images/scim/okta-dsync-options.webp" />
|
||||
- Under "SCIM connector base URL" enter the "SCIM Base URL" from Cal.com
|
||||
- Under "Unique identifier field for users" enter "email"
|
||||
- Under "Supported provisioning actions" enable:
|
||||
- "Import New Users and Profile Updates"
|
||||
- "Push New Users"
|
||||
- "Push Profile Updates"
|
||||
- "Push Groups"
|
||||
- Under "Authentication Mode" choose "HTTP Header"
|
||||
- Under "Authentication" enter the "SCIM Bearer Token" from Cal.com
|
||||
- When you hit save, it will make a test call to the "SCIM Base URL"
|
||||
</Step>
|
||||
<Step title="Go to the 'To App' settings">
|
||||
After saving, navigate to the "To App" settings, still under the "Provisioning" tab.
|
||||
</Step>
|
||||
<Step title="Enable Provisioning to App">
|
||||
Under "Provisioning to App", click "Edit" and enable:
|
||||
- "Create User"
|
||||
- "Update User Attributes"
|
||||
- "Deactivate User"
|
||||
</Step>
|
||||
<Step title="Update Attribute Mapping">
|
||||
Under "\{Your application name\} Attribute Mapping," remove all fields except for:
|
||||
- "username"
|
||||
- "givenName"
|
||||
- "familyName"
|
||||
- "email"
|
||||
- "displayName"
|
||||
</Step>
|
||||
<Step title="Map Attributes from Okta Profile">
|
||||
Set each of these properties to "Map from Okta Profile" and the related field. Under "Apply On" select "Create and Update".
|
||||
<img src="./images/scim/okta-property-settings.webp" />
|
||||
</Step>
|
||||
<Step title="Assign users and groups to the app">
|
||||
You can now assign users and groups to the app.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## Mapping Okta Groups to Cal.com Teams
|
||||
|
||||
When provisioning groups to your organization, Okta groups can be mapped to teams within your organization, and users will be auto-assigned to these teams.
|
||||
|
||||
On `https://app.cal.com/settings/organization/dsync`, there is a table with the teams under your organization. Click on "Add group name" to map the Okta group to the team.
|
||||
|
||||
<Note>
|
||||
The group name must be spelled exactly as it is shown on Okta.
|
||||
</Note>
|
||||
|
||||
When you push the group to your organization, those users will automatically be added to the team.
|
||||
|
||||
<img src="./images/scim/group-team-mapping.webp" />
|
||||
@@ -0,0 +1,75 @@
|
||||
---
|
||||
title: "SSO setup"
|
||||
---
|
||||
|
||||
Cal.com supports both Security Assertion Markup Language (SAML) and OpenID Connect (OIDC), two of the industry's leading authentication protocols. We prioritize your ease of access and security by providing robust Single Sign-On (SSO) capabilities. Whether you're looking for the XML-based standard of SAML or the lightweight OIDC, our platform is equipped to integrate smoothly with your preferred identity provider, ensuring both convenience and security for your users.
|
||||
|
||||
### Setting up SAML login
|
||||
|
||||
<Steps>
|
||||
<Step title="Create a SAML application with your Identity Provider (IdP)">
|
||||
Follow the instructions here - [SAML Setup](/developing/guides/auth-and-provision/sso-setup#saml-registration-with-identity-providers)
|
||||
</Step>
|
||||
<Step title="Configure access to the IdP SAML app">
|
||||
Ensure that all users who need access to Cal.com have access to the IdP SAML app.
|
||||
</Step>
|
||||
<Step title="Retrieve XML metadata from your IdP">
|
||||
Keep the XML metadata from your IdP accessible, as you will need it later.
|
||||
</Step>
|
||||
<Step title="Log in to your Organization Admin account">
|
||||
Visit `settings/organizations/sso`.
|
||||
</Step>
|
||||
<Step title="Configure SSO with SAML">
|
||||
Click on the `Configure` button for `SSO with SAML`.
|
||||
</Step>
|
||||
<Step title="Paste the XML metadata and Save">
|
||||
In the SAML configuration section, copy and paste the XML metadata from step 3 and click on Save.
|
||||
</Step>
|
||||
<Step title="Your users can now log into Cal using SAML">
|
||||
Once setup is complete, provisioned users can log into Cal.com using SAML.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
### SAML Registration with Identity Providers
|
||||
|
||||
This guide explains the settings you need to use to configure SAML with your Identity Provider. Once configured, obtain an XML metadata file and upload it on your Cal.com instance.
|
||||
|
||||
> **Note:** Please do not add a trailing slash at the end of the URLs. Create them exactly as shown below.
|
||||
|
||||
**Assertion consumer service URL / Single Sign-On URL / Destination URL:** https://app.cal.com/api/auth/saml/callback
|
||||
|
||||
**Entity ID / Identifier / Audience URI / Audience Restriction:** [https://saml.cal.com](https://saml.cal.com)
|
||||
|
||||
**Response:** Signed
|
||||
|
||||
**Assertion Signature:** Signed
|
||||
|
||||
**Signature Algorithm:** RSA-SHA256
|
||||
|
||||
**Assertion Encryption:** Unencrypted
|
||||
|
||||
**Mapping Attributes / Attribute Statements:**
|
||||
|
||||
- http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier -> id
|
||||
- http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress -> email
|
||||
- http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname -> firstName
|
||||
- http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname -> lastName
|
||||
|
||||
### Setting up OIDC login
|
||||
|
||||
<Steps>
|
||||
<Step title="Gather necessary credentials">
|
||||
Keep handy the Client Secret, Client ID, and Well Known URL for the next steps.
|
||||
</Step>
|
||||
<Step title="Log in and go to Organization SSO Settings">
|
||||
Visit `/settings/organizations/sso` and you should see something like this:
|
||||
<img src="./images/i1600x900-8ufcUyCOVwV6_hdudno.png" />
|
||||
</Step>
|
||||
<Step title="Configure SSO with OIDC">
|
||||
Click on Configure SSO with OIDC, enter the Client Secret, Client ID, and Well Known URL from Step 1, and click save.
|
||||
<img src="./images/i1600x900-GN1NLgrcf5r4_tmhni3.png" />
|
||||
</Step>
|
||||
<Step title="Complete OIDC setup">
|
||||
Now, when you try to login with SSO, your OIDC provider will handle the authentication.
|
||||
</Step>
|
||||
</Steps>
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
title: "Setting up mailtrap for email testing"
|
||||
---
|
||||
Mailtrap is a versatile tool for testing email notifications without sending them to the real users of your application. It's especially useful for testing and ensuring that the system sends out accurate emails in a secure and efficient manner.
|
||||
|
||||
To set up Mailtrap for email testing on Cal.com, follow these steps:
|
||||
|
||||
<Steps>
|
||||
<Step title="Create an Account">
|
||||
The first step is to register an account with Mailtrap. It offers a free plan for small testing needs, and also paid plans for larger organizations.
|
||||
</Step>
|
||||
<Step title="Create an Inbox">
|
||||
After registering, create an inbox for your application. Each inbox comes with its SMTP and POP3 credentials, which can be used to send and retrieve emails.
|
||||
</Step>
|
||||
<Step title="Configure the Cal.com env file">
|
||||
Change the tab to nodemailer and copy the information to `.env`:
|
||||
```
|
||||
EMAIL_SERVER_HOST='sandbox.smtp.mailtrap.io'
|
||||
EMAIL_SERVER_PORT=2525
|
||||
EMAIL_SERVER_USER='XXX'
|
||||
EMAIL_SERVER_PASSWORD='XXX'
|
||||
```
|
||||
<Info>Please remember to change the user and password and replace 'XXX' above with their respective values.</Info>
|
||||
</Step>
|
||||
<Step title="Set EMAIL_FROM">
|
||||
Set the `EMAIL_FROM` environment variable in the `.env` file. For example:
|
||||
```
|
||||
EMAIL_FROM='[email protected]'
|
||||
```
|
||||
</Step>
|
||||
<Step title="Send Test Emails">
|
||||
Once your instance is configured, you can start sending test emails. These emails are "trapped" in the Mailtrap inbox, enabling you to verify email content, headers, and attachments.
|
||||
</Step>
|
||||
<Step title="Analyze and Debug">
|
||||
Mailtrap provides features to analyze and debug your emails. You can check whether the HTML displays correctly, ensure the email is not treated as spam, and also see if it contains any broken links, invalid format, or incorrect images.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
Happy testing!
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
title: Embed Events
|
||||
---
|
||||
|
||||
## Actions
|
||||
|
||||
You can listen to an action that occurs in embedded cal link as follows. You can think of them as DOM events. We are avoiding the term "events" to not confuse it with Cal Events.
|
||||
|
||||
```js
|
||||
<script>
|
||||
Cal("on", {
|
||||
action: "ANY_ACTION_NAME",
|
||||
callback: (e)=>{
|
||||
// `data` is properties for the event.
|
||||
// `type` is the name of the action(You can also call it type of the action.) This would be same as "ANY_ACTION_NAME" except when ANY_ACTION_NAME="*" which listens to all the events.
|
||||
// `namespace` tells you the Cal namespace for which the event is fired/
|
||||
const {data, type, namespace} = e.detail;
|
||||
}
|
||||
})
|
||||
</script>
|
||||
```
|
||||
|
||||
## Following are the list of supported actions.
|
||||
|
||||
| Action | Description | Properties |
|
||||
|----------------------|-------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|
|
||||
| eventTypeSelected | When user chooses an event-type from the listing. | `eventType: object` // Event Type that has been selected |
|
||||
| bookingSuccessful | When the booking is successfully done. It might not be confirmed. | `confirmed: boolean` // Whether confirmation from organizer is pending or not <br /> `eventType: object` // Event Type that has been booked <br /> `date: string` // Date of Event <br /> `duration: number` // Duration of booked Event <br /> `organizer: object` // Organizer details like name, timezone, email |
|
||||
| linkReady | Tells that the link is ready to be shown now. | None |
|
||||
| linkFailed | Fired if link fails to load. | `code: number` // Error Code <br /> `msg: string` // Human Readable message <br /> `data: object` // More details to debug the error |
|
||||
| __iframeReady | It is fired when the embedded iframe is ready to communicate with parent snippet. This is mostly for internal use by Embed Snippet. | None |
|
||||
| __windowLoadComplete | Tells that window load for iframe is complete. | None |
|
||||
| __dimensionChanged | Tells that dimensions of the content inside the iframe changed. | `iframeWidth: number` <br /> `iframeHeight: number` |
|
||||
|
||||
|
||||
<Info>Actions that start with __ are internal.</Info>
|
||||
|
||||
To get more details on how Embed actually works, you can refer to this [Embed Flowchart](https://www.figma.com/file/zZ5oaUpg12Fuu5mGZrPlP5/Embed-Flowchart).
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: "Introduction"
|
||||
icon: "presentation-screen"
|
||||
---
|
||||
|
||||
<img src="./images/i1440x910-pNoAmSPnktzZ_ecaypm.png" />
|
||||
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card href="/developing/local-development" title="Start developing" icon="rocket">
|
||||
Follow our quickstart guide to start developing with Cal.com
|
||||
</Card>
|
||||
<Card href="/self-hosting" title="Self Host" icon="server">
|
||||
Learn how to self-host Cal.com for controlled instance
|
||||
</Card>
|
||||
<Card href="/api-reference/v2" title="API" icon="code">
|
||||
Learn how to use Cal.com's API to CRUD various Cal resources programmatically
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
|
||||
## Welcome to the Cal.com Documentation!
|
||||
|
||||
This is the documentation for Cal.com, an open source scheduling platform that enables you to take bookings on your own terms. Set your availability, connect your favourite calendar and video conferencing platforms, and share your link. It's that simple.
|
||||
|
||||
It covers everything from setup to usage and development. Here you can explore advice and explanations for all of our features, as well as discover new tips and tricks to get the most out of the Cal.com software. This also includes the more advanced documentation covering how to build on top of Cal.com both in the codebase, by API and more. These guides will go into depth on how you can best integrate and extend Cal.com for your needs.
|
||||
@@ -0,0 +1,179 @@
|
||||
---
|
||||
title: "Local Development"
|
||||
icon: "terminal"
|
||||
---
|
||||
|
||||
Cal.com runs with pretty minimal hardware requirements by itself. The most intensive part for the software is when you actually build the software, but once it's running it's relatively lightweight.
|
||||
|
||||
Cal.com works with a very large range of operating systems, as it only requires JavaScript execution to run. **Cal.com is known to work well with Windows, Mac, Linux and BSD.** Although they do work well on all of them, for production deployments we would suggest Linux as the ideal platform. Any operating system that runs Node.js should be able to work too, but these are some of the common operating systems that we know work well.
|
||||
|
||||
To run Cal.com, you need to install a few things. **Node.js, yarn, Git and PostgreSQL**. We use **Prisma** for database maintenance, and is one of the dependencies. We won’t publish installation guides for these as they have their own resources available on the internet. If you're on Linux/BSD, all of these things should be readily available on your package manager. Your best bet is searching for something like **Debian 12 PostgreSQL**, which will give you a guide to installing and configuring PostgreSQL on Debian Linux 12.
|
||||
|
||||
<Info>
|
||||
To ensure optimal performance and compatibility, we highly recommend using Node.js version 18 for your development environment. This version provides the best balance of stability, features, and security for this project. Please make sure to update your Node.js installation if necessary.
|
||||
</Info>
|
||||
|
||||
## Development Setup & Production Build
|
||||
|
||||
1. **First, you git clone the repository** with the following command, so you have a copy of the code.
|
||||
```git
|
||||
git clone https://github.com/calcom/cal.com.git
|
||||
```
|
||||
|
||||
<Warning>
|
||||
If you are on windows, you would need to use the following command when cloning, with **admin privileges**:
|
||||
```git
|
||||
git clone -c core.symlinks=true https://github.com/calcom/cal.com.git
|
||||
```
|
||||
</Warning>
|
||||
|
||||
2. Then, go into the directory you just cloned with
|
||||
```bash
|
||||
cd cal.com
|
||||
```
|
||||
and run
|
||||
```bash
|
||||
yarn
|
||||
```
|
||||
to install all of the dependencies. Essentially, dependencies are just things that Cal.com needs to install to be able to work.
|
||||
|
||||
3. Then, you just need to set up a couple of things. For that, we use a `.env` file. We just need to copy and paste the `.env.example` file and rename the copy to `.env`. Here you'll have a template with comments showing you the settings you need/might want to set.
|
||||
|
||||
4. Next, use the command
|
||||
```bash
|
||||
openssl rand -base64 32
|
||||
```
|
||||
(or another secret generator tool if you prefer) to generate a key and add it under `NEXTAUTH_SECRET` in the .env file.
|
||||
|
||||
5. You'll also want to fill out the `.env.appStore` file similar to the `.env` file as this includes keys to enable apps.
|
||||
|
||||
**Development tips**
|
||||
|
||||
> Add `NEXT_PUBLIC_DEBUG=1` anywhere in your `.env` to get logging information for all the queries and mutations driven by **trpc**.
|
||||
|
||||
```bash
|
||||
echo 'NEXT_PUBLIC_DEBUG=1' >> .env
|
||||
```
|
||||
|
||||
> For email testing, set it to "1" if you need to email checks in E2E tests locally. Make sure to run mailhog container manually or with `yarn dx`.
|
||||
|
||||
```bash
|
||||
echo 'E2E_TEST_MAILHOG_ENABLED=1' >> .env
|
||||
```
|
||||
|
||||
### E2E Testing
|
||||
|
||||
Be sure to set the environment variable `NEXTAUTH_URL` to the correct value. If you are running locally, as the documentation within `.env.example` mentions, the value should be `http://localhost:3000`.
|
||||
|
||||
|
||||
In a terminal just run:
|
||||
```bash
|
||||
yarn test-e2e
|
||||
```
|
||||
To open last HTML report run:
|
||||
```bash
|
||||
yarn playwright show-report test-results/reports/playwright-html-report
|
||||
```
|
||||
|
||||
### Manual setup
|
||||
|
||||
1. Configure environment variables in the .env file. Replace `<user>`, `<pass>`, `<db-host>`, `<db-port>` with their applicable values
|
||||
|
||||
```bash
|
||||
DATABASE_URL='postgresql://<user>:<pass>@<db-host>:<db-port>'
|
||||
```
|
||||
|
||||
2. Set a 24 character random string in your .env file for the `CALENDSO_ENCRYPTION_KEY` (You can use a command like
|
||||
```bash
|
||||
openssl rand -base64 24
|
||||
```
|
||||
to generate one).
|
||||
|
||||
3. Set up the database using the Prisma schema (found in `apps/web/prisma/schema.prisma`)
|
||||
|
||||
```bash
|
||||
yarn workspace @calcom/prisma db-deploy
|
||||
```
|
||||
|
||||
4. Run (in development mode)
|
||||
|
||||
```bash
|
||||
yarn dev
|
||||
```
|
||||
|
||||
<Info>
|
||||
When you're testing out the enterprise features locally, you should see a warning shown in the image below, clarifying the need to purchase a license for such features in production.
|
||||
<img src="./images/i1600x900-E4RcIPb1_bYp_hcpsya.png" />
|
||||
</Info>
|
||||
|
||||
|
||||
## **Development quick start with** **`yarn dx`**
|
||||
|
||||
> * **Requires Docker and Docker Compose to be installed**
|
||||
>
|
||||
>
|
||||
> * Will start a local Postgres instance with a few test users - the credentials will be logged in the console
|
||||
>
|
||||
|
||||
```bash
|
||||
yarn dx
|
||||
```
|
||||
|
||||
## **Cron Jobs**
|
||||
|
||||
There are a few features which require cron job setup. At cal.com, the cron jobs are found in the following directory:
|
||||
```bash
|
||||
/apps/web/pages/api/cron
|
||||
```
|
||||
|
||||
|
||||
## App store seeder
|
||||
|
||||
<Info>
|
||||
We recommend using the admin UI/wizard instead of the seeder to enable app store apps
|
||||
</Info>
|
||||
|
||||
|
||||
## API
|
||||
|
||||
#### Step 1
|
||||
|
||||
Copy the .env files from their respective example files depending on the version of the API (v1 or v2):
|
||||
|
||||
```bash
|
||||
cp apps/api/.env.example apps/api/{version}/.env
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
#### Step 2
|
||||
|
||||
Install packages with yarn:
|
||||
|
||||
```bash
|
||||
yarn
|
||||
```
|
||||
|
||||
### Running API server
|
||||
|
||||
Run the API V1 with yarn:
|
||||
|
||||
```bash
|
||||
yarn workspace @calcom/api dev
|
||||
```
|
||||
|
||||
Run the API V2 with yarn:
|
||||
<Info>Please note API V2 requires the database running in docker</Info>
|
||||
|
||||
```bash
|
||||
yarn workspace @calcom/api-v2 dev
|
||||
```
|
||||
|
||||
<Note>
|
||||
On windows, you would need to update the script to explicitly set port to 3003 and run yarn dev under `apps/api/package.json` So, it should look something like this after the changes:
|
||||
|
||||
`"dev": "set PORT=3003 && next dev"` Now, running `yarn workspace @calcom/api dev` should start the server.
|
||||
</Note>
|
||||
|
||||
Open [http://localhost:3003](http://localhost:3003/) with your browser to see the result.
|
||||
|
||||
If you wish to test how API works locally, please [check out our guide here](/developing/guides/api/how-to-setup-api-in-a-local-instance).
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
title: "Code styling"
|
||||
icon: "pen-fancy"
|
||||
---
|
||||
|
||||
Keeping our code styles consistent is key to making the repository easy to read and work with.
|
||||
|
||||
We use a number of style guides written by other amazing companies, simply because they are widely used and because we like working with them.
|
||||
|
||||
We don't expect you to study every single rule of each style guide, but these are great reference points as to how your code should be styled. We may reject a pull request if your code style significantly differs from these style guides however.
|
||||
|
||||
### ESLint & Prettier
|
||||
Calendso uses the ESLint and Prettier formatting tools, and the repository comes with defined rules for each tool. We recommend setting up both tools and using these to help automatically style your code to our guidelines.
|
||||
|
||||
### JavaScript/TypeScript
|
||||
We use the
|
||||
for all JavaScript and Typescript code.
|
||||
|
||||
### HTML & CSS
|
||||
We use the [Google HTML/CSS Style Guide](https://google.github.io/styleguide/htmlcssguide.html) for any HTML and CSS markup. However, exceptions to the HTML guide apply where JSX differentiates from standard HTML.
|
||||
@@ -0,0 +1,164 @@
|
||||
---
|
||||
title: "Contributor's Guide"
|
||||
icon: "book-open"
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
Cal.com is structured as a monorepo using [Turborepo](https://github.com/vercel/turbo). Cal.com is built on [NextJS]("https://github.com/vercel/next.js") with [Typescript]("https://www.typescriptlang.org/"), [PostgreSQL]("https://www.postgresql.org/") database and the interactions with the database are carried out using [Prisma]("https://www.prisma.io/"). We use [TRPC]("https://trpc.io/") for end-to-end typesafe procedure calls to Prisma and utilize [Zod]("https://zod.dev/") for validation and type-safe parsing of API calls.
|
||||
|
||||
## Setting Up the Development Environment
|
||||
|
||||
### Prerequisites
|
||||
|
||||
Here is what you need to be able to run Cal.com.
|
||||
- Node.js (Version: >=18.x)
|
||||
- PostgreSQL
|
||||
- Yarn (recommended)
|
||||
|
||||
Cal.com can be set up and run on your machine locally. Please take a look at [this quick guide](https://cal.com/documentation/getting-started/local-development) for instructions on setting it up.
|
||||
|
||||
|
||||
<iframe
|
||||
width="560"
|
||||
height="315"
|
||||
title="Run cal.com locally"
|
||||
src="https://www.loom.com/embed/2f9d16b0959c4f1eaa5b306300ea4deb"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen
|
||||
></iframe>
|
||||
|
||||
|
||||
## Understanding the Project Structure
|
||||
|
||||
Cal.com makes use of Turborepo for a monorepo structure. This allows us to manage multiple code projects (like libraries, apps, services) and share code and resources effectively.
|
||||
|
||||
You can look at [turbo.json](https://github.com/calcom/cal.com/blob/main/turbo.json) to see how we use it. In simple terms,
|
||||
- Each entry in the `pipeline` section corresponds to a different part of the project. Understanding these will help in navigating the codebase.
|
||||
- Knowing which tasks depend on others is crucial for understanding the build process.
|
||||
- The `env` entries under each task highlight the need for specific configuration settings, which you will need to set up in your development environment.
|
||||
- You should focus on the tasks related to the area you are contributing to. For example, if working on the Prisma schema, look at tasks prefixed with `@calcom/prisma`
|
||||
- The various packages can be found in the [/packages](https://github.com/calcom/cal.com/tree/main/packages) folder from the root.
|
||||
- The various pages and components for the web can be found in the [/apps/web](https://github.com/calcom/cal.com/tree/main/apps/web) folder from the root.
|
||||
- The public API related codebase can be found in the [/apps/api](https://github.com/calcom/cal.com/tree/main/apps/api) folder from the root.
|
||||
- The Cal.ai related codebase can be found in the [/apps/ai](https://github.com/calcom/cal.com/tree/main/apps/ai) folder from the root
|
||||
|
||||
## How we use TRPC at cal.com
|
||||
|
||||
Cal.com makes use of the TRPC calls for CRUD operations on the database by utilizing the [useQuery()](https://trpc.io/docs/client/react/useQuery) & [useMutation()](https://trpc.io/docs/client/react/useMutation) hooks. These are essentially wrappers around @tanstack/react-query and you can learn more about them here, respectively: [queries](https://tanstack.com/query/v4/docs/react/guides/queries), [mutations](https://tanstack.com/query/v4/docs/react/guides/mutations).
|
||||
|
||||
Here’s an example usage of useQuery at cal.com:
|
||||
```JS
|
||||
const { data: webhooks } = trpc.viewer.webhook.list.useQuery(undefined, {
|
||||
suspense: true,
|
||||
enabled: session.status === "authenticated",
|
||||
});
|
||||
```
|
||||
|
||||
Here’s an example usage of useMutation at cal.com:
|
||||
```JS
|
||||
const createWebhookMutation = trpc.viewer.webhook.create.useMutation({
|
||||
async onSuccess() {
|
||||
showToast(t("webhook_created_successfully"), "success");
|
||||
await utils.viewer.webhook.list.invalidate();
|
||||
router.back();
|
||||
},
|
||||
onError(error) {
|
||||
showToast(`${error.message}`, "error");
|
||||
},
|
||||
});
|
||||
```
|
||||
Both the examples are taken from [packages/features/webhooks/pages/webhook-new-view.tsx](https://github.com/calcom/cal.com/blob/main/packages/features/webhooks/pages/webhook-new-view.tsx) file. We use the useQuery hook for fetching data from the database. On the contrary, the useMutation hook is used for Creating/Updating/Deleting data from the database.
|
||||
|
||||
The path prior to the useQuery or useMutation hook represents the actual path of the procedure: in this case, [packages/trpc/server/routers/viewer/webhook](https://github.com/calcom/cal.com/tree/main/packages/trpc/server/routers/viewer/webhook). You will find `create.handler.ts` in case of
|
||||
```js
|
||||
trpc.viewer.webhook.create.useMutation()
|
||||
```
|
||||
& `list.handler.ts` in case of
|
||||
```js
|
||||
trpc.viewer.webhook.list.useQuery()
|
||||
```
|
||||
in the path mentioned above. There is usually a schema file in the same directory for each handler as well (_name_.schema.ts). This is generally how we make use of the TRPC calls in the cal.com repo.
|
||||
|
||||
## The Cal.com API V1
|
||||
|
||||
Our [API V1](https://github.com/calcom/cal.com/tree/main/apps/api) uses [zod validations](https://zod.dev/) to keep us typesafe and give us extensive parsing control and error handling. These validations reside in [/apps/api/lib/validations](https://github.com/calcom/cal.com/tree/main/apps/api/lib/validations). We also have [helper](https://github.com/calcom/cal.com/tree/main/apps/api/lib/helpers) and [utility](https://github.com/calcom/cal.com/tree/main/apps/api/lib/utils) functions which are used primarily within our API endpoints.
|
||||
Here’s an example usage of our [zod validation in action with the respective API endpoint](https://github.com/calcom/cal.com/blob/main/apps/api/lib/validations/destination-calendar.ts):
|
||||
```js
|
||||
export const schemaDestinationCalendarBaseBodyParams = DestinationCalendar.pick({
|
||||
integration: true,
|
||||
externalId: true,
|
||||
eventTypeId: true,
|
||||
bookingId: true,
|
||||
userId: true,
|
||||
}).partial();
|
||||
|
||||
const schemaDestinationCalendarCreateParams = z
|
||||
.object({
|
||||
integration: z.string(),
|
||||
externalId: z.string(),
|
||||
eventTypeId: z.number().optional(),
|
||||
bookingId: z.number().optional(),
|
||||
userId: z.number().optional(),
|
||||
})
|
||||
.strict();
|
||||
|
||||
|
||||
export const schemaDestinationCalendarCreateBodyParams = schemaDestinationCalendarBaseBodyParams.merge(
|
||||
schemaDestinationCalendarCreateParams
|
||||
);
|
||||
```
|
||||
|
||||
And here’s the usage of this validation for parsing the request at the [respective endpoint](https://github.com/calcom/cal.com/blob/main/apps/api/pages/api/destination-calendars/_post.ts):
|
||||
```js
|
||||
async function postHandler(req: NextApiRequest) {
|
||||
const { userId, isAdmin, prisma, body } = req;
|
||||
const parsedBody = schemaDestinationCalendarCreateBodyParams.parse(body);
|
||||
```
|
||||
This is the general approach of validation and parsing in our API submodule.
|
||||
|
||||
## Building Apps for Cal.com
|
||||
|
||||
We’ve got an app store containing apps which complement the scheduling platform. From video conferencing apps such as Zoom, Google Meet, etc. to Calendar Apps such as Google Calendar, Apple Calendar, CalDAV, etc. and even payment, automation, analytics and other miscellaneous apps, it is an amazing space to improve the scheduling experience.
|
||||
|
||||
We have a CLI script in place that makes building apps a breeze. [You can learn more about it here](https://cal.com/docs/how-to-guides/how-to-build-an-app).
|
||||
|
||||
## Running Tests
|
||||
|
||||
### E2E-Testing
|
||||
|
||||
Be sure to set the environment variable `NEXTAUTH_URL` to the correct value. If you are running locally, as the documentation within `.env.example` mentions, the value should be `http://localhost:3000`.
|
||||
|
||||
In a terminal just run:
|
||||
```bash
|
||||
yarn test-e2e
|
||||
```
|
||||
|
||||
To open the last HTML report run:
|
||||
|
||||
```bash
|
||||
`yarn playwright show-report test-results/reports/playwright-html-report`
|
||||
```
|
||||
|
||||
#### Resolving issues
|
||||
|
||||
**E2E test browsers not installed**
|
||||
|
||||
If you face the following error when running `yarn test-e2e`:
|
||||
|
||||
<Warning>
|
||||
Executable doesn't exist at /Users/alice/Library/Caches/ms-playwright/chromium-1048/chrome-mac/Chromium.app
|
||||
</Warning>
|
||||
|
||||
You can resolve it by running:
|
||||
|
||||
```bash
|
||||
npx playwright install
|
||||
```
|
||||
to download test browsers.
|
||||
|
||||
## Contribution and Collaboration Guides
|
||||
|
||||
- [Code Styling Guide](/developing/open-source-contribution/code-styling)
|
||||
- [Pull Requests Guide](/developing/open-source-contribution/pull-requests)
|
||||
@@ -0,0 +1,137 @@
|
||||
---
|
||||
title: "Introduction"
|
||||
icon: "github"
|
||||
---
|
||||
|
||||
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
|
||||
|
||||
- Before jumping into a PR be sure to search [existing PRs](https://github.com/calcom/cal.com/pulls) or [issues](https://github.com/calcom/cal.com/issues) for an open or closed item that relates to your submission.
|
||||
|
||||
### Priorities
|
||||
|
||||
| Type of issue | Priority |
|
||||
| :-------------------------------------------------------------- | :-------------------------------------------------- |
|
||||
| Minor improvements, non-core feature requests | <img className="m-0" noZoom src="./images/low-priority.svg" /> |
|
||||
| Confusing UX (... but working) | <img className="m-0" noZoom src="./images/medium-priority.svg" /> |
|
||||
| Core Features (Booking page, availabilty, timezone calculation) | <img className="m-0" noZoom src="./images/high-priority.svg" /> |
|
||||
| Core Bugs (Login, Booking page, Emails are not working) | <img className="m-0" noZoom src="./images/urgent-priority.svg" /> |
|
||||
|
||||
|
||||
### Developing
|
||||
|
||||
The development branch is `main`. This is the branch that all pull
|
||||
requests should be made against. The changes on the `main`
|
||||
branch are tagged into a release monthly.
|
||||
|
||||
To develop locally:
|
||||
|
||||
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your
|
||||
own GitHub account and then
|
||||
[clone](https://help.github.com/articles/cloning-a-repository/) it to your local device.
|
||||
2. Create a new branch:
|
||||
|
||||
```bash
|
||||
git checkout -b MY_BRANCH_NAME
|
||||
```
|
||||
|
||||
3. Install yarn:
|
||||
|
||||
```bash
|
||||
npm install -g yarn
|
||||
```
|
||||
|
||||
4. Install the dependencies with:
|
||||
|
||||
```bash
|
||||
yarn
|
||||
```
|
||||
|
||||
5. Start developing and watch for code changes:
|
||||
|
||||
```bash
|
||||
yarn dev
|
||||
```
|
||||
|
||||
### Building
|
||||
|
||||
You can build the project with:
|
||||
|
||||
```bash
|
||||
yarn build
|
||||
```
|
||||
|
||||
Please be sure that you can make a full production build before pushing code.
|
||||
|
||||
### Testing
|
||||
|
||||
More info on how to add new tests coming soon.
|
||||
|
||||
### Running tests
|
||||
|
||||
This will run and test all flows in multiple Chromium windows to verify that no critical flow breaks:
|
||||
|
||||
```bash
|
||||
yarn test-e2e
|
||||
```
|
||||
|
||||
### Linting
|
||||
|
||||
To check the formatting of your code:
|
||||
|
||||
```bash
|
||||
yarn lint
|
||||
```
|
||||
|
||||
If you get errors, be sure to fix them before committing.
|
||||
|
||||
### Making a Pull Request
|
||||
|
||||
- Be sure to [check the "Allow edits from maintainers" option](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) while creating you PR.
|
||||
- If your PR refers to or fixes an issue, be sure to add `refs #XXX` or `fixes #XXX` to the PR description. Replacing `XXX` with the respective issue number. See more about [Linking a pull request to an issue
|
||||
](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue).
|
||||
- Be sure to fill the PR Template accordingly.
|
||||
|
||||
### Guidelines for committing yarn lockfile
|
||||
|
||||
Do not commit your `yarn.lock` unless you've made changes to the `package.json`. If you've already committed `yarn.lock` unintentionally, follow these steps to undo:
|
||||
|
||||
If your last commit has the `yarn.lock` file alongside other files and you only wish to uncommit the `yarn.lock`:
|
||||
```git
|
||||
git checkout HEAD~1 yarn.lock
|
||||
git commit -m "Revert yarn.lock changes"
|
||||
```
|
||||
If you've pushed the commit with the `yarn.lock`:
|
||||
1. Correct the commit locally using the above method.
|
||||
2. Carefully force push:
|
||||
|
||||
```git
|
||||
git push origin <your-branch-name> --force
|
||||
```
|
||||
|
||||
If `yarn.lock` was committed a while ago and there have been several commits since, you can use the following steps to revert just the `yarn.lock` changes without impacting the subsequent changes:
|
||||
|
||||
1. **Checkout a Previous Version**:
|
||||
- Find the commit hash before the `yarn.lock` was unintentionally committed. You can do this by viewing the Git log:
|
||||
```git
|
||||
git log yarn.lock
|
||||
```
|
||||
- Once you have identified the commit hash, use it to checkout the previous version of `yarn.lock`:
|
||||
```git
|
||||
git checkout <commit_hash> yarn.lock
|
||||
```
|
||||
|
||||
2. **Commit the Reverted Version**:
|
||||
- After checking out the previous version of the `yarn.lock`, commit this change:
|
||||
```git
|
||||
git commit -m "Revert yarn.lock to its state before unintended changes"
|
||||
```
|
||||
|
||||
3. **Proceed with Caution**:
|
||||
- If you need to push this change, first pull the latest changes from your remote branch to ensure you're not overwriting other recent changes:
|
||||
```git
|
||||
git pull origin <your-branch-name>
|
||||
```
|
||||
- Then push the updated branch:
|
||||
```git
|
||||
git push origin <your-branch-name>
|
||||
```
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
title: "Pull requests"
|
||||
icon: "code-pull-request"
|
||||
---
|
||||
|
||||
### Requirements
|
||||
|
||||
We have a number of requirements for PRs to ensure they are as easy to review as possible and to ensure that they are up to standard with the code.
|
||||
|
||||
### Title & Content
|
||||
|
||||
|
||||
Start by providing a short and concise title. Don’t put something generic (e.g. bug fixes), and instead mention more specifically what your PR achieves, for instance “Fixes dropdown not expanding on settings page”.
|
||||
|
||||
For the PR description, you should go into much greater detail about what your PR adds or fixes. Firstly, the description should include a link to any relevant issues or discussions surrounding the feature or bug that your PR addresses.
|
||||
|
||||
### Feature PRs
|
||||
|
||||
Give a functional overview of how your feature works, including how the user can use the feature. Then, share any technical details in an overview of how the PR works (e.g. “Once the user enters their password, the password is hashed using BCrypt and stored in the Users database field”).
|
||||
|
||||
### Bug Fix PRs
|
||||
|
||||
Give an overview of how your PR fixes the bug both as a high-level overview and a technical explanation of what caused the issue and how your PR resolves this.
|
||||
|
||||
Feel free to add a short video or screenshots of what your PR achieves. Loom is a great way of sharing short videos.
|
||||
|
||||
### Code Quality & Styling
|
||||
|
||||
All submitted code must match our [code styling](/code-styling) standards. We will reject pull requests that differ significantly from our standardised code styles.
|
||||
|
||||
All code is automatically checked by Codacy and our linting process, and will notify you if there are any issues with the code that you submit. We require that code passes these quality checks before merging.
|
||||
|
||||
### PR review process
|
||||
|
||||
At least two members of the Cal.com team should review and approve any PR before it is merged.
|
||||
|
||||
Once two members of the team have approved this, someone from the team will merge the PR. If you are part of the Cal.com team, you should merge your own PRs once you have received both approvals.
|
||||
Reference in new issue
Block a user