Modern and declarative REST API framework for superfast and oversimplification backend development, build on top of Fastify and TypeScript.
If you find this useful, please don't forget to star ⭐ the repo, as this will help to promote the project.
- Zero configuration - Generates RESTful API routes for your data out the box
- JSON Schema validation - Build JSON Schemas to validate and speedup your requests and replies
- Highly customizable - provides a lot of possible configurations for your application
- Purely TypeScript - Written in TypeScript and comes with all the required typings
- Declarative interface - Uses decorators for routes and models definitions
- Fastify compatible - Built with Fastify and supports all its features and plugins
- Built-in DI - Provides simple Dependency Injection interface to bind your entries
$ npm install @fastify-resty/core fastify
$ npm install @fastify-resty/typeorm typeorm
import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn } from 'typeorm';
@Entity()
export default class Author {
@PrimaryGeneratedColumn()
id: number;
@Column()
firstname: string;
@Column()
lastname: string;
@CreateDateColumn()
created_at: Date;
}
import { EntityController } from '@fastify-resty/core';
import AuthorEntity from './author.entity';
@EntityController(AuthorEntity, '/authors')
export default class AuthorController {}
import fastify from 'fastify';
import { createConnection } from 'typeorm';
import { bootstrap } from '@fastify-resty/core';
import typeorm from '@fastify-resty/typeorm';
import AuthorController from './author.controller';
async function main() {
const app = fastify();
const connection = await createConnection();
app.register(typeorm, { connection });
app.register(bootstrap, { controllers: [AuthorController] });
app.listen(8080, (err, address) => {
console.log(app.printRoutes());
});
}
main();
└── /
└── users (DELETE|GET|PATCH|POST|PUT)
└── / (DELETE|GET|PATCH|POST|PUT)
└── :id (DELETE)
:id (GET)
:id (PATCH)
:id (PUT)
- Quickstart 🏷️
- Application Structure 🏷️
- Bootstrapping 🏷️
- Controllers 🏷️
- Entity Controllers 🏷️
- Model 🏷️
- Services 🏷️
- Dependency Injection 🏷️
- @fastify-resty/core - Fastify Resty core functionality
- @fastify-resty/typeorm - Fastify Resty TypeORM connector
Contributors are welcome, please fork and send pull requests! If you find a bug or have any ideas on how to improve this project please submit an issue.
Icons made by Eucalyp from www.flaticon.com