Skip to main content

Guidelines to create a server plugin

Structure of a plugin

  • src
    • index.ts: This will be the merger file of a plugin.
  • template : The entire running project for backend or frontend lies here. This has all the features, for example auth, chat, media etc.

Destructuring template folder

  • src/: Source directory containing application code.
    • app.module.ts: The root module orchestrating the application.
    • common/: All the common utilities comes here.
      • dto/: Have common response dto's.
      • enums/: Have all the common enums used.
      • interceptors/: Contains interceptors that transforms the requests.
      • logger/: Contains basic logging service.
    • config/: Contains the env config module.
    • db/: Contains all the db related stuff.
      • @generated/: All the generated types comes here.
      • auth/: Contains all the db repository and service for a particular plugin(auth in this case).
      • prisma/: Have all the schema related files, migrations and seedings.
      • db.module.ts: This file is responsible for configuring the database module in the plugin. It defines the providers and imports necessary for setting up the database-related functionality.
      • db.service.ts: This file contains the implementation of the database service for the plugin to connect to the database.
  • test/: Directory for unit and end-to-end tests.
  • node_modules/: Directory for installed NPM dependencies.
  • package.json: Configuration file for NPM packages and scripts.
  • README.md: Documentation for the base module.