Martin Dimitrov 8aa1fa7b08
All checks were successful
Build and push image for doorman-homeassistant / diff (push) Successful in 14s
Build and push Doorman UI / API / diff (push) Successful in 11s
Build and push image for doorman-homeassistant / docker (push) Has been skipped
Build and push image for doorman-homeassistant / deploy-gitainer (push) Has been skipped
Build and push Doorman UI / API / twilio (push) Successful in 2m40s
remove dial through notification
2025-10-24 17:48:28 -07:00
2025-10-24 17:48:28 -07:00

doorman

To install dependencies for all packages

bun install

Packages

Check out the individual READMEs in the monorepo to see how to run each component of Doorman

  • doorman-client (Twilio Function that triggers when receiving buzzer call)
  • doorman-api (Twilio Function API that manages Door state and configs)
  • doorman-ui (frontend React app, served by doorman-api)
  • doorman-schema (future home for all the zod schemas and basic validations)

CI/CD workflows

On pushes to main, the Gitea action in .gitea/workflows/deploy-twilio.yaml handle deployments to Twilio / homeassistant.

  1. Builds change
  2. Run local integration tests
  3. Deploy to staging
  4. Run staging integration tests
  5. Promote to prod

.env.twiliotemplate

This file is used for twilio Deployments in github actions. In short, it specifies all the env values that are supposed to be deployed with the Function.

For any value that is specified, it uses that value.

For any value that is in the file but not specified (= nothing), it would be loaded from the execution environment (as a Gitea secret). If the env var is not in the environment passed in, then the deployment would fail.

for twilio packages, what is going on in src/index.ts (Bun.build)

This file contains a Bun bundler for Javascript. In short, it compiles the Typescript code under ./src/functions into javascript, bundling all the local files together and optionally certain dependencies.

This is necessary because Twilio Functions only supports Javascript, and doesn't allow importing code across files. This previously was really hard to maintain, because Javascript is not typed and the files were really long. Our deployed code is basically the package compiled into one file so it can be deployed in Twilio.

Also, since Bun supports ESM (import . from .) and CommonJS (require) module syntax but Twilio only supports CommonJS, the bundler will explicitly bundle dependencies that only support CommonJS. This is because when deployed in Twilio, we cannot use ESM and Bun handles this conversion for us without the library needing dual support (though most libraries support both ESM and CommonJS).

If we add a library that only supports ESM, then we need to add it as an explicitly bundled dep in src/index.ts

To deploy manually (not reccomended)

First you need to have Twilio secrets in your env

export ACCOUNT_SID=AC...
export AUTH_TOKEN=8e...

to deploy Doorman API / UI manually

bun run deploy-serverless<:staging>

to deploy Doorman Buzzer client

bun run deploy-buzzer-client<:staging>
Description
No description provided
Readme 7.7 MiB
Languages
TypeScript 98.8%
HTML 1%
Dockerfile 0.2%