> For the complete documentation index, see [llms.txt](https://docs.prestd.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.prestd.com/plugins.md).

# Plugins

***prestd*** is an extensible software via plugins (**OpenCore model**), we use standard operating system library for new functionality.

[Here](https://github.com/prest/prest/discussions/466#discussion-30623) is a discussion of how we arrived at this architecture.

It is possible to create custom **endpoints and middleware** by writing an operating system library (`.so`) and ***prestd*** can load it when starting the server (api).

> We use the [plugin system of the Go language](https://pkg.go.dev/plugin) to load the lib, unfortunately it doesn't work well with *Microsoft Windows* yet - if you are working with ***prestd*** on Windows the plugin endpoint will not exist.

When starting the ***prestd*** server and there is a plugin in the `./lib` folder they are automatically compiled and loaded when accessing their respective endpoint for the first time.

**Change where the libraries will be:** `PREST_PLUGINPATH` is the name of the *environment variable* that has this purpose, by default it comes with the value `./lib`.

or via `toml`:

```
pluginpath = ./lib
```

### Extension-supported modules

* Endpoint
* Middleware

### Process of building

In the first version of the ***prestd*** plugin system we are working with **Go code**.

> This doesn't mean that ***prestd*** doesn't read plugins (library `.so`) written in other technologies (e.g. c, cpp, rust, java and ...). The automatic constructor is designed to work with Go code, in the future we will write for other technologies.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://docs.prestd.com/plugins.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.
