Instant API for your Postgres DB

Instead of manually writing REST API endpoints or GraphQL resolvers, use a Thin Backend server to automatically get a fully featured API backend on top of your Postgres DB.

  • πŸš€ Build 10x faster, no boilerplate
  • πŸ›‘οΈ End-to-end type safe
  • ⏭ Great Autocompletion
  • βœ… Optimistic Updates
import { query, createRecord } from 'thin-backend';
import { useQuery } from 'thin-backend-react';

function Tasks() {
    // `useQuery` always returns the latest records from the db
    const tasks = useQuery(query('tasks').orderBy('createdAt'));

    return <div>
        {tasks.map(task => <Task task={task} key={task.id} />)}
    </div>
}

function Task({ task }) {
    return <div>{task.title}</div>
}

function AddTaskButton() {
    const handleClick = () => {
        const task = { title: window.prompt('Title:') };

        createRecord('tasks', task);
    }

    return <button onClick={handleClick}>Add Task</button>
}

function App() {
    // No need for redux or other state management libs
    // `useQuery` automatically triggers a re-render on new data
    return <div>
        <Tasks />
        <AddTaskButton />
    </div>
}
Ian Obermiller
Software Engineer, Netflix
Overall using thin-backend has been one of the most delightful experiences I've had making an SPA with a simple backend. The developer experience with the generated TypeScript types is particularly awesome!
Henry Lambert
Founder, Comhlan
From a developer point of view with Thin it feels like you can move directly from a schema to a user interface without having to spend a single line of code on network configuration or intermediate application layer logic.

Why you'll love using Thin Backend

Blazing Fast, Lowest Latency

Delight your end-users with superior speed and lowest latency. With built-in Optimistic Updates your app doesn't need to wait for the server to respond back until the changes are visible on the screen.

Git-like Migrations

Whenever you add or change a table in the Schema Designer, the changes will only be applied to the in-memory schema. The actual postgres database will only be touched when you run migrations.

Realtime

Provide a delightful experience to your end users: With Thin Backend Live Queries your app state is synchronized in real-time across all users.

End-to-end Type safety

Thin generates TypeScript Definitions directly from your Database Schema.

This catches most runtime errors ahead of time, while providing really nice autocompletion.

Top-notch Autocompletion

The TypeScript definitions not only provide safety, they also provide really nice autocompletion.

Use Thin Backend with your favorite frameworks:

Build Realtime Apps

Local state management is fundamentally hard as it’s dealing with distributed system problems.

The Solution:
Making app state = database state.

If your components always reflect the latest database state you will save large amounts of code needed for state management alltogether.

Thin Backend allows you to easily subscribe to any of data.

With the useQuery hook you can subscribe to any database table. The component will automatically change when a row has been updated in the table.

Schema First Design

The Schema

At the center of an Thin backend application are the data structures. Tables and columns are the basic building blocks used to design backends.

Based on the Schema Thin Backend derives the APIs and Migrations.

SQL-Centric

Thin backend promotes the use of plain SQL over proprietary abstractions. Instead of defining your database schema inside a proprietary DSL we use standard SQL DDL statements. This allows you to quickly connect existing applications to your Thin Backend.

Evolve your database schema over time

Thin Backend provides support for database migrations out of the box. Thin Backend automatically detects outdated tables and provides helpful tools to automatically migrate your database to the latest version.

Access Policies

Define what your users can see and edit using access policies.

Policies are implemented using the Standard Postgres Policy Engine (RLS Policies).

The Next Generation of Web Applications will be Blazing Fast and Multiplayer by default