Rocket is a configuration-driven API framework designed to accelerate backend development by automating standard engineering tasks. By defining models in a structured JSON format, Rocket automatically handles database schema generation, RESTful routing, request validation, and interactive documentation.
- Automated API Generation: Instant creation of CRUD, Search, and Aggregate endpoints from JSON configurations.
- Database Schema Management: Automatic handling of table creation, multi-column indexes, and foreign key constraints.
- Multi-Engine Database Support: Native support for both PostgreSQL and SQLite.
- Interactive Documentation: Integrated Swagger/OpenAPI UI available at the specified documented path.
- Robust Validation: Driven by AJV (JSON Schema) for strict and customizable request validation.
- Advanced Querying: Native support for filtering, sorting, and complex search operations.
Clone the repository and install dependencies:
git clone https://github.com/imdeepmind/rocket.git
cd rocket
npm installStart the server using an existing configuration file:
npm run dev -- -c example_config.jsonOnce the server is initialized, refer to the Swagger UI for interactive API documentation: http://localhost:3000/api/docs
Rocket utilizes a config.json file for system orchestration. Below is an overview of the primary configuration blocks:
{
"swagger": {
"enabled": true,
"basePath": "/api/docs",
"info": { "title": "Rocket API", "version": "1.0.0" }
},
"database": {
"engine": "sqlite",
"connection": { "urlOrPath": "./database.db" }
},
"models": [
{
"name": "users",
"fields": [
{ "name": "id", "type": "integer", "primaryKey": true },
{ "name": "email", "type": "string", "unique": true, "supportedOperations": ["searchable", "equal", "sortable"] }
]
}
]
}Specific operations can be enabled per field to control API exposure:
searchable: Enables full-text search capabilities on the specific field.equal,greaterThan,oneOf: Provides granular filtering options.sortable: Permits sorting based on the field values.
Rocket generates standardized endpoints for every configured model.
| Method | Endpoint | Description |
|---|---|---|
POST |
/:model |
Creates a new record. |
GET |
/:model |
Retrieves records with pagination and filtering support. |
PATCH |
/:model/:id |
Performs partial updates on a specific record. |
DELETE |
/:model/:id |
Deletes a specific record. |
POST |
/:model/search |
Executes advanced search queries. |
POST |
/:model/aggregate |
Performs data aggregations (e.g., count). |
Testing is managed via Vitest to ensure performance and reliability.
# Execute the test suite
npm test
# Generate coverage data
npm run coverageLinting is enforced to maintain high code standards:
npm run lint:check- Runtime: Node.js
- Framework: Fastify
- Architecture: TypeScript
- Database: PostgreSQL and SQLite
- Validation: AJV
- Documentation: Swagger / OpenAPI
- Testing: Vitest
