---
title: Apps
slug: apps
summary: Vite/React Apps, members-only by default; public Apps that anyone can open and that call their own public Functions; custom domains.
---

# Apps

An **App** lives at `apps/<slug>/` in a Workspace: a Vite/React project whose
entrypoint is `src/main.tsx`, plus an optional `apps/<slug>/limilake.toml`.
Pushing to `main` builds and publishes it. By default an App is for the
Workspace's members: opening it asks for a LimiLake sign-in.

## Public Apps

An App that declares `access = "public"` is served to anyone, with no sign-in,
no session and no cookies. Use it for pages a customer's customers open, such as
a candidate's profile behind a share link.

```toml
# apps/candidate-share/limilake.toml
[app]
id = "<the id limilake add app wrote>"
title = "Your profile"
access = "public"          # "members" is the default

[capabilities]
functions = ["candidate-share"]                  # the only Functions it can call
images = ["https://images.example.com/photos/"]  # optional: pictures it may show
```

`access` needs Workspace Contract v2. If the Workspace's root `limilake.toml`
says `contract = 1`, run `limilake workspace migrate` and commit its changes
first.

What a public App can and cannot do:

- It can call only the Functions its `[capabilities] functions` names that are
  declared `access="public"`. Inside them `limilake.caller()` is `None` and
  `limilake.client_address()` is the visitor's address.
- It cannot run Queries, start Function Runs, sign images, or learn a viewer.
  Pictures load directly from the `images` prefixes, which become its
  `img-src`; a prefix with characters outside `A-Z a-z 0-9 . _ ~ % - /` is left
  out.
- It cannot be framed (`frame-ancestors 'none'`), and search engines are told
  not to index it (`X-Robots-Tag: noindex, nofollow`).

### Calling its Function

The App calls its Function at its own origin:
`/__limilake/capability/functions/<function slug>/routes/<route path>`. Send JSON
with `Content-Type: application/json`; the browser adds the same-origin header
the platform checks.

## Example: a share link page

The recruiter's tool mints a share id (see
[Share links](./functions-reference.md#share-links)) and sends
`https://<the App's address>/c/cand_8f2a#t=ll_share_...`. The token sits after
`#`, so browsers never send it to a server.

The public Function validates the token for that one candidate:

```python
# functions/candidate-share/function.py
from fastapi import HTTPException
from pydantic import BaseModel

import limilake

fn = limilake.function(
    id="<the id limilake add function wrote>",
    name="candidate-share",
    access="public",
    run_as="assigned",       # the assignee needs viewer access to validate
    concurrency_limit=8,
)


class Open(BaseModel):
    candidate_id: str
    token: str


@fn.post("/candidate")
def candidate(body: Open) -> dict[str, object]:
    share = limilake.shares.validate(body.token, kind="candidate", subject=body.candidate_id)
    if share is None:
        raise HTTPException(404, "not_valid")
    return load_candidate_summary(share.subject)  # only this candidate
```

The App reads the token, calls the Function, and retries before it shows a
final error:

```tsx
// apps/candidate-share/src/load.ts
const token = new URLSearchParams(location.hash.slice(1)).get("t") ?? "";
const candidateId = location.pathname.split("/").filter(Boolean).pop() ?? "";

export async function loadCandidate(attempt = 0): Promise<unknown> {
  const response = await fetch(
    "/__limilake/capability/functions/candidate-share/routes/candidate",
    {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ candidate_id: candidateId, token }),
    },
  );
  if (response.ok) return response.json();
  // A throttled check reads like an invalid one, so a first failure is never
  // final: wait and try again before telling the visitor the link is not valid.
  if (attempt < 2 && [404, 429, 502, 503].includes(response.status)) {
    const seconds = Number(response.headers.get("Retry-After") ?? 2 * (attempt + 1));
    await new Promise((resolve) => setTimeout(resolve, seconds * 1000));
    return loadCandidate(attempt + 1);
  }
  throw new Error("link_not_valid");
}
```

## Limits

Limits slow a caller down for a minute; none of them locks anyone out.

| Limit | Value |
|---|---|
| Function calls from a public App | about 120 per minute per visitor address |
| Validations of one share by one visitor | 60 per minute |
| Failed validations by one visitor | 20 per minute |
| Concurrent runs of one Function | its `concurrency_limit` (default 4) |
| Request body to a public App's Function | 1 MiB |

Each visitor of a public App has their own address, so one visitor's failed
links never use up another's budget. Past a limit the App receives 429 with
`Retry-After`. The public App call limit is counted on each LimiLake server
that answers the App, so a visitor whose calls all reach one server can be
slowed down after about 60 calls in a minute.

## Pausing public access

A Workspace owner can stop all public access with no publish: the Workspace's
public Apps and its `access="public"` Function routes then answer 404, and no
share id validates. It takes effect from the next request.

```bash
curl -X PUT "https://app.limilake.com/api/workspaces/<workspace id>/public-access" \
  -H "Authorization: Bearer $LIMILAKE_PAT" -H "Content-Type: application/json" \
  -d '{"paused": true}'          # {"paused": false} resumes
```

Pausing is the way to take public Apps offline in an emergency. To stop one
link, revoke it with `limilake workspace share revoke <share-id>`. To make an
App members-only again, remove `access = "public"` from its `limilake.toml` and
push to `main`.

## Custom domains

A Workspace owner can serve a published App, or the HTTP routes of a Function,
on a LimiLake subdomain such as `reports.apps.limilake.app`, which works at
once, or on a hostname of their own, such as `reports.example.com`, after
publishing two DNS records. The domain keeps the App's access: a members App
still asks for a sign-in, and a public App does not. See
[Custom domains](./custom-domains.md) for the steps, the DNS records, the
limits and troubleshooting.
