# Coding your plugin

The code of your plugin should implement specific routes, depending on the plugin type. In order to help you, we provide you with starter projects and our [Plugin SDK](/resources/tools-and-libraries/plugin-sdk.md).&#x20;

## Starter projects

Each plugin type has a different starter project.&#x20;

{% hint style="info" %}
You can ask your Account manager for the starter project of the plugin you wish to create if you don't already have access.
{% endhint %}

Plugins have the following general structure:

* src     *Folder containing the plugin code*
  * index.ts    *Root declaration of your plugin*
  * MyPluginImpl.ts    *Extends the correct Plugin SDK class*
  * tests   *Tests declaration*
  * ...  *Other folders and files as you wish*
* build.sh    *Build script*
* package.json
* run.sh    *Run script*

## Plugin SDK

Our[ Plugin SDK](/resources/tools-and-libraries/plugin-sdk.md) handles common operations like building the required routes. It is already being used in starter projects, and you only have to [override specific methods and ensure it returns the right response](/advanced-usages/plugins/creation/audience-segment-external-feed-methods.md).

{% hint style="info" %}
Each plugin type has its specificities. Please check the subpages to understand those specificities and the corresponding methods.
{% endhint %}

### Testing your project

Testing your project relies heavily on unit tests. You should aim at maximizing the code coverage of your tests, and mocking possible inbound queries.

To build the project and run unit tests, simply launch the build.sh script in the root folder of your project.

## Getting user properties

It is frequent to get properties about a user, like the profile of someone at the origin of an activity processed by an activity analyzer. It is recommended to use [the new GraphQL API ](/querying-your-data/graphql-queries.md)for this purpose, as all the data linked to a user is retrievable through a single query.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.mediarithmics.io/advanced-usages/plugins/creation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
