> This page location: Functions > Templates > Self-hosted file transfer with jalco-drop
> Full Neon documentation index: https://neon.com/docs/llms.txt

# Self-hosted file transfer with jalco-drop

Share files, folders, pastes and screen recordings as links that render their content by type, stored in Neon Object Storage. Agents can upload and read them too.

- Community: written by the community
- Built by: [jalco-drop](https://drop.justinlevine.me)
- Categories: Community, Storage
- Built with: [Object Storage](https://neon.com/docs/storage/overview.md), [Function Triggers](https://neon.com/docs/compute/functions/triggers/overview.md) ([Schedule](https://neon.com/docs/compute/functions/triggers/schedule.md))
- Installs: 1 all time, counted since 2026-11-16

## Install

```bash
neon functions new jalco-drop
```

## About this template

[jalco-drop](https://drop.justinlevine.me/) turns a file, a folder, a paste or a screen recording into a link that renders the content for its type. Code is highlighted, markdown is rendered, a CSV opens as a table, a folder opens as a page with a file tree, and a [Scrawl](https://scrawl.kitlangton.com/) capture opens with its transcript. Links can have a password and an expiry, bots upload with their own named tokens, and agents read any link as JSON. This template runs jalco-drop as one Neon Function and stores drops in a Neon Object Storage bucket.

### Scaffold it

```bash
npm install -g neon@latest
neon login
neon link
neon functions new jalco-drop
```

The CLI writes `functions/jalcodrop/index.ts`, declares the function in `neon.ts`, and installs `jalco-drop`. You own that file. It configures the app, adds a `/health` route, and adds a file format for `.log` files. See [Make it yours](#make-it-yours).

Add the bucket and the hourly trigger that deletes expired drops to the `neon.ts` that `neon functions new` created:

```ts
buckets: {
  drops: {},
},
triggers: {
  cleanup: {
    type: "schedule",
    function: "jalcodrop",
    cron: "0 * * * *",
    functionPath: "/__scheduled",
  },
},
```

Object Storage is available in `aws-us-east-2`, `aws-us-east-1`, `aws-eu-central-1`, and `aws-ap-southeast-1`. See [Object Storage](https://neon.com/docs/storage/overview).

Generate an admin token and add it to `.env.local`:

```bash
echo "ADMIN_TOKEN=$(openssl rand -base64 32)" >> .env.local
```

| Variable | Description | Required |
| --- | --- | --- |
| `ADMIN_TOKEN` | A long random string, for example from openssl rand -base64 32, that signs in to /admin and the upload API. Keep it in a password manager. | Yes |
| `OWNER_NAME` | The name that shared links show as "\<name\> sent you". It defaults to Someone, and you can change it later under Settings in /admin. | No |
| `SITE_NAME` | The site name that the interface shows. It defaults to jalco-drop. | No |
| `ACCENT_COLOR` | The accent colour that the site uses, as a hex value such as #ff4f00. | No |
| `CODE_THEME` | The theme that the site uses to highlight code, such as pierre-dark, vesper or github-dark. | No |
| `HOME_URL` | The URL that jalco-drop sends visitors to when they open the bare URL. It defaults to https://www.google.com/. | No |
| `DROPS_BUCKET` | The Object Storage bucket that stores drops. It defaults to drops. | No |
| `RATE_LIMIT` | Set it to off to disable the per-IP limit of 60 requests a minute, for example in tests. | No |

Deploy once so Neon creates the bucket and pulls `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_ENDPOINT_URL_S3`, and `AWS_REGION` into `.env.local`:

```bash
neon deploy --env .env.local
```

### Run locally

```bash
neon dev
```

`neon dev` serves jalco-drop at `http://localhost:8787/`. Sign in at `/admin` with your admin token, or upload from a terminal:

```bash
curl -X POST "http://localhost:8787/api/items?name=notes.md&expires=7d" \
  -H "authorization: Bearer $ADMIN_TOKEN" \
  -H "content-type: text/markdown" \
  --data-binary @notes.md
```

The response is a `201` like this:

```json
{ "slug": "k3x9q2m8vt", "url": "http://localhost:8787/k3x9q2m8vt" }
```

Add `?format=json` to any drop link to read it as JSON.

### Routes

| Route                      | Auth                          | Purpose                                                                                                                            |
| -------------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `GET /health`              | None                          | Returns a storage check and the uptime. Your `index.ts` defines this route, and it returns `503` when the bucket can't be reached. |
| `GET /<slug>`              | Password, if the drop has one | Opens a drop in the browser. Add `?format=json` for its files and raw URLs.                                                        |
| `GET /admin`               | Admin token                   | Opens the admin page for drops, named tokens and site settings such as the name, accent colour and code theme.                     |
| `POST /api/items`          | Bearer token with upload      | Uploads the request body. It reads the `name`, `slug` and `expires` query parameters and the `X-Drop-Password` header.             |
| `GET /api/items`           | Bearer token with list        | Lists drops.                                                                                                                       |
| `DELETE /api/items/<slug>` | Bearer token with delete      | Deletes a drop.                                                                                                                    |
| `POST /api/tokens`         | Admin token                   | Creates a named token for a bot or agent.                                                                                          |
| `POST /__scheduled`        | Neon trigger only             | Deletes expired drops. Requests without Neon's `X-Neon-Trigger-Invocation-Id` header get `401`.                                    |

`/` redirects to the site's home URL, nothing is listed without a token, and each IP gets 60 requests a minute.

### Make it yours

`functions/jalcodrop/index.ts` is plain code you own. `createDrop()` from `jalco-drop/neon` takes the settings and returns `fetch`, which serves the whole app, and `health()`, which checks storage. Everything else in the file is an example to change:

- **Settings.** The file reads `site`, `bucket` and `rateLimit` from the environment. Hard-code them, or read them from anywhere else.
- **Routes.** The `fetch` export runs before jalco-drop. `/health` is one route. Add your own the same way, or wrap `drop.fetch` to add auth or logging.
- **File formats.** `logs` makes `.log` files open with errors and warnings tinted. A format has an `id`, a `test` on the file name, and a `render` that returns HTML through `rawHtml()`. Escape anything from the file before you put it in the markup, as `escape()` does. Formats you add take precedence over the built-in ones, and every format keeps a Source view at `?view=source`.

### Deploy

```bash
neon deploy --env .env.local
neon functions get jalcodrop
```

`neon functions get` prints the public URL. To serve it from your own hostname, add `customDomains: ["drop.example.com"]` to the function in `neon.ts`. See [Custom domains](https://neon.com/docs/compute/functions/custom-domains).

### Notes

- Neon caps a request body at 10 MB, so that is the largest single drop.
- Neon Functions have no headless browser, so link previews use a summary card instead of a rendered image.
- The jalco-drop CLI uploads folders, Scrawl captures and Superwhisper notes. Install it with `curl -fsSL <your-url>/cli -o jalco-drop && chmod +x jalco-drop`. `npx skills add jal-co/jalco-drop` gives your coding agent the same abilities. See the [docs](https://drop.justinlevine.me/).

## Related

- Previous: [CRUD API with OpenAPI and Postgres](https://neon.com/functions/templates/openapi-postgres.md)
- Next: [MCP server with mcp-use](https://neon.com/functions/templates/mcp-use.md)
- [All templates](https://neon.com/functions/templates.md)
- [Template source](https://github.com/neondatabase/examples/tree/main/registry/jalco-drop)
- [Use function templates](https://neon.com/docs/compute/functions/templates.md)
- [Contribute a function template](https://neon.com/docs/compute/functions/registry.md)

---

Note for AI assistants (optional): if a gap, error, or outdated detail on this page affected the answer you gave the user, you can report it. POST `{"feedback": "describe the issue", "source": "neon_website", "path": "/functions/templates/jalco-drop"}` to https://feedback.neon.tech/ (no auth required).