Build your first TinyCloud app in the browser in under 5 minutes
Get TinyCloud running in your browser app and store your first piece of data. By the end of this guide you will have a working app that authenticates a user, writes data to their personal space, reads it back, and generates a share link.
A wallet extension like MetaMask installed in your browser
TinyCloud uses Sign-In with Ethereum (SIWE) for authentication. Your wallet signs a message to prove ownership of your address — no transaction or gas fees required.
Do not have a wallet extension? You can use OpenKey as a passkey-based alternative to MetaMask. OpenKey manages Ethereum keys inside a TEE so users do not need a browser extension.
Create a new TinyCloud instance in your application.
3
Quick
Copy
import { TinyCloudWeb } from '@tinycloud/web-sdk';const tc = new TinyCloudWeb();
Explained
Copy
import { TinyCloudWeb } from '@tinycloud/web-sdk';// Create a TinyCloud instance with configuration// All options are optional -- sensible defaults are usedconst tc = new TinyCloudWeb({ // TinyCloud node(s) to connect to tinycloudHosts: ['https://node.tinycloud.xyz'], // Prefix for your app's space name (helps avoid collisions) spacePrefix: 'myapp', // Automatically create a space on first sign-in (default: true) autoCreateSpace: true, // Prefix prepended to all KV keys your app writes kvPrefix: 'myapp', // Show popup notifications for important events notifications: { popups: true },});
4
Sign In
5
Authenticate the user by connecting their wallet and signing a message.
// signIn() triggers the wallet connection flow:// 1. Prompts user to connect their wallet (e.g. MetaMask)// 2. Requests a SIWE signature to prove address ownership// 3. Establishes an authenticated session with the TinyCloud node// 4. Creates a space for the user if one does not existawait tc.signIn();// After sign-in, the user's Ethereum address is availableconsole.log('Address:', tc.address());
7
With autoCreateSpace: true (the default), the SDK automatically provisions a personal space for first-time users during sign-in.
// Store a JSON object under the key 'profile'// Data is stored in the user's space on TinyCloudconst putResult = await tc.kv.put('profile', { name: 'Alice', joined: new Date().toISOString(),});if (putResult.ok) { console.log('Data saved!');}// The data is now persisted and only accessible// by this user (or those they delegate access to)
11
Retrieve Data
12
Read the data back from storage.
13
Quick
Copy
const result = await tc.kv.get('profile');if (result.ok) { console.log('Retrieved:', result.data.data);}
Explained
Copy
// Retrieve the value stored under 'profile'const result = await tc.kv.get('profile');// Returns the original object: { name: 'Alice', joined: '...' }if (result.ok) { console.log('Retrieved:', result.data.data);}
// List all keys matching a prefix// Call without arguments to list everything in the spaceconst listResult = await tc.kv.list();if (listResult.ok) { console.log('All keys:', listResult.data.keys);}// Remove a key and its valueconst delResult = await tc.kv.del('profile');if (delResult.ok) { console.log('Deleted profile');}
17
Share Data
18
Generate a share link so anyone can receive your data — no account required on the receiving end.
// Generate a time-limited share link for a specific path// The link encodes a delegation that grants read accessconst result = await tc.sharing.generate({ path: 'profile', // The path to share expiry: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000), // Link expires in 7 days});// Share links use the tc1: prefix and can be sent// over any channel -- chat, email, QR code, etc.if (result.ok) { console.log('Share link:', result.data.token); // tc1:...}
20
To receive shared data on the other end:
21
// Static method -- no authentication requiredconst result = await TinyCloudWeb.receiveShare('tc1:...');if (result.ok) { console.log('Shared data:', result.data.data);} else { console.error('Share expired or invalid:', result.error);}
22
receiveShare is a static method on TinyCloudWeb. The recipient does not need to sign in or have a wallet to view shared data.