New: give your agents governed data they can query and write to, no warehouse to run.Get started
Nightshift

Nightshift Fiber

The typed React API for data apps.

Build real apps on governed data. Write typed queries and get types for free, read and write through the same governed layer, and ship a hosted app where the browser never holds a credential.

$ npm i @nightshift-sdk/fiber

Safe by construction

No way to leak a credential, no way to inject.

Every request runs through the same policy as the rest of Nightshift, reads and writes alike. Grants scope what each identity can read and write, params bind as typed literals on the server, and a small proxy injects the org token so it never reaches the browser.

  • One policy over reads and writes: grants scope what each identity can do
  • Params bind server-side as typed literals, so there is no injection surface
  • A token-injecting proxy keeps credentials off the client
  • Published apps are locked to a manifest of vetted queries, so an app token runs only what you shipped
app/api/nightshift/route.ts
// Params bind server-side as typed literals. No string building,
// no injection, and grants scope what each identity reads and writes.
const rows = useQuery(topCustomers, { region, limit: 10 })

// In production, a tiny proxy injects the org token server-side,
// so the browser never holds a credential.
import { createFiberProxy } from '@nightshift-sdk/fiber-proxy'
export const POST = createFiberProxy({ token: process.env.NIGHTSHIFT_TOKEN, org: process.env.NIGHTSHIFT_ORG })

Read and write

A real backend your agents and people write to.

Fiber is not read-only. defineTable gives you insert, update, and delete over managed tables, so agents and people write through the same governed layer they read from. Every write lands in Nightshift, versioned, and your connected sources stay read-only.

  • defineTable gives ensure (creates the table if absent), insert, update, and delete, mapped to structured endpoints, with no raw write SQL
  • Writes land in managed, versioned Nightshift tables; your source of record stays read-only
  • A successful write revalidates every mounted query, so the app stays in step
ns.collections_worklistv7
invoiceNetSuitebalanceNetSuiteaccountSalesforcepriorityNightshiftactionNightshift
INV-2231$48,200AcmeHighcall
INV-2218$12,400GlobexMedemail
INV-2205$91,750InitechHighescalate
INV-2199$7,300UmbrellaLowemail
INV-2184$26,500SoylentHighcall
NetSuite and Salesforce stay read-only

Typed by default

Queries that know their own shape.

Write queries with defineQuery and Fiber generates the result and parameter types, so everything you bind them to is checked end to end.

  • Result rows and params are fully typed from the SQL
  • Persistent queries at build time, so raw SQL is never shipped to the browser
  • Refactor a query and the type errors show you every caller
queries.ts@nightshift-sdk/fiber
// One definition. Fiber generates the result and param types.
export const revenueByMonth = defineQuery(`
  SELECT month, sum(amount) AS revenue
  FROM orders
  WHERE region = $region
`)

// Inferred end to end, no hand-written types:
// revenueByMonth: Query<{ month: string; revenue: number }, { region: string }>
const rows = useQuery(revenueByMonth, { region })

Compose the UI

Bind a query to your own components.

Bind a query result to your own components, or reach for the built-in charts, tables, and metrics. Shared state keeps every filter in one place and in the URL, and live source data flows straight into the app.

  • useAppState keeps filters in one place, synced to the URL
  • Charts, tables, and metrics built in, or bind results to your own components
  • Three built-in themes, or bring your own tokens
Revenue by regionLiveshared

Net revenue · 24h

€4.28M

EMEAAmericas

Customers

1,284

EMEA share

38%

Avg contract

€61k
A data app on one governed endpoint · hosted, shareable, recorded

Everything in the box

Everything you need to build an app.

Typed queries, writes, shared state, and a hosted deploy. The full toolkit for a governed app, in a few lines of React.

Typed queries

defineQuery plus codegen turns your SQL into result and parameter types. Your editor knows the columns before you run it.

Writable tables

defineTable gives you ensure, insert, update, and delete over managed tables, mapped to structured endpoints. No raw write SQL.

Vetted-query manifest

Publish locks the app to a manifest of vetted queries, so an app token, including an agent’s, runs only what you shipped. That is what makes an agent-built app safe to ship.

Live revalidation

A write refetches every mounted query on success, so the app stays in step with the data without a manual reload.

Shared URL state

useAppState is one source of truth for filters. Every view reacts to it, and the URL carries it, so a page is shareable by link.

Charts and tables

BarChart, LineChart, AreaChart, Metric, and DataTable bind straight to a query, or bind results to your own components.

Quickstart

From install to a live app in a few lines of code.

Add Fiber to any React app, wrap it in the provider, and write your first query. The CLI generates types as you go.

$ npm i @nightshift-sdk/fiber

Building data tooling in Javascript? See Nightshift for Engineering

main.tsx
import { FiberProvider } from '@nightshift-sdk/fiber'
import { App } from './App'

createRoot(document.getElementById('root')).render(
  <FiberProvider config={{ baseUrl: '/api/nightshift' }}>
    <App />
  </FiberProvider>,
)

Build a governed app your agents can write to.

Spin up a free workspace, connect a source, and ship your first Fiber app in minutes: typed reads, governed writes, hosted.

Want to look first? Take the product tour