Skip to content

Plugin Development

This recipe will go through creating your first plugin for the Sodacore framework and how to create and work with plugins.

What is a plugin?

Within the Sodacore ecosystem, a plugin is a self-contained package that extends the functionality of the core framework. Plugins can add new features, modify existing behavior, or integrate with third-party services. They are designed to be easily installed, configured, and managed within the Sodacore environment.

Sodacore is made up of several core plugins; HTTP, WS, Prisma, I18n, Discord, and more.

You can simply look at the project within Github if you are unsure about something, this section recipe is simply going to create a sample plugin to get you started.

Why create a plugin?

Creating a plugin allows developers to:

  • Extend Functionality: Add new features or capabilities to the Sodacore framework without modifying the core codebase.
  • Modular Development: Develop features in isolation, making it easier to maintain and update.
  • Community Contribution: Share plugins with the community, allowing others to benefit from your work.
  • Customization: Tailor the framework to specific use cases or requirements.

Sometimes creating a plugin, even if it's just internally can help keep your codebase clean and modular and split your code into separation of concerns.

Setup

To create your first plugin, we suggest using the Sodacore Create tool.

To do this, see below:

Sodacore Create package demonstration of a plugin structure being boilerplated.

This will create a new plugin structure for you, with all the necessary files to get started.

TIP

Open the project, by moving to that directory, and then you can call code . to open the project in VSCode.

To develop, simply look at the concepts, add the features you want, and then ensure you manually register them in the plugin class's install method.

TIP

We suggest also exporting classes and types people will need, and the current design, we export default the plugin class itself.

We shall expand more, but for now, this should get you started and once we have some good examples we can add them here.

Released under the Apache-2.0 License.