* perf(whoami): answer from the user row token auth already loaded Token auth builds the actor from the user's row with the password hash left out. It now records `hasPassword` in its place, so /whoami builds the details (`oidc_only`, `is_temp`) from the actor and skips reading the same row again by id. An actor built any other way still reads the row. * perf(thumbnails): reuse a read URL signed this hour A thumbnail's read URL is the same for the whole signing hour, so listings re-signed it for nothing. Signed URLs are kept per signing client, keyed by the signing key, bucket, object key and hour (5,000 entries, one hour). A new signing key signs afresh. * perf(kv): a refused conditional write ends at the refusal when it can `set` with `onlyIfAbsent` on a live key, and a write or delete into a foreign namespace refused by a private entry, made four store calls: the refused write, a refused expired-row delete, a consistent read and a second refused write. The conditional write now asks for the refusing item. When its `ttl` is absent, null or a number, the condition already judged it the way reads do and the refusal stands after one call. A text or boolean `ttl`, or a refusal without the item, still settles and retries as before. * perf(gui): the dashboard reads its saved settings in the boot batch The GUI's boot KV batch fetched the desktop's keys on every boot, while the dashboard read its seven (Files view and sort, Apps order, groups and uninstalled list) one request each. The batch now carries the keys of the interface that booted. The uninstalled-apps read-modify-write skips the batch, which may predate another window's write. * perf(profile): answer a revalidated GET /profile without reading it A profile write records a hash of the stored JSON in the file's metadata. GET /profile sends it as the ETag with `Cache-Control: private, no-cache` and answers a matching If-None-Match with 304 before reading the stored profile. Visibility is checked first, so a hidden profile still 404s. A profile stored before this has no tag until its next write. * fix(thumbnails): a listing's concurrent signings share one URL cache The per-client cache was registered after the first signing returned, so a cold client's first listing kept only one of the URLs it signed. * fix(kv): recheck a refusing row's expiry and its private flag A numeric `ttl` that passes while the refusal is on its way now settles and retries, as before, instead of answering false. A share holder's refused `onlyIfAbsent` takes the private flag from the refusing item rather than an eventually consistent read after it. DDBClient tests cover the request and the undecoded item on the wire. * fix(gui): Apps refreshes read the saved layout from the store Only the open's first load takes it from the boot batch. A refresh exists to pick up another tab's changes, which a batch fetched a few seconds earlier can predate. * fix(profile): tag a profile response by the bytes it carries The file is written before its entry and the entry can be read from a cache that is behind, so a 200 now carries the tag of what was read. Tags are weak (the compressed and plain bodies share one) and the early 304 sends `Vary: Accept-Encoding` like the 200. A profile stored without a tag still answers 304 to its content tag, after reading the file. * fix(kv): the GUI boot batch only answers for the token it was fetched with A sign-in from another tab swaps the token while the batch is still live, so reads under the new account fall through to the store.
Puter.js
Learn More · Docs · Tutorials · Examples · X
Puter.js gives you auth, cloud storage, database, AI, and more through a single JavaScript library. It is the go-to backend for AI-generated apps.
There is nothing to configure, no API keys, no infrastructure to set up, whether you write the code yourself or have your AI tool do it. Tools like Claude Code, Codex, OpenCode, Lovable, and Replit can generate complete, production-ready apps in a single shot with fewer AI tokens.
Installation
NPM:
npm install @heyputer/puter.js
CDN:
Include Puter.js directly in your HTML via CDN in the <head> section:
<script src="https://js.puter.com/v2/"></script>
Usage
Browser
ES Modules
import {puter} from '@heyputer/puter.js';
// or
import puter from '@heyputer/puter.js';
// or
import '@heyputer/puter.js'; // puter will be available globally
CommonJS
const {puter} = require('@heyputer/puter.js');
// or
const puter = require('@heyputer/puter.js');
// or
require('@heyputer/puter.js'); // puter will be available globally
Node.js (with Auth Token)
const {init} = require("@heyputer/puter.js/src/init.cjs"); // NODE JS ONLY
// or
import {init} from "@heyputer/puter.js/src/init.cjs";
const puter = init(process.env.puterAuthToken); // uses your auth token
const puter2 = init(process.env.puterAuthToken2); // use some other auth token
Node.js (with Auth Token + Web Login)
const {init, getAuthToken} = require("@heyputer/puter.js/src/init.cjs");
// or
import {init, getAuthToken} from "@heyputer/puter.js/src/init.cjs";
const authToken = await getAuthToken(); // performs browser based auth and retrieves token (requires browser)
const puter = init(authToken); // uses your auth token
Usage Example
After importing, you can use the global puter object:
// Print a message
puter.print('Hello from Puter.js!');
// Chat with GPT-5 nano
puter.ai.chat('What color was Napoleon\'s white horse?').then(response => {
puter.print(response);
});
Starter Templates
You can also use one of the following templates:
- Client-side projects: Angular, React, Next.js, Vue.js, Vanilla.js
- Node.js + Express: Node.js + Express template
Setting Custom Origins
By default puter.js uses the official Puter API and GUI origins. You can customize these origins by setting global variables before importing the SDK like so:
// For API origin
globalThis.PUTER_API_ORIGIN = 'https://custom-api.puter.com';
// For GUI origin
globalThis.PUTER_ORIGIN = 'https://custom-gui.puter.com';
import {puter} from '@heyputer/puter.js'; // or however you import it for your env
Documentation & Community
License
Apache-2.0