Pocket Servers
← Back to get started
No code needed

Never written a line of code? Let AI build it for you.

Every app on your pocket server is just one self-contained HTML file. You don't have to write it yourself — describe what you want to an AI assistant like Claude or ChatGPT, hand it the project brief below, and upload whatever it gives you back from the admin page.

01
Copy the prompt
The block below tells the AI everything it needs to know about your device's API.
02
Describe your idea
Paste it into Claude, ChatGPT, or your assistant of choice, and add what you want built.
03
Upload the result
Save what it gives you as an .html file and upload it from the admin page.

Project prompt

Copy this whole block and paste it as your first message, then add what you'd like built.

You're building an app for a "Pocket Server" — a small ESP8266 or ESP32-S3
device that runs its own private Wi-Fi hotspot with no internet access. Apps
live on it as folders; the owner drops a zip of the folder on its admin page.

Build TWO files, both in one folder (a third, pocket.js, is provided -- see below):

  index.html  — the whole app. Inline all CSS and JS, no external CDN links,
                no web fonts, no build step, no npm packages, no internet
                access at runtime (the device is fully offline).
  app.json    — the manifest:
                {"api": 1, "title": "Your app's name",
                 "paths": {"/": {"upload": "everyone"}}}
                "api" is the device's current API version (1 today; GET /version
                reports it). "paths" names, for paths inside the app's folder,
                the lowest role that may read / browse / upload / delete there —
                "everyone" or "owner". Ask for the LEAST the app needs: leave a
                verb out and only the owner may do it; "read" is everyone
                unless you say otherwise. Add "gpio": true only if the app
                drives pins.

The app is served at /<folder>/ and must never hard-code its folder name:
use relative URLs for its own files (fetch('board.json'), not
fetch('/board.json')), read the folder from location.pathname when you
need it, and keep its data files beside index.html.

A helper library, pocket.js, will sit beside index.html; load it with
<script src="pocket.js"></script> and use it rather than calling fetch
yourself. Every call returns a Promise and rejects with an Error whose
message is a sentence for the person; put err.message where they will see
it (statusEl.textContent = err.message):

  Pocket.folder                          -> the app's folder, e.g. "/guestbook"
  Pocket.readJson(name, fallback)        -> a file beside index.html, or fallback if absent
  Pocket.readText(name, fallback)
  Pocket.write(name, blobOrStringOrObject) -> create or overwrite a file beside index.html
  Pocket.writeVerified(name, text)       -> write, read back, compare
  Pocket.list()                          -> [{name, size}] / [{name, dir: true}], own files left out
  Pocket.remove(name); Pocket.mkdir(name)
  Pocket.pin.read(n); Pocket.pin.write(n, {mode, value})
  Pocket.socket(onMessage, onStatus)     -> {send, close}; reconnects on its own
  Pocket.version(); Pocket.requires(api); Pocket.app(); Pocket.allows(verb)
  Pocket.signIn(password) -> Promise | rejects "That password didn't work."; later calls are signed
  Pocket.signOut(); Pocket.isOwner()

Underneath, the device exposes this local API:

  GET    /files?path=<dir>   -> JSON array of {name, size} and {name, dir: true}
  GET    <name>               -> a file beside index.html (relative URL)
  POST   /files?path=<dir>   -> multipart/form-data upload, field name "upload"
  DELETE /files/<path>       -> deletes one file, or a folder and its contents
  GET    /apps                -> every app's resolved rules (public), if the
                                 app wants to hide controls a guest can't use
  GET    /version             -> {api, supports, firmware}
  GET    /pin/{n}             -> {pin, value} reads a GPIO pin (0 or 1)
  POST   /pin/{n}             -> body {"mode": "OUTPUT"|"INPUT"|"INPUT_PULLUP", "value": 0|1}
  WebSocket /websocket        -> connect with `new WebSocket('ws://' + location.host + '/websocket')`;
                                 anything one client sends is broadcast to every other
                                 connected client — this is how to make things multiplayer
                                 or live-updating (chat, synced games, shared state).

Permissions: reading and the WebSocket always work. Anything the manifest
doesn't grant, and anything the owner narrowed from the admin page,
answers HTTP 401. Handle it by telling the user in words what needs the
owner ("Deleting needs the owner's password") — never retry silently,
never fail silently, never show a raw status code. GPIO answers 401 until
the owner allows pin control from the app's folder on the admin page; say so. The
app's own app.json, .app-overrides.json and index.html can never be
written by guests.

It runs on a phone, in a captive-portal browser, over a slow link: usable
at 360px wide with a thumb, tens of kilobytes at most, one request at a
time for anything heavy, and empty / loading / error / full states that
each look like something. Nothing a visitor typed goes through innerHTML —
anyone on the network can reach the page and an app that stores text
serves it back to everyone. Don't store anything secret in a file on the
device; every file on it is readable by anyone who can reach it. Last
writer wins is the only concurrency model; say so or design around it.

Now here's what I want you to build:
[ describe your idea here — e.g. "a shared to-do list everyone connected can edit" ]

Save the two files it gives you into one folder, zip the folder, and drop the zip on the admin page’s upload area. If it only gave you an index.html, upload that on its own and the admin page will offer to make it an app. The full standard is the app author’s guide.

Need an idea?

Shared to-do list
Anyone connected can add or check off a task, live, for everyone else.
Magic 8-ball
Ask a question, tap to shake, get a random fortune-teller answer.
Synced dice roller
Roll a die and have the result show up on everyone's screen at once.
Want more control, or curious what's actually happening under the hood? The developer reference on the get started page covers the same API in more depth, with ready-to-run curl examples.