Getting Started
Get started building point-of-sale interfaces with Tally UI components, connector traits, local RxDB storage, and className styling.
Tally UI is an open-source library of composable UI components designed for building point-of-sale systems. It works with any backend through a pluggable connector system.
How It Works
Tally UI sits between your backend API and your UI. A connector maps each backend's data shape into a standard trait interface that components consume.
┌─────────────────────────────────────┐
│ UI Components │
│ <ProductTitle> <ProductPrice> ... │
└──────────────┬──────────────────────┘
│ uses traits
┌──────────────▼──────────────────────┐
│ Trait Layer │
│ getName() getPrices() getSku() ... │
└──────────────┬──────────────────────┘
│ implemented by
┌──────────────▼──────────────────────┐
│ Connector │
│ WooCommerce │ Medusa │ Vendure ... │
└──────────────┬──────────────────────┘
│ syncs with
┌──────────────▼──────────────────────┐
│ RxDB (Local Database) │
│ Offline-first, reactive │
└─────────────────────────────────────┘Quick Start
Web and native storage is RxDB Premium's SQLite, so your app needs a Premium licence key (see Storage).
pnpm add @tallyui/core @tallyui/database @tallyui/storage-sqlite @tallyui/components @tallyui/primitives @tallyui/theme @tallyui/connector-medusa rxdb rxjsimport { useEffect, useMemo, useState } from 'react';
import { ConnectorProvider } from '@tallyui/core';
import { createTallyDatabase, startReplication, type TallyDatabase } from '@tallyui/database';
import { getRxStorageSQLiteWasm } from '@tallyui/storage-sqlite/web';
import { createMedusaConnector } from '@tallyui/connector-medusa';
import { ProductCard, VStack } from '@tallyui/components';
// One connector per store session: a new connector and database on each sign-in or store change.
async function openStore(baseUrl: string, apiToken: string) {
const connector = createMedusaConnector();
const context = { connectorId: connector.id, baseUrl, headers: connector.auth.getHeaders({ api_token: apiToken }) };
const workerInput = new URL('@tallyui/storage-sqlite/web-worker', import.meta.url);
const db = await createTallyDatabase({ connector, storage: getRxStorageSQLiteWasm({ workerInput }) });
startReplication({ collection: db.products, adapter: connector.replication!.products!, context });
return { connector, db };
}
function Products({ db }: { db: TallyDatabase }) {
const query = useMemo(() => db.products.find(), [db]);
const [products, setProducts] = useState<Awaited<ReturnType<typeof query.exec>>>([]);
useEffect(() => {
const subscription = query.$.subscribe(setProducts);
return () => subscription.unsubscribe();
}, [query]);
return (
<VStack className="gap-2">
{products.map((doc) => <ProductCard key={doc.primary} doc={doc} />)}
</VStack>
);
}
function App({ connector, db }: Awaited<ReturnType<typeof openStore>>) {
return (
<ConnectorProvider connector={connector}>
<Products db={db} />
</ConnectorProvider>
);
}Next, Building a POS app adds store settings, tax, selling and the live tab.