SDK Documentation

Mu SDK

The Mu SDK is automatically available in all apps as window.mu.

Database (mu.db)

Per-user persistent storage. 100KB quota per app.

// Get a value
const value = await mu.db.get('key');

// Set a value (can be any JSON-serializable data)
await mu.db.set('key', value);

// Delete a key
await mu.db.delete('key');

// List all keys
const keys = await mu.db.list();

// Check quota
const {used, limit} = await mu.db.quota();

Fetch (mu.fetch)

Server-side proxy for fetching external URLs. Bypasses CORS restrictions.

// Fetch any URL (no CORS issues!)
const response = await mu.fetch('https://api.example.com/data');
if (response.ok) {
  const text = await response.text();
  const json = await response.json();
}

Always use mu.fetch() instead of fetch() for external URLs.

Theme (mu.theme)

CSS variables are automatically injected. Use them for consistent styling.

/* Available CSS variables */
var(--mu-text-primary)      /* #1a1a1a */
var(--mu-text-secondary)    /* #555 */
var(--mu-text-muted)        /* #888 */
var(--mu-accent-color)      /* #0d7377 */
var(--mu-accent-blue)       /* #007bff */
var(--mu-card-background)   /* #ffffff */
var(--mu-card-border)       /* #e8e8e8 */
var(--mu-hover-background)  /* #fafafa */
var(--mu-spacing-xs/sm/md/lg/xl)
var(--mu-border-radius)     /* 6px */
var(--mu-shadow-sm)
var(--mu-shadow-md)
var(--mu-font-family)

/* Get value in JS */
const color = mu.theme.get('accent-color');

User Context (mu.user)

mu.user.id        // User ID (string) or null if not logged in
mu.user.name      // User's display name or null
mu.user.loggedIn  // boolean

App Context (mu.app)

mu.app.id    // This app's unique ID
mu.app.name  // This app's name

Example: Web Browser App

// Fetch a webpage (mu.fetch bypasses CORS)
const url = document.getElementById('url').value;
const response = await mu.fetch(url);
if (response.ok) {
  const html = await response.text();
  document.getElementById('content').textContent = html;
}

Featured Apps