ProtoRune is an Elixir framework and client library for building applications on top of the ATProtocol, including Bluesky integration. Whether you're developing bots, labelers, moderators, or custom app views, ProtoRune provides a flexible and powerful way to interact with the protocol using Elixir.
- XRPC Client: Interact with ATProto services through a simple, extensible XRPC client.
- Schema Generation: Automatically generate schemas from ATProto
defs.json
files. - Bots & Labelers: Create bots for content moderation, automated interactions, and more.
- Moderation Tools: Build labelers and moderation tools integrated with ATProto's labeling system.
- Flexible Framework: Use ProtoRune to build custom ATProto applications, including custom feeds, notifications, and more.
Add ProtoRune to your mix.exs
:
def deps do
[
{:proto_rune, "~> 0.1.0"}
]
end
Run mix deps.get
to install it.
defmodule MyApp.ProfileFetcher do
alias ProtoRune.Session
alias ProtoRune.Bsky.Actor.Defs.Profile
@spec get_profile(Session.t, actor: String.t) :: {:ok, Profile.t} | {:error, term}
def get_profile(%Session{} = session, actor: actor) do
ProtoRune.Bsky.Actor.get_profile(session, actor: actor)
end
end
defmodule MyBot do
use ProtoRune.Bot
@impl true
def handle_message(%{text: "Hello"}) do
"Hi there!"
end
end
defmodule MyModerator do
use ProtoRune.Moderator
def label_inappropriate_content(content) do
# Custom logic to label content
ProtoRune.Label.apply_label(content, :inappropriate)
end
end
Here's a section to add a roadmap to the README using checklists:
- Basic XRPC Client
- Implement a client to interact with ATProto and Bluesky services via XRPC.
- Schemas Parsing and Definition
- Define schemas like
ProfileBasicView
or evenSession
as structs
- Define schemas like
- Schema Generation
- Automatically generate Elixir structs and typespecs from
defs.json
schema files.
- Automatically generate Elixir structs and typespecs from
- Authenticated Queries
- Support for authenticated queries using session tokens.
- Flexible Query and Procedure Macros
- Macros (
defquery
anddefprocedure
) to simplify the definition of queries and procedures.
- Macros (
- Custom Bots
- Build an easy-to-use interface for creating bots that interact with ATProto services.
- Labeling and Moderation Tools
- Provide built-in support for creating labelers and moderators for content on ATProto.
- Advanced Error Handling
- Improve error handling for query execution and schema validation.
- App Views and Custom Feeds
- Allow developers to create custom feeds and views based on the ATProto ecosystem.
- Documentation and Examples
- Expand library documentation with detailed usage examples for bots, labelers, and moderators.
ProtoRune includes tools for dynamically generating Elixir modules for ATProto schemas:
-
Generate Schemas from defs.json
- Use the built-in Mix task to generate Elixir structs and typespecs for the schemas defined in the
defs.json
file.
mix proto_rune.gen.schemas
- Use the built-in Mix task to generate Elixir structs and typespecs for the schemas defined in the
-
Customizable Structs and Typespecs
- ProtoRune generates user-friendly typespecs for all query and procedure parameters, ensuring type safety and ease of use.
- Fork the repository.
- Create your feature branch (
git checkout -b feature/my-feature
). - Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature/my-feature
). - Create a new pull request.
ProtoRune is licensed under the MIT License.