Skip to main content

Installation

Arcana requires PostgreSQL with the pgvector extension and an Nx backend for local embeddings. This guide covers installation with Igniter (recommended) and manual setup.

Prerequisites

  • Elixir 1.14+ and Phoenix 1.7+
  • PostgreSQL 12+ with pgvector extension
  • An Nx backend (EXLA, EMLX, or Torchx) for local embeddings

Installation Methods

Database Setup

PostgreSQL with pgvector

Arcana requires PostgreSQL with the pgvector extension for vector similarity search.
1

Start PostgreSQL with pgvector

The easiest way is using Docker with the official pgvector image:
docker-compose.yml
services:
  postgres:
    image: pgvector/pgvector:pg16
    ports:
      - "5432:5432"
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: myapp_dev
    volumes:
      - postgres_data:/var/lib/postgresql/data

volumes:
  postgres_data:
Start the database:
docker compose up -d
2

Run migrations

The Arcana installer creates migrations for:
  • arcana_documents - Stores document metadata and content
  • arcana_chunks - Stores text chunks with embeddings
  • arcana_collections - Organizes documents into named collections
  • pgvector extension activation
Apply them:
mix ecto.migrate
3

(Optional) Install pgvector locally

For local PostgreSQL installations without Docker:
brew install pgvector
Then enable it in your database:
CREATE EXTENSION IF NOT EXISTS vector;

Supervision Tree Setup

Add Arcana components to your application’s supervision tree:
lib/my_app/application.ex
def start(_type, _args) do
  children = [
    MyApp.Repo,
    MyAppWeb.Endpoint,
    Arcana.TaskSupervisor,  # Required for dashboard async operations
    Arcana.Embedder.Local   # Only if using local Bumblebee embeddings
  ]

  opts = [strategy: :one_for_one, name: MyApp.Supervisor]
  Supervisor.start_link(children, opts)
end
  • Arcana.TaskSupervisor is required if you’re using the dashboard’s Ask or Maintenance features
  • Arcana.Embedder.Local is only needed when using local Bumblebee embeddings (the default)
  • For OpenAI or other cloud embeddings, you can skip Arcana.Embedder.Local

Nx Backend Configuration

For local embeddings, Arcana needs an Nx backend to run neural network models. Choose one based on your platform:

Embedding Provider Configuration

Arcana supports multiple embedding providers. Choose based on your needs:

Local Embeddings (Default)

Use Bumblebee for local embeddings - no API keys required:
config/config.exs
# Default - BGE Small (384 dimensions, 133MB)
config :arcana, embedder: :local

# Or specify a model
config :arcana, embedder: {:local, model: "BAAI/bge-base-en-v1.5"}
Local embeddings require an Nx backend (configured above).

Available Local Models

ModelDimensionsSizeUse Case
BAAI/bge-small-en-v1.5384133MBDefault, good balance
BAAI/bge-base-en-v1.5768438MBBetter accuracy
BAAI/bge-large-en-v1.510241.3GBBest accuracy
intfloat/e5-small-v2384133MBAlternative to BGE
intfloat/e5-base-v2768438MBE5 medium size
intfloat/e5-large-v210241.3GBE5 best accuracy
thenlper/gte-small38467MBSmallest, fastest
E5 models require special query:/passage: prefixes. Arcana handles this automatically.

OpenAI Embeddings

Use OpenAI’s embedding API:
config/config.exs
config :arcana, embedder: :openai

# Or specify a model
config :arcana, embedder: {:openai, model: "text-embedding-3-large"}
Set your API key:
export OPENAI_API_KEY="sk-..."
When using OpenAI embeddings, you don’t need an Nx backend or Arcana.Embedder.Local in your supervision tree.

Custom Embeddings

Implement the Arcana.Embedder behaviour for custom providers (Cohere, Voyage, etc.):
lib/my_app/cohere_embedder.ex
defmodule MyApp.CohereEmbedder do
  @behaviour Arcana.Embedder

  @impl true
  def embed(text, _opts) do
    # Call Cohere API
    case Req.post("https://api.cohere.ai/v1/embed", 
      json: %{texts: [text], model: "embed-english-v3.0"}) do
      {:ok, %{body: %{"embeddings" => [embedding]}}} ->
        {:ok, embedding}
      {:error, reason} ->
        {:error, reason}
    end
  end

  @impl true
  def dimensions(_opts), do: 1024
end
Configure it:
config/config.exs
config :arcana, embedder: MyApp.CohereEmbedder

Verify Installation

Test your installation in an IEx session:
iex -S mix

# Test ingestion
{:ok, doc} = Arcana.ingest("Elixir is a functional programming language.", repo: MyApp.Repo)

# Test search
{:ok, results} = Arcana.search("functional programming", repo: MyApp.Repo)

IO.inspect(results, label: "Search results")
You should see search results with similarity scores.

Optional: GraphRAG Setup

If you want to use GraphRAG features (entity extraction, knowledge graphs):
mix arcana.graph.install
mix ecto.migrate
This creates additional tables for entities, relationships, and communities. Enable GraphRAG during ingestion:
Arcana.ingest("Your content", repo: MyApp.Repo, graph: true)

Next Steps

Quickstart Tutorial

Build your first RAG application with a complete example

Configure Chunking

Learn how to optimize text chunking for your use case

LLM Integration

Connect Arcana to OpenAI, Anthropic, or custom LLMs

Dashboard Setup

Set up the LiveView dashboard for document management

Troubleshooting

If you see errors about the vector extension:
  1. Make sure you’re using the pgvector/pgvector Docker image, or
  2. Install pgvector on your local PostgreSQL installation
  3. Run CREATE EXTENSION IF NOT EXISTS vector; in your database
If EXLA fails to compile:
  1. Make sure you have build tools installed (gcc, make)
  2. On macOS: xcode-select --install
  3. On Ubuntu: sudo apt install build-essential
  4. Try Torchx as an alternative: {:torchx, "~> 0.9"}
First time using local embeddings downloads models from HuggingFace:
  • BGE Small: ~133MB
  • BGE Base: ~438MB
  • BGE Large: ~1.3GB
Subsequent runs use cached models. The download only happens once.
If you see errors about vector types not being recognized:
  1. Ensure you created the PostgrexTypes module
  2. Added it to your repo config: types: MyApp.PostgrexTypes
  3. Restarted your application after config changes

Build docs developers (and LLMs) love