@lowdefy/docs-content 0.0.0-experimental-20260710073520
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +20 -0
- package/content/actions/callapi.md +66 -0
- package/content/actions/callmethod.md +41 -0
- package/content/actions/copytoclipboard.md +32 -0
- package/content/actions/displaymessage.md +53 -0
- package/content/actions/downloadcsv.md +89 -0
- package/content/actions/fetch.md +50 -0
- package/content/actions/geolocationcurrentposition.md +56 -0
- package/content/actions/link.md +104 -0
- package/content/actions/login.md +85 -0
- package/content/actions/logout.md +56 -0
- package/content/actions/pdfmake.md +304 -0
- package/content/actions/request.md +67 -0
- package/content/actions/reset.md +27 -0
- package/content/actions/resetvalidation.md +85 -0
- package/content/actions/scrollto.md +85 -0
- package/content/actions/setdarkmode.md +62 -0
- package/content/actions/setfocus.md +33 -0
- package/content/actions/setglobal.md +63 -0
- package/content/actions/setlocale.md +69 -0
- package/content/actions/setstate.md +70 -0
- package/content/actions/throw.md +72 -0
- package/content/actions/validate.md +87 -0
- package/content/actions/wait.md +24 -0
- package/content/agents/agent-endpoint-tools.md +190 -0
- package/content/agents/agent-mcp-tools.md +124 -0
- package/content/agents/agent-multi-agent.md +136 -0
- package/content/agents/agent-properties.md +174 -0
- package/content/agents/agent-server-hooks.md +336 -0
- package/content/agents/agentchat.md +515 -0
- package/content/agents/agentconversations.md +148 -0
- package/content/concepts/ai-agent-docs.md +190 -0
- package/content/concepts/cli.md +213 -0
- package/content/concepts/connections-and-requests.md +7 -0
- package/content/concepts/custom-html.md +3 -0
- package/content/concepts/custom-styling.md +161 -0
- package/content/concepts/events-and-actions.md +271 -0
- package/content/concepts/hosting-files.md +18 -0
- package/content/concepts/i18n.md +320 -0
- package/content/concepts/keyboard-shortcuts.md +218 -0
- package/content/concepts/layout-overview.md +478 -0
- package/content/concepts/lists.md +144 -0
- package/content/concepts/logger.md +43 -0
- package/content/concepts/lowdefy-schema.md +365 -0
- package/content/concepts/menus.md +144 -0
- package/content/concepts/module-authoring.md +564 -0
- package/content/concepts/modules.md +338 -0
- package/content/concepts/operators.md +45 -0
- package/content/concepts/overview.md +19 -0
- package/content/concepts/references-and-templates.md +207 -0
- package/content/concepts/secrets.md +24 -0
- package/content/concepts/selectors.md +143 -0
- package/content/connections/amazonredshift.md +176 -0
- package/content/connections/anthropic.md +232 -0
- package/content/connections/awss3.md +313 -0
- package/content/connections/azureblobstorage.md +133 -0
- package/content/connections/elasticsearch.md +371 -0
- package/content/connections/google.md +228 -0
- package/content/connections/googlecloudstorage.md +139 -0
- package/content/connections/googlesheet.md +313 -0
- package/content/connections/knex.md +206 -0
- package/content/connections/mariadb.md +177 -0
- package/content/connections/mcp.md +134 -0
- package/content/connections/mongodb.md +739 -0
- package/content/connections/mssql.md +191 -0
- package/content/connections/mysql.md +192 -0
- package/content/connections/openai-connection.md +228 -0
- package/content/connections/postgresql.md +200 -0
- package/content/connections/redis.md +116 -0
- package/content/connections/sendgridmail.md +94 -0
- package/content/connections/smtp.md +149 -0
- package/content/connections/sqlite.md +187 -0
- package/content/connections/stripe.md +115 -0
- package/content/container-blocks/affix.md +413 -0
- package/content/container-blocks/alert.md +937 -0
- package/content/container-blocks/badge.md +1222 -0
- package/content/container-blocks/box.md +1453 -0
- package/content/container-blocks/card.md +1200 -0
- package/content/container-blocks/carousel.md +2247 -0
- package/content/container-blocks/collapse.md +1335 -0
- package/content/container-blocks/configprovider.md +1070 -0
- package/content/container-blocks/confirmmodal.md +1159 -0
- package/content/container-blocks/content.md +597 -0
- package/content/container-blocks/descriptions.md +870 -0
- package/content/container-blocks/drawer.md +1379 -0
- package/content/container-blocks/dropdownmenu.md +643 -0
- package/content/container-blocks/flex.md +1510 -0
- package/content/container-blocks/footer.md +380 -0
- package/content/container-blocks/googlemaps.md +546 -0
- package/content/container-blocks/googlemapsheatmap.md +607 -0
- package/content/container-blocks/googlemapsscript.md +61 -0
- package/content/container-blocks/header.md +302 -0
- package/content/container-blocks/label.md +739 -0
- package/content/container-blocks/layout.md +604 -0
- package/content/container-blocks/masonry.md +1090 -0
- package/content/container-blocks/mobilemenu.md +1244 -0
- package/content/container-blocks/modal.md +1180 -0
- package/content/container-blocks/pageheadermenu.md +614 -0
- package/content/container-blocks/pagesidebarlayout.md +438 -0
- package/content/container-blocks/pagesidermenu.md +651 -0
- package/content/container-blocks/popover.md +1421 -0
- package/content/container-blocks/result.md +972 -0
- package/content/container-blocks/sider.md +1064 -0
- package/content/container-blocks/span.md +747 -0
- package/content/container-blocks/spinner.md +267 -0
- package/content/container-blocks/splitter.md +1735 -0
- package/content/container-blocks/tabs.md +1718 -0
- package/content/container-blocks/tooltip.md +1274 -0
- package/content/container-blocks/watermark.md +515 -0
- package/content/controls/for.md +103 -0
- package/content/controls/if.md +107 -0
- package/content/controls/log.md +50 -0
- package/content/controls/parallel.md +71 -0
- package/content/controls/parallel_for.md +36 -0
- package/content/controls/reject.md +56 -0
- package/content/controls/return.md +66 -0
- package/content/controls/set_state.md +98 -0
- package/content/controls/switch.md +90 -0
- package/content/controls/throw.md +79 -0
- package/content/controls/try.md +88 -0
- package/content/deployment/docker.md +149 -0
- package/content/deployment/node-server.md +27 -0
- package/content/deployment/vercel.md +101 -0
- package/content/display-blocks/aggrid.md +1459 -0
- package/content/display-blocks/anchor.md +336 -0
- package/content/display-blocks/avatar.md +1154 -0
- package/content/display-blocks/breadcrumb.md +517 -0
- package/content/display-blocks/button.md +758 -0
- package/content/display-blocks/calendar.md +156 -0
- package/content/display-blocks/dangeroushtml.md +314 -0
- package/content/display-blocks/dangerousmarkdown.md +423 -0
- package/content/display-blocks/diffgit.md +44 -0
- package/content/display-blocks/difflist.md +225 -0
- package/content/display-blocks/diffsidebyside.md +56 -0
- package/content/display-blocks/difftimeline.md +94 -0
- package/content/display-blocks/divider.md +406 -0
- package/content/display-blocks/download.md +60 -0
- package/content/display-blocks/dropdownbutton.md +661 -0
- package/content/display-blocks/echart.md +418 -0
- package/content/display-blocks/floatbutton.md +545 -0
- package/content/display-blocks/html.md +311 -0
- package/content/display-blocks/icon.md +717 -0
- package/content/display-blocks/img.md +479 -0
- package/content/display-blocks/markdown.md +520 -0
- package/content/display-blocks/markdownwithcode.md +730 -0
- package/content/display-blocks/menu.md +1123 -0
- package/content/display-blocks/message.md +941 -0
- package/content/display-blocks/notification.md +1410 -0
- package/content/display-blocks/paragraph.md +643 -0
- package/content/display-blocks/progress.md +818 -0
- package/content/display-blocks/qrcode.md +519 -0
- package/content/display-blocks/s3download.md +240 -0
- package/content/display-blocks/search.md +360 -0
- package/content/display-blocks/skeleton.md +272 -0
- package/content/display-blocks/skeletonavatar.md +222 -0
- package/content/display-blocks/skeletonbutton.md +245 -0
- package/content/display-blocks/skeletoninput.md +223 -0
- package/content/display-blocks/skeletonparagraph.md +201 -0
- package/content/display-blocks/statistic.md +485 -0
- package/content/display-blocks/steps.md +585 -0
- package/content/display-blocks/tag.md +620 -0
- package/content/display-blocks/title.md +654 -0
- package/content/display-blocks/tour.md +2359 -0
- package/content/input-blocks/autocomplete.md +786 -0
- package/content/input-blocks/buttonselector.md +964 -0
- package/content/input-blocks/checkboxselector.md +765 -0
- package/content/input-blocks/checkboxswitch.md +497 -0
- package/content/input-blocks/colorselector.md +884 -0
- package/content/input-blocks/daterangeselector.md +777 -0
- package/content/input-blocks/dateselector.md +693 -0
- package/content/input-blocks/datetimeselector.md +791 -0
- package/content/input-blocks/inputgallery.md +528 -0
- package/content/input-blocks/monthselector.md +717 -0
- package/content/input-blocks/multipleselector.md +1337 -0
- package/content/input-blocks/numberinput.md +855 -0
- package/content/input-blocks/pagination.md +679 -0
- package/content/input-blocks/paragraphinput.md +1664 -0
- package/content/input-blocks/passwordinput.md +480 -0
- package/content/input-blocks/phonenumberinput.md +688 -0
- package/content/input-blocks/radioselector.md +820 -0
- package/content/input-blocks/ratingslider.md +684 -0
- package/content/input-blocks/s3uploadbutton.md +384 -0
- package/content/input-blocks/s3uploaddragger.md +305 -0
- package/content/input-blocks/s3uploadphoto.md +288 -0
- package/content/input-blocks/segmentedselector.md +782 -0
- package/content/input-blocks/selector.md +1162 -0
- package/content/input-blocks/switch.md +552 -0
- package/content/input-blocks/textarea.md +714 -0
- package/content/input-blocks/textinput.md +639 -0
- package/content/input-blocks/tiptapinput.md +226 -0
- package/content/input-blocks/tiptapmentioninput.md +471 -0
- package/content/input-blocks/titleinput.md +1094 -0
- package/content/input-blocks/treeinput.md +144 -0
- package/content/input-blocks/treemultipleselector.md +162 -0
- package/content/input-blocks/treeselector.md +185 -0
- package/content/input-blocks/upload.md +149 -0
- package/content/input-blocks/uploaddragger.md +85 -0
- package/content/input-blocks/uploadphoto.md +84 -0
- package/content/input-blocks/weekselector.md +630 -0
- package/content/list-blocks/controlledlist.md +498 -0
- package/content/list-blocks/list.md +529 -0
- package/content/list-blocks/listselector.md +301 -0
- package/content/list-blocks/masonrylist.md +230 -0
- package/content/migration/upgrade-guide.md +106 -0
- package/content/migration/v4-to-v5.md +589 -0
- package/content/migration/v5-to-v6.md +36 -0
- package/content/operators/_actions.md +58 -0
- package/content/operators/_and.md +76 -0
- package/content/operators/_api.md +254 -0
- package/content/operators/_app.md +114 -0
- package/content/operators/_args.md +65 -0
- package/content/operators/_array.md +331 -0
- package/content/operators/_base64.md +49 -0
- package/content/operators/_boolean.md +33 -0
- package/content/operators/_build.md +166 -0
- package/content/operators/_change_case.md +357 -0
- package/content/operators/_date.md +415 -0
- package/content/operators/_dayjs.md +128 -0
- package/content/operators/_diff.md +61 -0
- package/content/operators/_divide.md +32 -0
- package/content/operators/_eq.md +52 -0
- package/content/operators/_event.md +86 -0
- package/content/operators/_function.md +52 -0
- package/content/operators/_get.md +92 -0
- package/content/operators/_global.md +86 -0
- package/content/operators/_gt.md +50 -0
- package/content/operators/_gte.md +50 -0
- package/content/operators/_hash.md +112 -0
- package/content/operators/_if.md +30 -0
- package/content/operators/_if_none.md +47 -0
- package/content/operators/_index.md +48 -0
- package/content/operators/_input.md +86 -0
- package/content/operators/_intl.md +135 -0
- package/content/operators/_item.md +166 -0
- package/content/operators/_js.md +113 -0
- package/content/operators/_json.md +120 -0
- package/content/operators/_jsonata.md +152 -0
- package/content/operators/_locale.md +65 -0
- package/content/operators/_location.md +40 -0
- package/content/operators/_log.md +22 -0
- package/content/operators/_lt.md +50 -0
- package/content/operators/_lte.md +50 -0
- package/content/operators/_math.md +407 -0
- package/content/operators/_media.md +83 -0
- package/content/operators/_menu.md +62 -0
- package/content/operators/_module.md +340 -0
- package/content/operators/_mql.md +95 -0
- package/content/operators/_ne.md +62 -0
- package/content/operators/_not.md +33 -0
- package/content/operators/_number.md +159 -0
- package/content/operators/_nunjucks.md +117 -0
- package/content/operators/_object.md +253 -0
- package/content/operators/_operator.md +33 -0
- package/content/operators/_or.md +67 -0
- package/content/operators/_product.md +45 -0
- package/content/operators/_random.md +90 -0
- package/content/operators/_ref.md +80 -0
- package/content/operators/_regex.md +69 -0
- package/content/operators/_request.md +35 -0
- package/content/operators/_request_details.md +29 -0
- package/content/operators/_secret.md +56 -0
- package/content/operators/_state.md +134 -0
- package/content/operators/_step.md +98 -0
- package/content/operators/_string.md +327 -0
- package/content/operators/_subtract.md +24 -0
- package/content/operators/_sum.md +45 -0
- package/content/operators/_switch.md +37 -0
- package/content/operators/_t.md +96 -0
- package/content/operators/_theme.md +65 -0
- package/content/operators/_type.md +78 -0
- package/content/operators/_uri.md +49 -0
- package/content/operators/_url_query.md +92 -0
- package/content/operators/_user.md +154 -0
- package/content/operators/_uuid.md +118 -0
- package/content/operators/_var.md +88 -0
- package/content/operators/_yaml.md +96 -0
- package/content/other/introduction.md +39 -0
- package/content/other/next-auth-providers.md +3 -0
- package/content/other/updatesession.md +26 -0
- package/content/plugins/plugins-actions.md +80 -0
- package/content/plugins/plugins-connections.md +98 -0
- package/content/plugins/plugins-dev.md +138 -0
- package/content/plugins/plugins-introduction.md +29 -0
- package/content/plugins/plugins-operators.md +71 -0
- package/content/testing/e2e-auth.md +108 -0
- package/content/testing/e2e-configuration.md +107 -0
- package/content/testing/e2e-getting-started.md +96 -0
- package/content/testing/e2e-introduction.md +53 -0
- package/content/testing/e2e-mocking.md +155 -0
- package/content/testing/e2e-writing-tests.md +214 -0
- package/content/tutorial/tutorial-actions-operators.md +222 -0
- package/content/tutorial/tutorial-add-blocks.md +86 -0
- package/content/tutorial/tutorial-create-page.md +57 -0
- package/content/tutorial/tutorial-display-data-page.md +181 -0
- package/content/tutorial/tutorial-next-steps.md +53 -0
- package/content/tutorial/tutorial-requests-sql.md +22 -0
- package/content/tutorial/tutorial-start.md +71 -0
- package/content/user-authentication/auth-providers.md +15 -0
- package/content/user-authentication/login-and-logout.md +122 -0
- package/content/user-authentication/users-introduction.md +31 -0
- package/index.json +2281 -0
- package/package.json +34 -0
- package/scripts/extractAgentDocs.js +130 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Deploy with Docker
|
|
2
|
+
|
|
3
|
+
### Building a Lowdefy app image
|
|
4
|
+
|
|
5
|
+
A Lowdefy app can be self-hosted or deployed to many hosting providers using Docker containers. The app needs to build into a Docker image, containing all the app configuration and the [Hono](https://hono.dev) server with its built client assets.
|
|
6
|
+
|
|
7
|
+
The `init-docker` CLI command can be used to create a Dockerfile, or the following Dockerfile can be used:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
FROM node:22-bookworm AS builder
|
|
11
|
+
|
|
12
|
+
WORKDIR /lowdefy
|
|
13
|
+
|
|
14
|
+
COPY . .
|
|
15
|
+
|
|
16
|
+
# Enable pnpm using corepack
|
|
17
|
+
RUN corepack enable
|
|
18
|
+
|
|
19
|
+
# Build lowdefy app (Lowdefy config build + Vite client build)
|
|
20
|
+
RUN pnpx lowdefy@6 build --log-level=debug
|
|
21
|
+
|
|
22
|
+
FROM node:22-bookworm-slim AS runner
|
|
23
|
+
|
|
24
|
+
ENV NODE_ENV=production
|
|
25
|
+
|
|
26
|
+
WORKDIR /lowdefy
|
|
27
|
+
|
|
28
|
+
RUN addgroup --system --gid 1001 nodejs
|
|
29
|
+
RUN adduser --system --uid 1001 lowdefy
|
|
30
|
+
|
|
31
|
+
COPY --from=builder --chown=lowdefy:nodejs /lowdefy/.lowdefy/server ./
|
|
32
|
+
|
|
33
|
+
USER lowdefy
|
|
34
|
+
|
|
35
|
+
EXPOSE 3000
|
|
36
|
+
|
|
37
|
+
ENV PORT=3000
|
|
38
|
+
|
|
39
|
+
CMD ["node", "src/index.js"]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
with a `.dockerignore` file:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
Dockerfile
|
|
46
|
+
.dockerignore
|
|
47
|
+
.env
|
|
48
|
+
node_modules
|
|
49
|
+
README.md
|
|
50
|
+
.lowdefy
|
|
51
|
+
dist
|
|
52
|
+
.git
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
An image can be built by running:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
docker build -t <tag> .
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The container can be run by:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
docker run -p 3000:3000 <tag>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Docker compose can also be used. Add a `docker-compose.yaml` file:
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
version: "3.9"
|
|
71
|
+
services:
|
|
72
|
+
lowdefy:
|
|
73
|
+
build: .
|
|
74
|
+
ports:
|
|
75
|
+
- "3000:3000"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
To build the image, run:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
docker compose build
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
To run the app, run:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
docker compose up
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Secrets and Environment Variables
|
|
91
|
+
|
|
92
|
+
When running you app in production we recommend using your hosting provider's preferred method for setting environment variables and secrets. This can often be configured using their admin interface, and secrets are usually encrypted.
|
|
93
|
+
|
|
94
|
+
When running locally, you can use the `--env-file` Docker CLI option to load a `.env` file into your container:
|
|
95
|
+
```
|
|
96
|
+
docker run -p 3000:3000 --env-file ./.env <tag>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
If using Docker compose:
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
version: "3.9"
|
|
103
|
+
services:
|
|
104
|
+
lowdefy:
|
|
105
|
+
build: .
|
|
106
|
+
ports:
|
|
107
|
+
- "3000:3000"
|
|
108
|
+
env_file: ./.env # Path to env file
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Config files or plugins outside the config directory
|
|
112
|
+
|
|
113
|
+
For security reasons, only files inside the directory of the Dockerfile can be accessed by the Dockerfile during the build process.
|
|
114
|
+
|
|
115
|
+
Sometimes files outside of the config directory need to be accessed by the Lowdefy app during build - for example using the `_ref` operator on shared config files, or when using pnpm local workspace plugins. In this case, the Dockerfile needs to be moved to a directory that includes all the files that need to be accessed and the Dockerfile needs to be modified to take this into account.
|
|
116
|
+
|
|
117
|
+
###### In pnpm monorepo with plugins
|
|
118
|
+
|
|
119
|
+
```text
|
|
120
|
+
FROM node:22-bookworm AS builder
|
|
121
|
+
|
|
122
|
+
WORKDIR /lowdefy
|
|
123
|
+
|
|
124
|
+
COPY . .
|
|
125
|
+
|
|
126
|
+
# Enable pnpm using corepack
|
|
127
|
+
RUN corepack enable
|
|
128
|
+
|
|
129
|
+
# TODO: Change config-directory (./app) as appropriate here
|
|
130
|
+
RUN pnpx lowdefy@6 build --config-directory ./app --log-level=debug
|
|
131
|
+
|
|
132
|
+
FROM node:22-bookworm-slim AS runner
|
|
133
|
+
|
|
134
|
+
ENV NODE_ENV=production
|
|
135
|
+
|
|
136
|
+
WORKDIR /lowdefy
|
|
137
|
+
|
|
138
|
+
RUN addgroup --system --gid 1001 nodejs
|
|
139
|
+
RUN adduser --system --uid 1001 lowdefy
|
|
140
|
+
|
|
141
|
+
# TODO: Change from-directory (/lowdefy/app/.lowdefy/server) as appropriate here
|
|
142
|
+
COPY --from=builder --chown=lowdefy:nodejs /lowdefy/app/.lowdefy/server ./
|
|
143
|
+
|
|
144
|
+
EXPOSE 3000
|
|
145
|
+
|
|
146
|
+
ENV PORT 3000
|
|
147
|
+
|
|
148
|
+
CMD ["node", "server.js"]
|
|
149
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Deploy with Node.js
|
|
2
|
+
|
|
3
|
+
### Run with Lowdefy CLI:
|
|
4
|
+
|
|
5
|
+
To test the production server, it can be run locally. In order to do this, first create the production build output using:
|
|
6
|
+
|
|
7
|
+
`pnpx lowdefy@6 build`
|
|
8
|
+
|
|
9
|
+
The production server can then be run using:
|
|
10
|
+
|
|
11
|
+
`pnpx lowdefy@6 start`
|
|
12
|
+
|
|
13
|
+
### Deploying the built server:
|
|
14
|
+
|
|
15
|
+
`pnpx lowdefy@6 build` writes a complete server into `<config-directory>/.lowdefy/server` — the Hono server (`src/`), the built client assets (`dist/client/`), the app build artifacts (`build/`), and `public/`.
|
|
16
|
+
|
|
17
|
+
Copy that folder (with its `node_modules`, or run `pnpm install --prod` inside it on the target machine) to your server and run:
|
|
18
|
+
|
|
19
|
+
```node src/index.js```
|
|
20
|
+
|
|
21
|
+
from inside the folder, or `pnpm start`. The server listens on `PORT` (default 3000).
|
|
22
|
+
|
|
23
|
+
Always run the build before restarting the server — the server reads the client asset manifest once at startup.
|
|
24
|
+
|
|
25
|
+
### Alternative
|
|
26
|
+
|
|
27
|
+
An alternative option would be to make use of [Docker](./docker) to deploy the app. Docker has a few advantages, including scalability, application portability, version control and deployment speed, amoung others.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Deploy with Vercel
|
|
2
|
+
|
|
3
|
+
A Lowdefy app builds a [Hono](https://hono.dev) server serving a Vite-built React client. On Vercel it is deployed with the [Build Output API](https://vercel.com/docs/build-output-api) as **static assets on the CDN plus one Serverless Function** that runs the Hono app for every dynamic request (page rendering, `/api/*` requests, endpoints, cron, auth and agents).
|
|
4
|
+
|
|
5
|
+
Run the `init-vercel` CLI command in your project to scaffold everything into a `deploy/` directory next to your `lowdefy.yaml`:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx lowdefy@latest init-vercel
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This creates:
|
|
12
|
+
|
|
13
|
+
- `deploy/vercel.install.sh` — the install command; downloads the Lowdefy server into `deploy/` and builds the config artifacts (skipping the client build, which the build step runs).
|
|
14
|
+
- `deploy/vercel.build.sh` — the build command; builds the Vite client, then runs `lowdefy vercel-output` to assemble the Vercel Build Output (`.vercel/output/`).
|
|
15
|
+
- `deploy/vercel.json` — sets the build command. The deployment itself is described by the generated `.vercel/output/config.json`.
|
|
16
|
+
- `deploy/README.md` — these instructions.
|
|
17
|
+
|
|
18
|
+
All four files are safe to commit.
|
|
19
|
+
|
|
20
|
+
###### Project settings
|
|
21
|
+
|
|
22
|
+
In the Vercel project:
|
|
23
|
+
|
|
24
|
+
- **Framework Preset:** `Other` (Lowdefy is not a Next.js app).
|
|
25
|
+
- **Root Directory:** `<config-directory>/deploy`
|
|
26
|
+
- `<config-directory>` is the directory in which the `lowdefy.yaml` file is placed.
|
|
27
|
+
- Eg: if `lowdefy.yaml` is at the top level of the repository, set the root directory to `deploy`; if it is in `apps/app_name`, set it to `apps/app_name/deploy`.
|
|
28
|
+
- **Install Command:** `bash vercel.install.sh`. Leave the **Build Command** to `vercel.json` (do not override it in the dashboard). There is no **Output Directory** setting — the build emits `.vercel/output`, which Vercel detects automatically.
|
|
29
|
+
- Enable **"Include files outside the root directory in the Build Step"** — the Lowdefy config usually lives in the parent of `deploy/`.
|
|
30
|
+
|
|
31
|
+
###### Public files
|
|
32
|
+
|
|
33
|
+
Files in your app's `public/` directory (favicon, icons, images, `manifest.webmanifest`, etc.) are copied into `dist/client` by Vite during the build, placed in `.vercel/output/static`, and served by the Vercel CDN — no extra configuration needed.
|
|
34
|
+
|
|
35
|
+
###### Secrets and environment variables
|
|
36
|
+
|
|
37
|
+
Secrets can be set in the Environment Variables settings section by creating environment variables prefixed with `LOWDEFY_SECRET_`. Use `AUTH_SECRET` (and `AUTH_URL` for OAuth) for authentication. Different secrets can be set for production and preview deployments.
|
|
38
|
+
|
|
39
|
+
###### Function settings
|
|
40
|
+
|
|
41
|
+
The whole app runs as a single Serverless Function, so its settings are configured once, app-wide, in `lowdefy.yaml`:
|
|
42
|
+
|
|
43
|
+
```yaml
|
|
44
|
+
config:
|
|
45
|
+
vercel:
|
|
46
|
+
maxDuration: 300 # seconds, default 60
|
|
47
|
+
memory: 2048 # MB — omit to use the Vercel default
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- **`maxDuration`** — the hard cap on function execution time, in seconds. Defaults to `60`. Your plan's limits apply; Vercel rejects an over-limit value at deploy time.
|
|
51
|
+
- **`memory`** — function memory in MB. Omit to use the Vercel default.
|
|
52
|
+
|
|
53
|
+
Each build writes these into the generated `.vercel/output/functions/api.func/.vc-config.json`. The output is regenerated on every deploy, so there is nothing to edit by hand — and because the deployment is prebuilt (Build Output API), `functions` settings in `vercel.json` or the dashboard's function defaults do not apply; `lowdefy.yaml` is the single source of truth.
|
|
54
|
+
|
|
55
|
+
###### Scheduled endpoints (cron)
|
|
56
|
+
|
|
57
|
+
An `Api` (or `InternalApi`) endpoint can declare `schedules` to run its routine on a timer. Each build turns those schedules into Vercel cron jobs in `.vercel/output/config.json`, so nothing is committed by hand and the crons stay in sync with your config:
|
|
58
|
+
|
|
59
|
+
```yaml
|
|
60
|
+
id: purge-stale-conversations
|
|
61
|
+
type: Api
|
|
62
|
+
schedules:
|
|
63
|
+
- cron: '0 6 * * *'
|
|
64
|
+
payload: { mode: full }
|
|
65
|
+
- cron: '*/15 * * * *'
|
|
66
|
+
payload: { mode: incremental }
|
|
67
|
+
routine:
|
|
68
|
+
- id: purge
|
|
69
|
+
type: MongoDBDeleteMany
|
|
70
|
+
connectionId: conversations
|
|
71
|
+
properties:
|
|
72
|
+
filter: { updatedAt: { $lt: { _payload: cutoff } } }
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Each schedule becomes a cron job pointing at `/api/cron/<endpointId>`. When it fires, Vercel makes a GET request to that path and the Hono app runs the endpoint's routine with the matching schedule's `payload` (available as `_payload`).
|
|
76
|
+
|
|
77
|
+
- **Secure it:** add an Environment Variable named exactly `CRON_SECRET` (a random string of 16+ characters). Vercel automatically sends it as `Authorization: Bearer <CRON_SECRET>`; the `/api/cron/*` route rejects requests whose header does not match, and returns `401` if `CRON_SECRET` is unset (fail closed).
|
|
78
|
+
- **System context:** scheduled runs have no logged-in user, so `_user` is `undefined`. The routine still has full access to connections, requests, operators and secrets — write scheduled routines so they do not depend on a user.
|
|
79
|
+
- **UTC only.** Cron expressions have 5 fields (`minute hour day-of-month month day-of-week`); named values like `MON`/`JAN` are not supported, and day-of-month and day-of-week are mutually exclusive.
|
|
80
|
+
- **Plan limits:** Vercel **Hobby** only allows daily crons (a sub-daily expression fails the deployment); **Pro**/**Enterprise** allow per-minute. Up to 100 cron jobs per project.
|
|
81
|
+
- **Idempotency:** Vercel does not retry failed runs and delivery is best-effort (a run can be missed or delivered more than once). Design scheduled routines to be idempotent.
|
|
82
|
+
|
|
83
|
+
###### Background work: async endpoints and detached calls
|
|
84
|
+
|
|
85
|
+
Two [API endpoint](/api) controls exist for work that should not hold up a response — they behave differently on Vercel:
|
|
86
|
+
|
|
87
|
+
- **`async: true` endpoints** respond `{ accepted: true }` immediately and run the routine in the background. On Vercel the invocation is kept alive via the platform request context (Fluid compute) until the routine settles — but it is still the *same* invocation, so the background work remains bounded by `maxDuration`. Raise `config.vercel.maxDuration` to cover your longest async routine.
|
|
88
|
+
- **`detached: true` on `CallApi` steps** fire-and-forget the target endpoint through a `POST` to the deployment's own `/api/detached/<endpointId>` route, so the target runs in its **own** invocation with a fresh `maxDuration` budget. The route is secured by `CRON_SECRET` (same secret as cron, fail closed), and detached steps fail with a config error if it is not set. Delivery is at-most-once with no retry; targets run as system context (`_user` is `undefined`) and must be idempotent.
|
|
89
|
+
|
|
90
|
+
See [Async Endpoints](/api) and [Detached Endpoint Calls](/api) in the API docs for full semantics.
|
|
91
|
+
|
|
92
|
+
###### Cost protection
|
|
93
|
+
|
|
94
|
+
Vercel Fluid bills by execution duration, so a request that hangs (a stuck database, SMTP or external API call) is a real cost risk. Two guardrails apply:
|
|
95
|
+
|
|
96
|
+
- **`config.requestTimeout`** (in `lowdefy.yaml`, default `30000` ms) — the server returns a timeout instead of letting a request run on. Set to `0` to disable. Agent streaming routes are exempt.
|
|
97
|
+
- **`config.vercel.maxDuration`** (default `60`) — a hard platform cap; Vercel stops the function at this many seconds. See Function settings above.
|
|
98
|
+
|
|
99
|
+
> The function runs on Vercel's Node.js runtime. Streaming agent responses (`/api/agent/*`) are exempt from `config.requestTimeout` and are bounded only by `maxDuration` — for heavy streaming or agent workloads, a long-lived Node host (Docker, Fly.io, Railway, Render) may suit better.
|
|
100
|
+
|
|
101
|
+
All other Vercel configuration like domain names, preview deploy branches, serverless regions and redirects can be configured as desired.
|