Skip to main content
genzy logogenzy logo

Web framework for building better APIs faster!

npm install -g genzy

genzy is your ultimate development companion, a versatile and robust Node.js framework built to empower your projects. It streamlines API creation, handles code generation, and empowers customization. Whether you're integrating it into an existing project or building from the ground up, Genzy offers flexibility, efficiency, and versatility to meet your specific needs.

Rapid Development

You don't have to spend time and effort on configuring the web API and the documentation. Focus on the business logic, and let Genzy handle the rest.

Automation

Let Genzy's automation take the wheel, ensuring efficiency and eliminating manual configurations. Simplify your workflow and concentrate on your core tasks.

Flexibility

With Genzy, you're in control. Whether you're looking to enhance your existing project or build an entire application from scratch, Genzy adapts to your needs, making every use case a breeze.

Framework
A good choice for building scalable REST APIs with ease

@Controller("/user")
class UserController {

@Get("/")
@ReturnsArrayOf(User)
async getAll() {
return [];
}

@Get("/:id")
@Returns(User)
async getOne(@Path("id") id: string) {
return { id };
}

@Post("/")
@Returns(User)
async create(@Body({ type: User }) body: any) {
return { body };
}

@Put("/:id")
@Returns(User)
async update(@Path("id") id: string, @Body({ type: User }) body: any) {
return {
id,
body,
};
}

@Delete("/:id")
@Returns(User)
async delete(@Path("id") id: string) {
return {
id,
};
}
}

class User {
@string() id: string;
@string() username: string;
@string() password: string;
@string({ optional: true }) firstName: string;
@string({ optional: true }) lastName: string;
@string() email: string;
}
controllers
Create API endpoints
Define and implement HTTP endpoints with ease. Genzy simplifies API development by automatically generating OpenAPI specifications and Swagger UI, based on your endpoints and schemas.

const apiModule = new GenzyModule()
.addLocalService(AuthController)
.addLocalService(UserController);

const authModule = new GenzyModule()
.addLocalService(AuthService)
.addLocalService(UserService)
.addLocalService(UserRepository)
.addLocalService(RedisService);

apiModule.addAccessToModule("services", authModule);

const app = new GenzyApi({
genzyInfo: {
name: "Auth API",
description: "API for authentication",
version: "0.0.1",
},
}).buildAppFrom(apiModule);
modules
Group services into Modules
Simplify project structure with Genzy's Modules. Organize and group your services effortlessly, streamlining your development workflow for a more efficient and intuitive experience.

import { GenzyApiModuleDeps } from "../index.ts";


export class AuthController {
private authService: GenzyApiModuleDeps["services"]["authService"];
private userService: GenzyApiModuleDeps["services"]["userService"];
private redisService: GenzyApiModuleDeps["services"]["redisService"];

// automatically injected by the module
constructor(deps: GenzyApiModuleDeps) {
this.userService = deps.services.userService;
this.authService = deps.services.authService;
this.redisService = deps.services.redisService;
}

// ...

}
IoC
Inject dependencies
Achieve flexibility and maintainability in your application. Genzy's Inversion of Control (IoC) feature allows you to seamlessly inject dependencies, giving you more control over your application's behavior.

import { GenericType } from "genzy";


@Controller("", GenericType)
export class GenericController<T> {
@Get("/")
@ReturnsArrayOf(GenericType)
async getAll(): Promise<T[]> {
return [];
}

@Get("/:id")
@Returns(GenericType)
async getOne(@Path("id") id: string): Promise<T> {
return {};
}

@Post("/")
@Returns(GenericType)
async create(@Body({ type: GenericType }) body: any): Promise<T> {
return {};
}

@Put("/:id")
@Returns(GenericType)
async update(
@Path("id") id: string,
@Body({ type: GenericType }) body: any
): Promise<T> {
return {};
}

@Delete("/:id")
@Returns(GenericType)
async delete(@Path("id") id: string): Promise<T> {
return {};
}
}

// concrete implementation
@Controller("/user", User)
export class UserController extends GenericController<User> {
// you can override the methods
async create(body: User): Promise<User> {
console.log(body);
body.id = "123";
return super.create(body);
}
}
Generics
Embrace Code Flexibility
Genzy's support for generics allows you to embrace versatility and adaptability in your projects. Unleash the potential of your code with ease.

/*
You can easily integrate with third party APIs
*/

@Controller("/v2/users")
class Auth0UsersProxy {
// a call to this method will result in
// a GET request to <HOST>/api/v2/users
@Get("/")
@ReturnsArrayOf(User)
async getAll() {
return [];
}
}

/*
just register it as a remote service
that points to the external API
*/
const clientModule = new GenzyModule().addRemoteService(
"https://@@TENANT@@.auth0.com",
AuthControllerProxy
);

/*
You can also access your own API
*/

// every controller can also be an HTTP client proxy
@Controller("/auth")
class AuthControllerProxy {
// a call to this method will result in
// a POST request to <HOST>/api/auth/login
@Post("/login")
@Returns(User)
async login(@Body({ type: User }) body: any) {
return {};
}
}

/*
just register it as a remote service
that points to your own API
*/
const clientModule = new GenzyModule().addRemoteService(
"http://localhost:3000",
AuthControllerProxy
);
HTTP Client Proxy
Integrate with external APIs
Effortlessly connect with external APIs using Genzy's HTTP Client Proxy. Integrate third-party services into your application to enhance functionality and data exchange.

const app = new GenzyApi({
n1mblyInfo: {
name: "Auth API",
description: "API for authentication",
version: "0.0.1",
},
})
/*
Add a plugin for API request validation
every request will be validated against the
schema defined in the controller
*/
.addPlugin(new ZodValidationPlugin())
/*
Add a plugin for handling access to
Redis and injecting the RedisService
into the specified modules
*/
.addPlugin(new RedisPlugin({ modules: [authModule] }))
.buildAppFrom(apiModule)
Plugin System
Use Custom Plugins
Enhance framework's capabilities with Genzy's Plugin System. Easily integrate custom plugins to tailor your development experience and add functionality as needed.

# In order to generate client code for your API
# that's running on http://localhost:3000, just run:

genzy generate \
-l typescript \
-h http://localhost:3000/api \
-o ./src/client
CLI
Code Generation Made Simple
Using genzy CLI, you can generate client code for accessing your API. Simplify your development process and maximize your productivity from the command line.
DevTools
Bridging the gap between full-code freedom and low-code efficiency
TODO: GIF HERE
DevTools
Unlock Limitless Possibilities with Genzy DevTools
With Genzy's DevTools, you can effortlessly craft projects, controllers, services, and models through the intuitive UI. Genzy generates server code automatically, preserving user-defined code even when changes are made, giving you the power to do more.