Our self-hosted instance of cal.com https://cal.pub0.org
 
 
 
 
 
Go to file
Agusti Fernandez Pardo 9e8be659c5 feat: initial tests for api-keys endpoint 2022-03-26 00:42:12 +01:00
.husky feat: adds git hooks and husky for pre-commit linting 2022-03-25 02:18:43 +01:00
__tests__ feat: initial tests for api-keys endpoint 2022-03-26 00:42:12 +01:00
lib/validations feat: initial tests for api-keys endpoint 2022-03-26 00:42:12 +01:00
pages/api feat: initial tests for api-keys endpoint 2022-03-26 00:42:12 +01:00
.eslintrc.json Feat: event-types and tests 2022-03-25 06:54:57 +01:00
.gitignore feat: 100% code-coverage, add coverage to gitignore 2022-03-25 02:07:51 +01:00
README.md feat: adds module transpiling so api can require @calcom/prisma and not @prisma/client directly 2022-03-25 19:37:51 +01:00
babel.config.js rebase fixing conflicts 2022-03-23 22:22:57 +01:00
jest.config.ts Feat: event-types and tests 2022-03-25 06:54:57 +01:00
next-env.d.ts feat: inital commit 2022-03-18 14:42:42 +01:00
next.config.js feat: adds api keys endpoints, new QueryIdAsString as apiKey has a UUID string-like ID unlike the numbers of event-type or others 2022-03-25 20:17:37 +01:00
package.json feat: adds module transpiling so api can require @calcom/prisma and not @prisma/client directly 2022-03-25 19:37:51 +01:00
tsconfig.json feat: initial tests for api-keys endpoint 2022-03-26 00:42:12 +01:00
yarn-error.log Feat: event-types and tests 2022-03-25 06:54:57 +01:00
yarn.lock feat: inital commit 2022-03-18 14:42:42 +01:00

README.md

Cal.com Public API (Enterprise Only)

This will be the new public enterprise-only API

This is the public REST api for cal.com

NextJS + TypeScript

It's a barebones NextJS + TypeScript project leveraging the nextJS API with a pages/api folder.

No react

It doesn't have react or react-dom as a dependency, and will only be used by a redirect as a folder or subdomain on cal.com with maybe a v1 tag like:

  • api.cal.com/v1
  • api.cal.com/api/v1

API Endpoint Validation

Zod

The API uses zod library like our main web repo. It validates that either GET query parameters or POST body content's are valid and up to our spec. It gives appropiate errors when parsing result's with schemas.

Next Validations

Next-Validations Docs Next-Validations Repo We also use this useful helper library that let's us wrap our endpoints in a validate HOC that checks the req against our validation schema built out with zod for either query and / or body's requests.

Testing with Jest + node-mocks-http

We aim to provide a fully tested API for our peace of mind, this is accomplished by using jest + node-mocks-http

Next.config.js

Redirects

Since this will only support an API, we redirect the requests to root to the /api folder. We also added a redirect for future-proofing API versioning when we might need it, without having to resort to dirty hacks like a v1/v2 folders with lots of duplicated code, instead we redirect /api/v*/:rest to /api/:rest?version=*

The priority is the booking-related API routes so people can build their own booking flow, then event type management routes, then availability management routes etc