Skip to content

SQLRoomsBuild data-centric apps with DuckDB

An Open Source React Framework for Single-Node Data Analytics powered by DuckDB

Get Started in Minutes ​

Set up a simple room that loads and queries a single data table:

tsx
const {roomStore, useRoomStore} = createRoomStore((set, get, store) => ({
  ...createRoomShellSlice({
    config: {
      dataSources: [
        {
          type: 'url',
          tableName: 'earthquakes',
          url: 'https://.../earthquakes.parquet',
        },
      ],
    },
  })(set, get, store),
}));

export const MyRoom = () => (
  <RoomShell roomStore={roomStore}>
    <MyComponent />
  </RoomShell>
);

function MyComponent() {
  const isTableReady = useRoomStore((state) =>
    Boolean(state.db.findTableByName('earthquakes')),
  );
  const queryResult = useSql<{maxMagnitude: number}>({
    query: `SELECT max(Magnitude) AS maxMagnitude FROM earthquakes`,
    enabled: isTableReady,
  });
  if (!isTableReady) return `Loading…`;
  const row = queryResult.data?.toArray()[0];
  return `Max earthquake magnitude: ${row?.maxMagnitude}`;
}

Complete example on GitHub →

That's it! You've just built an app with a flexible store and UI that can be extended with various analytics, visualization and AI modules — all powered by client-side DuckDB with no backend required.

To create a new project from the minimal example, run:

sh
npx degit sqlrooms/examples/minimal my-minimal-app/
cd my-minimal-app
npm install
npm run dev

For a more comprehensive guide, see Key Concepts and the Getting Started page.