Backend & APIs
Define your collections in TypeScript. Get a production-ready API server with REST, GraphQL, WebSocket realtime, JWT auth, and auto-generated OpenAPI docs.
One definition, four APIs
Every collection you define automatically generates REST, GraphQL, WebSocket, and OpenAPI endpoints. Zero config.
REST API
Full CRUD endpoints with pagination, filtering, sorting, and relation loading.
GraphQL
Auto-generated schema with queries, mutations, and a built-in GraphiQL IDE.
WebSocket
Realtime data sync with auth, rate limiting, and collection/entity subscriptions.
OpenAPI/Swagger
Auto-generated OpenAPI 3.0 spec with a built-in Swagger UI for testing.
Built on Hono
The Rebase backend is a composable Hono application. Mount it standalone or embed it into your existing app. Add custom middleware, routes, and business logic.
- ✓ Composable middleware (CORS, secure headers, auth)
- ✓ Mount as a sub-app on your existing Hono/Express server
- ✓ Deploy on Node.js, Docker, Railway, Fly.io, or bare metal
- ✓ SPA static serving built in
import { initializeRebaseBackend } from "@rebasepro/backend";
const backend = await initializeRebaseBackend({
server,
app,
driver: {
connection: db,
schema: { tables, enums, relations },
},
auth: {
jwtSecret: process.env.JWT_SECRET,
},
storage: { type: "local", basePath: "./uploads" },
});
// ✅ REST, WebSocket, Auth, Storage — all ready
// Data: /api/data/:collection
// Auth: /api/auth/*
// Storage: /api/storage/* Drizzle Relational Queries
Collections generate Drizzle ORM schemas with full relation support. The query engine uses db.query.findMany with nested includes — zero N+1 queries, maximum performance.
- ✓ Auto-generated Drizzle schema from collections
- ✓ One-to-one, one-to-many, many-to-many relations
- ✓ Field-level selection (only fetch what you need)
- ✓ Cursor and offset pagination
// Your collection definition:
const postsCollection = {
slug: "posts",
properties: { title: { dataType: "string" } },
relations: [{
relationName: "author",
target: () => usersCollection,
cardinality: "one-to-one"
}]
};
// Generates Drizzle schema + REST API:
GET /api/posts?include=author
// → Single query, no N+1 Batteries Included
Storage, email, and auth — everything you need for production, built in.
File Storage
Local filesystem for development, S3-compatible storage for production. Upload, download, list, and delete via API.
Email Service
Built-in SMTP integration for password reset, email verification, and custom transactional emails.
JWT Authentication
Custom JWT auth with access/refresh tokens, Google OAuth, role-based access control, and session management.