[Proposal] Plugin System
- Dominant language
- Elixir
- Stars
- 1.3k
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Description
Allow users to pack config, functions, and data to extend Beacon.
Enable plugins in your site config:
```elixir
plugins: [MyBlogPlugin]
```
And the plugin implements `Beacon.Plugin`:
```elixir
defmodule MyBlogPlugin do
@behaviour Beacon.Plugin
@impl true
def config do
%Beacon.Config{
extra_page_fields: [MyBlogPlugin.PageFields.Type]
# ... and more if needed
}
end
@impl true
def install(opts) do
# install script to seed data / bootstrap content like components
# eg: insert components
end
# provide extra functions to be used on sites
def latest_blog_posts(limit) do
Beacon.Content.list_published_pages(...)
end
end
defmodule MyBlogPlugin.PageFields.Type do
@behaviour Beacon.Content.PageField
# ... omitted
end
```
* With this approach we can extend Beacon as necessary by adding new callbacks to inject code into different levels of its lifecycle.
* Config can only be merged, ie: can't remove values.
Contributor guide
Research direction
Start by reading the proposed Beacon.Plugin behaviour, Beacon.Config, Beacon.Content.PageField, and the site configuration path mentioned in the issue. Map where configuration is loaded and content is installed before defining the plugin lifecycle and callback scope. Done would require an agreed, working plugin API with configuration merging, installation, and extension points, plus tests for those behaviors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100