Tinylib
DiscoverDocsSign in
Sign in
Tinylib
AboutDiscoverDocsMake an appPricingTermsPrivacyDeveloper TermsContact

Start

  • Quickstart
    • Create an app
    • Run it on your computer
    • Publish
    • Next steps
  • How Tinylib works

Guides

  • Data
  • Rooms and rules
  • Games
  • Friends
  • Places and links
  • Reminders and notifications
  • Publishing
  • Errors and offline
  • Platforms

Client API

  • tinylib
  • tinylib.data
  • tinylib.rooms
  • tinylib.invitations
  • tinylib.friends
  • tinylib.places
  • tinylib.reminders
  • Types
  • tinylib-sdk/kits

Rules API

  • Kinds
  • ctx

Reference

  • tinylib.json
  • Command line
  • Limits

Plain text

  • llms.txt
  • llms-full.txt

Quickstart

A Tinylib app is a web page, and Tinylib runs everything behind it, so there's no server to set up.

Create an app

You need Node.js 22 or newer.

Terminal
npx tinylib-sdk init my-app

init asks for a template, then the app's name, slug, and description.

TemplateWhat it makes
solo, the default
What it makes
A tap counter for one person, saved on all their devices with tinylib.data
multiplayer
What it makes
A tap counter people share in a room, where rules.js counts the taps on Tinylib's servers
game
What it makes
Tic-tac-toe for two friends, with turns, invitations, and rematches

The slug is your app's address, as in tinylib.app/my-app, and it can't change after you first publish.

  • my-app/
    • Your app's name, slug, description, and icon.

      Referencetinylib.json
    • The page your app opens on.

    • The page's script.

      Client APItinylib
    • style.css
    • Replace it with a square PNG at least 512 pixels on a side.

    • In multiplayer and game: the code that runs its rooms on Tinylib's servers.

      GuidesRooms and rules
    • Has npm run dev and npm run publish.

Run it on your computer

Terminal
cd my-app npm install npx tinylib-sdk dev

dev opens your app twice, side by side, as two pretend users, Ada and Ben.

This is the solo template's whole app.js:

app.js
/// <reference types="tinylib-sdk" /> const greeting = document.getElementById('greeting') const tap = document.getElementById('tap') const taps = () => tinylib.data.get('taps') ?? 0 function draw() { greeting.textContent = `Hello, ${tinylib.user.name}!` tap.textContent = `Tapped ${taps()} ${taps() === 1 ? 'time' : 'times'}` } tap.onclick = () => { tinylib.data.set('taps', taps() + 1) draw() } tinylib.data.onChange(draw) tinylib.user.onChange(draw) draw()

tinylib.data keeps the count on the device, so reading it is instant and works offline, and Tinylib syncs it to the user's other devices. onChange redraws when a change arrives from one of them. Edit the greeting and save, and both panes reload.

Publish

Terminal
npx tinylib-sdk publish

The first time, it opens Tinylib in your browser to sign you in. Then it prints your app's link:

Text
✓ Published My app as version 1. https://tinylib.app/my-app

Open the link on your phone. Anyone with the link can open your app, and running publish again updates it for all of them.

Next steps

  • How Tinylib works: where your app runs, and what Tinylib runs for it.
  • Data: save the user's data on all their devices.
  • Rooms and rules: let people play or work together live.
  • Games: build a daily puzzle or a game with friends.
  • Reminders and notifications: remind the user, or notify a room's members.
  • Publishing: use TypeScript or a bundler, test with a preview, and get listed.
NextHow Tinylib works

On this page

  • Create an app
  • Run it on your computer
  • Publish
  • Next steps