README.md

# subaru

A simple property graph database for Elixir. Built atop Mnesia.

This is currently a heavily vibecoded prototype not to be used for anything serious. I'm going to continue playing with its API and functionality in my other personal projects and see where it goes.

## Installation

Add Subaru to your `mix.exs` dependencies:

```elixir
def deps do
  [
    {:subaru, "~> 0.1.0"}
  ]
end
```

## Usage

```elixir
# 1. Define your graph schema
defmodule MyApp.Graph do
  use Subaru.Schema

  vertex :user do
    field :name, :string
  end

  edge :follows do
    from :user
    to :user
  end
end

alias MyApp.Graph.User
alias Subaru.Query.Builder, as: Q

# 2. Commit a batch of writes
id_a = Subaru.gen_id()
id_b = Subaru.gen_id()

[]
|> Subaru.insert(%User{id: id_a, name: "Alice"})
|> Subaru.insert(%User{id: id_b, name: "Bob"})
|> Subaru.link(:follows, id_a, id_b)
|> Subaru.commit()

# 3. Build and execute queries
plan =
  Q.v(User, id: id_a)
  |> Q.out(:follows)

[%User{name: "Bob"}] = Subaru.run(plan)
```

## Configuration

Configure your desired storage backend in `config/config.exs`.

```elixir
# config/config.exs
config :subaru,
  store: Subaru.Store.Mnesia,
  db_options: [
    storage_type: :disc_copies,
    nodes: [node()]
  ]
```

## Roadmap

- **Phase 1: High-Performance Single-Node.** Implement a RocksDB storage adapter for durable, high-performance persistence on a single node.
- **Phase 2: Distributed Scale.** Introduce sharding, replication, and cross-shard traversal for clustered deployments.
- **Ongoing: Advanced Capabilities.** Continuously add advanced query features, path-finding algorithms, and performance optimizations.