Build on the drop platform
Make a drop's page greet its visitor, store and sync data, accept uploaded files and read company data, with no backend of your own.
A drop is static files, but its page can still know who is visiting, keep shared data and take
uploads. Every drop host serves a small module, dropshelf.js, that does this with no backend. This
guide is for developers and agent builders who write such a page.
Each task below shows one example. The In-page JavaScript API lists every method, its arguments, its answers and its errors.
An agent with the CLI reads the same guidance for its own instance, limits included, with
dropshelf guide platform.
Prerequisites
- A drop you can publish, such as a folder with an
index.html. See Publish a drop. - For stored data, uploaded files or company data, an admin has turned the feature on. See Turn on optional features.
Three features are off until an admin turns them on:
| Feature | Instance setting | Lets a page |
|---|---|---|
| Drop data and live sync | platform.db.enabled | Store documents and see changes live |
| Uploaded assets | platform.assets.enabled | Accept files from visitors |
| Connectors | connectors.enabled | Read company databases through named queries |
Knowing who the visitor is works on every instance. To check the others, read platform on
GET /api/v1/instance, or ask an agent connected over MCP to read dropshelf://instance.
Load the module
The module lives on the drop's own address, at /_dropshelf/dropshelf.js. Import it in a module
script:
<script type="module">
import dropshelf from '/_dropshelf/dropshelf.js';
</script>Every call goes to the drop's own host with the visitor's sign-in, so the page holds no credentials.
A refusal throws a DropshelfError, whose status and detail say what went wrong.
Greet the visitor
dropshelf.me() answers the signed-in member who opened the drop. To greet them by name and show
their picture:
const me = await dropshelf.me();
document.querySelector('h1').textContent = `Hi ${me.name}`;
document.querySelector('img.avatar').src = me.avatarUrl ?? me.picture ?? '/placeholder.svg';To show who wrote something, store the member's id and look the name up with dropshelf.users(ids).
Names change, and any writer could store any name, so the id is the safe thing to keep.
Put names and every other stored value into the page with textContent, never innerHTML.
Store data and keep it in sync
With drop data on, a page stores JSON documents in named collections. The data belongs to the drop, not to a version, so publishing a new version keeps it.
To record one vote per visitor and show the tally live in every open tab:
const me = await dropshelf.me();
const votes = dropshelf.db.collection('votes');
// One document per member, under the member's own id.
await votes.put(me.id, { place: 'Taco Truck' });
// Call render with every vote, now and after each change.
const stop = votes.sync({ onChange: (items) => render(items), onError: (err) => showBanner(err) });A document's id that is a member's id belongs to that member, so nobody else can write their vote. Anyone who can open the drop can read and create documents. Only a document's creator, the drop's owner, an editor or an admin can change or delete it.
To show a control only to the people who can use it, check the visitor. me.canEdit is true for the
drop's owner, an editor and an admin:
deleteButton.hidden = !(doc.createdBy === me.id || me.canEdit);Let everyone change the same documents
A checklist or a board needs every visitor to change the same documents, not only their own. To allow that, share the collection. The drop's owner or an editor runs this once:
dropshelf db share itemsFrom then on anyone who can open the drop can patch, put and delete the documents in items,
and each document's updatedBy says who changed it last. A document under a member's own id still
belongs to that member. dropshelf db lists which collections are shared, and
dropshelf db share items --off gives the documents back to their creators.
A page cannot share a collection, because then any visitor could, and it cannot ask whether one is
shared. Share the collection before you publish the page that needs it, and have that page show its
edit controls to every visitor, not only to the creator and to me.canEdit.
A first push goes live at once, and a collection can only be shared on a drop that exists. For a new drop, push it as a draft, share the collection, then publish:
dropshelf push --draft --type site --slug release-checklist
dropshelf db share items
dropshelf publishAn export holds the documents, not the sharing. After you restore a backup into a new drop, share the collection again.
sync holds one connection per collection. Keep the number of synced collections small, because a
browser allows about six HTTP/1.1 connections per host.
sync loads every document that matches and takes no limit. Narrow a large collection with
where. For a long list shown a page at a time, use list with limit and after, and
subscribe for the changes.
Show a long list a page at a time
To load a long list in pages and still see changes live, read the pages with list and listen with
subscribe:
// A long list, a page at a time: list reads the pages, subscribe brings what changes meanwhile.
const photos = dropshelf.db.collection('photos');
const shown = new Map(); // id -> document
let next = null; // the cursor of the next older page
const keep = (d) => { const have = shown.get(d.id); if (!have || have.rev < d.rev) shown.set(d.id, d); };
async function more() {
const page = await photos.list({ orderBy: 'createdAt', order: 'desc', limit: 30, after: next });
page.items.forEach(keep);
next = page.next; // null on the last page: hide "Load more"
render([...shown.values()]);
}
const stop = photos.subscribe({
onChange: (d) => { keep(d); render([...shown.values()]); }, // created or changed
onDelete: (id) => { shown.delete(id); render([...shown.values()]); },
onReset: () => { shown.clear(); next = null; more(); }, // start again from the first page
});
await more();render sorts what it is given, because a change can arrive for any document. A cursor is a place in
the order, so it stays valid while documents are added and deleted. Pass it back with the same
where, orderBy and order.
To read the data outside the page, an owner or editor uses dropshelf db in the
CLI. Back up the data before you publish a version that changes its shape:
dropshelf db export --all -o ../team-lunch-backup/Write the backup outside the drop's folder, so the next push does not publish it.
Accept uploaded files
With uploaded assets on, a page accepts files from its visitors, such as photos, screenshots or documents. The drop serves each file from its own address.
To upload a picked file with a progress bar and show it:
const input = document.querySelector('input[type=file]');
const bar = document.querySelector('progress');
const asset = await dropshelf.assets.upload(input.files[0], {
onProgress: (fraction) => { bar.value = fraction; },
});
document.querySelector('img.preview').src = asset.url;
await dropshelf.db.collection('photos').create({ asset: asset.id });Keep the asset's id in a document, because assets have no live stream of their own. Other tabs
then see the new photo through the document. To show it, build the address from the id with
dropshelf.assets.url(id). Do not store the URL itself: any member can write any string into a
document, so a stored URL could point outside the drop. onProgress is called with the fraction
sent so far, from 0 to 1. To store an asset under another name than the file's, pass
{ name } to upload. upload checks the drop's limits first, so a file that is too large is
refused before it is sent. dropshelf.limits() answers those limits for the page to show.
An asset and the document that names it are separate. After an upload, create the document at once, and delete the asset if that fails. To remove one, delete the document first and the asset second, so a failure between the two leaves an unused asset, not a broken picture.
Images, audio and video open in the page. Every other file, SVG, HTML and PDF included, downloads when opened in a tab.
Read company data
With connectors on, an admin connects company databases as sources and grants people their use. A drop then reads them through queries it declares, and the page never sends SQL or holds a credential.
To show daily sign-ups:
-
Declare the query in
_dropshelf/queries.yamlat the top of the drop's folder:queries: daily_signups: source: sales sql: | SELECT day, channel, signups FROM marketing.daily_signups WHERE day >= :from ORDER BY day params: from: { type: date } -
Run it from the page by name:
const result = await dropshelf.connect('sales').run('daily_signups', { from: '2026-10-01' }); const rows = result.objects(); document.querySelector('.updated').textContent = `Updated ${new Date(result.fetchedAt).toLocaleTimeString()}`; -
Publish the drop. The deploy checks every query, and refuses one your grants do not cover.
Company data in a drop explains sources, grants, parameter types and caching.
Read an MCP server
A source can also be an MCP server an admin has added. A drop then declares the tool calls it makes, and each call runs with a member's own connection to the server.
To list open tickets:
-
Declare the call in
_dropshelf/queries.yaml, withtoolandargsin place ofsql:queries: open_tickets: source: tickets tool: search_tickets args: status: open team: "{{team}}" params: team: { type: enum, values: [support, sales], default: support } -
Run it from the page by name:
const answer = await dropshelf.connect('tickets').run('open_tickets', { team: 'sales' }); const tickets = answer.result; -
Publish the drop. Each visitor's call runs with their own connection to the server.
These rules hold for every call:
toolis one tool the source allows.describe_sourceover MCP lists them with their arguments.argsis an object, at most 64 KB as JSON. It takes no YAML anchors or aliases.- A
{{name}}placeholder is filled from a declared parameter. As a whole argument, it takes any type. Inside longer text, it takes an enum, a number, a boolean, a date or a timestamp. {{viewer_id}}and{{viewer_email}}are filled from the signed-in visitor, as a whole argument only.- The answer's
resultis what the tool returned, andaccessisviewer, ornoneon a server that asks nobody to sign in.
Use an MCP server's data in a drop explains connecting and what each visitor sees.
Confirm it worked
Open the drop's address while signed in. The page greets you by name. With drop data on, open the page in two tabs and vote in one: the tally changes in both.
Next steps
- In-page JavaScript API
- Company data in a drop
- Use an MCP server's data in a drop
- The dropshelf CLI
- Turn on optional features
- Connect an agent
Last updated .