Plugin Development Quickstart
Create a custom plugin for Ever Gauzy in 10 minutes.
Prerequisitesโ
- Node.js 20+
- Gauzy development environment set up
- Understanding of NestJS modules
Step 1: Generate Plugin Skeletonโ
mkdir packages/plugins/my-awesome-plugin
cd packages/plugins/my-awesome-plugin
Create the file structure:
my-awesome-plugin/
โโโ src/
โ โโโ index.ts
โ โโโ my-awesome-plugin.module.ts
โ โโโ my-awesome-plugin.service.ts
โ โโโ my-awesome-plugin.controller.ts
โโโ package.json
โโโ tsconfig.json
Step 2: Define the Moduleโ
// src/my-awesome-plugin.module.ts
import { Module } from "@nestjs/common";
import { MyAwesomeService } from "./my-awesome-plugin.service";
import { MyAwesomeController } from "./my-awesome-plugin.controller";
@Module({
controllers: [MyAwesomeController],
providers: [MyAwesomeService],
exports: [MyAwesomeService],
})
export class MyAwesomePluginModule {}
Step 3: Create a Serviceโ
// src/my-awesome-plugin.service.ts
import { Injectable } from "@nestjs/common";
@Injectable()
export class MyAwesomeService {
getHello(): string {
return "Hello from My Awesome Plugin!";
}
}
Step 4: Add a Controllerโ
// src/my-awesome-plugin.controller.ts
import { Controller, Get } from "@nestjs/common";
import { MyAwesomeService } from "./my-awesome-plugin.service";
@Controller("my-awesome")
export class MyAwesomeController {
constructor(private readonly service: MyAwesomeService) {}
@Get()
hello() {
return this.service.getHello();
}
}
Step 5: Register the Pluginโ
Add to packages/core/src/app.module.ts:
import { MyAwesomePluginModule } from "@gauzy/plugin-my-awesome";
@Module({
imports: [
// ... other modules
MyAwesomePluginModule,
],
})
export class AppModule {}
Step 6: Testโ
yarn start:api
curl http://localhost:3000/api/my-awesome
# โ "Hello from My Awesome Plugin!"
Next Stepsโ
- Add entities โ Plugin Entity Registration
- Add lifecycle hooks โ Plugin Lifecycle
- Test your plugin โ Plugin Testing
Related Pagesโ
- Plugin Overview โ plugin system
- Plugin API Reference โ full API