RestRocket is a lightning-fast, developer-friendly framework for creating REST APIs in seconds. Built with modern technologies and best practices, it allows you to focus on defining your data model while taking care of the heavy lifting of API creation.
- Instant API Generation: Define your Prisma schema and routes configuration - RestRocket handles the rest
- Type Safety: Built with TypeScript for robust type checking and better developer experience
- Authentication Ready: Integrated with Better Auth for secure authentication out of the box
- Multiple Response Formats: Supports JSON and XML responses
- Database Integration: Seamless PostgreSQL integration with Prisma
- Performance Optimized: Built on top of Bun and Hono for maximum performance
- Logging: Structured logging with Pino
- Runtime: Bun
- Framework: Hono
- Database: PostgreSQL with Prisma
- Authentication: Better Auth
- Validation: Zod
- Logging: Pino
- Code Quality: Biome
-
Clone the repository:
git clone https://github.com/BramSuurdje/RestRocket.git cd restrocket
-
Copy the environment file and configure your variables:
cp .env.example .env
-
Install dependencies:
bun install
-
Run database migrations:
bun run migrate:dev
-
Deploy the migrations to the database:
bun run migrate:deploy
-
Start the development server:
bun run dev
The API will be available at http://localhost:3000
by default.
Variable | Description | Default |
---|---|---|
POSTGRES_PASSWORD |
PostgreSQL password | changeme |
POSTGRES_USER |
PostgreSQL username | restrocket |
POSTGRES_DB |
PostgreSQL database name | restrocket |
BETTER_AUTH_SECRET |
Authentication secret key | changeme |
BETTER_AUTH_URL |
Base URL of your application | http://localhost:3000 |
LOG_LEVEL |
Application log level | debug |
bun run dev
- Start development server with hot reloadbun run build
- Generate Prisma clientbun run start
- Start production serverbun run format
- Format code using Biomebun run migrate:dev
- Run database migrations for developmentbun run migrate:prod
- Run database migrations for production
-
Define your model in
prisma/schema.prisma
:model Post { id String @id @default(uuid()) title String content String createdAt DateTime @default(now()) updatedAt DateTime @updatedAt }
-
Add your route configuration in
src/config/routes.ts
:export const routeConfigurations: RouteConfigInputType = { Post: { routeName: "post"} } as const;
-
RestRocket automatically generates:
- CRUD endpoints
- Input validation
- Type-safe responses
- API documentation
RestRocket uses Better Auth for authentication. To set up authentication:
-
Create a Better Auth client instance by following the Better Auth documentation
-
Point your Better Auth client's baseUrl to your RestRocket API instance:
export const authClient = createAuthClient({ baseURL: "http://localhost:3000" // the base url of your api server })
-
All routes in RestRocket are automatically protected by the authentication middleware. The middleware will verify the session token and make the user data available in your route handlers.
For more details about authentication features and configuration options, please refer to the Better Auth documentation.
This project is licensed under the MIT License - see the LICENSE file for details.
Bram Suurd
Made with β€οΈ by Bram Suurd