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.
Create your Backend β Documentation
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>
}
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.
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.
Provide a delightful experience to your end users: With Thin Backend Live Queries your app state is synchronized in real-time across all users.
Thin generates TypeScript Definitions directly from your Database Schema.
This catches most runtime errors ahead of time, while providing really nice autocompletion.
The TypeScript definitions not only provide safety, they also provide really nice autocompletion.
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.
Thin comes with zero-setup login, user management and permissions system included. This way you can get started quickly.
Already have your own login system? The built-in login system can be fully disabled, and be integrated with your existing JWT infrastructure.
Build your apps faster with ready-to-use customizable components, like our <Crud/>
component:
function App() {
return <Crud query={query('tasks')} />
}
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.
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.
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.
Define what your users can see and edit using access policies.
Policies are implemented using the Standard Postgres Policy Engine (RLS Policies).
Check out some real code examples here:
Try out what the future of software engineering feels like