A complete REST API in under 50 lines
No hand-written controllers, no manual route registration, no boilerplate database code. Just add a data model and a route class, then let RapidREST do the rest!
RapidREST even generates a complete OpenAPI spec.
- DATA MODEL
- REST API
- JOB
- REACT PAGE
import {
DatabaseDecorators, BaseMongoEntity
} from '@rapidrest/service-core';
const { Column, DataStore, Entity } = DatabaseDecorators;
@DataStore('mongo')
@Entity()
export class Pet extends BaseMongoEntity {
@Column()
public name: string = "";
@Column()
public species: string = "";
constructor(other?: any) {
super(other);
if (other) {
this.name = "name" in other ? other.name.trim() : this.name;
this.species = "species" in other ? other.species : this.species;
}
}
}
import {
CRUDRoute, RouteDecorators
} from '@rapidrest/service-core';
import { Pet } from "../models/Pet.js";
const { Model, Route } = RouteDecorators;
@Model(Pet)
@Route('/pets')
export class PetRoute extends CRUDRoute<Pet> {}
import { BackgroundService } from "@rapidrest/service-core";
export class Job extends BackgroundService {
public get schedule(): string | undefined {
return "* * * *"; // Run every minute
}
public async run(): Promise<void> {
// TODO
}
public async start(): Promise<void> {
// TODO
}
public async stop(): Promise<void> {
// TODO
}
}
// src/services/PetService.ts
import { ObjectDecorators } from "@rapidrest/core";
import { RepoUtils } from "@rapidrest/service-core";
import { ReactService } from "@rapidrest/react";
import { Pet } from "../models/Pet.js";
const { Inject } = ObjectDecorators;
@ReactService("/app/pets")
export class PetService {
@Inject(RepoUtils, { name: Pet.name, args: [Pet] })
private petUtils?: RepoUtils<Pet>;
async fetchProps() {
return { pets: await this.petUtils?.find() };
}
}
// apps/www/pets.tsx
import type { Pet } from "../../src/models/Pet.js";
export default function PetsPage({pets}: {pets: Pet[]}) {
return (
<ul>
{pets.map((pet) => (
<li key={pet.uid}>{pet.name}</li>
))}
</ul>
);
}
Built for speed
Runs on the high-performance native HTTP library uWebSockets.js so the framework stays out of the way under load.
Decorator-driven, zero boilerplate
Automatically inject dependencies and wire API endpoints with decorators in code — no central app/router or registration files to maintain.
Database Support
Whether you prefer MongoDB or SQL, the built-in ORM layer and CRUD endpoints eliminates the boilerplate needed to build data-driven APIs and apps.
Auth & RBAC
JWT authentication and a powerful RBAC/ACL system for per-URL/class/document access control, built in, no separate library needed. Full login flows (password, MFA, OAuth) are one optional package away.
Cache System
The Redis based built-in caching system provides automatic caching of queries, documents, and server rendered React pages. Simply add `@Cache` to your model and you're done!
Deploy-ready
One command scaffolds a production Dockerfile and a Kubernetes Helm chart, Gateway API routing, auto-generated secrets, and all, alongside your project. Prefer Bun to Node.js? One flag runs it there instead.
RapidREST is incredibly fast
RapidREST delivers best-in-class performance out of the box for common workloads compared to other popular frameworks.
Requests per second on single record database read test `get_pet`.
Full methodology & more endpoints →
Battle Tested + Batteries Included
Originally developed to serve as the foundation for the award-winning Game Backend as a Service platform AcceleratXR, RapidREST is a battle-tested framework that has been used in real production at scale. The framework is meticulously designed to offer everything needed to deliver high-quality production-grade RESTful services and apps in minutes.
- Auth Server → the optional Auth Library adds password, MFA, and OAuth sign-in, or deploy the ready-made Auth Server
- Server-rendered React → unify your front-end and back-end code on the same server, no second framework to run
- Background jobs → perform background work alongside your API automatically with crontab-style scheduling
- Events, notifications & telemetry → cross-instance events, live push to connected users, and permanent activity records, all included
From nothing to running in three steps
rapidrest generate server my-apiScaffold a project
rapidrest generate route Pet --modelAdd a model + CRUD routes
rapidrest devRun it!