packages/cli/src/commands/init-vercel/README.md
To deploy a Lowdefy app on Vercel a custom install script needs to run to download the server and build the Lowdefy configuration. This script creates a Next.js application that can then be built by Vercel. The install script needs to be placed in an empty directory and it installs the server in its working directory - by default this directory is called deploy.
The script can be created using the init-vercel CLI command, or the following file can be created at <config-directory>/deploy/vercel.install.sh:
# Read Lowdefy version from lowdefy.yaml using sed
LOWDEFY_VERSION=$(sed -nE "s/lowdefy:(.*)/\1/p" ../lowdefy.yaml)
# Substitution params are to trim whitespace from the LOWDEFY_VERSION var
npx lowdefy@${LOWDEFY_VERSION//[[:space:]]/} build --config-directory ../ --server-directory . --no-next-build --log-level=debug
To deploy a Lowdefy app on Vercel:
<config-directory>/deploy
<config-directory> is the path to the directory in which the lowdefy.yaml file is placedlowdefy.yaml is in the top level of the repository the configured root directory should be deploylowdefy.yaml is in the directory apps/app_name the configured root directory should be apps/app_name/deploypnpm next buildsh vercel.install.shSecrets can be set in the Environment Variables settings section by creating environment variables prefixed with LOWDEFY_SECRET_. Different secrets can be set for production and preview deployments.
All other Vercel configuration like domain names, preview deploy branches, serverless regions and redirects can be configured as desired.