Installation
View SourceThis guide walks you through setting up LotusWeb in your Phoenix application.
Requirements
- Elixir 1.16 or later
- Phoenix 1.7 or later
- Lotus configured in your application
Step 1: Add Dependency
Add lotus_web to your dependencies in mix.exs:
def deps do
[
{:lotus_web, "~> 0.2.0"}
]
endRun mix deps.get to fetch the dependency.
Step 2: Configure Lotus (if not already done)
LotusWeb requires Lotus to be configured. Add to your config/config.exs:
config :lotus,
ecto_repo: MyApp.Repo,
default_repo: "main", # Default repository for query execution
data_repos: %{
"main" => MyApp.Repo,
"analytics" => MyApp.AnalyticsRepo # Optional: multiple databases
}Step 3: Run Lotus Migration (if not already done)
mix ecto.gen.migration create_lotus_tables
Add the migration content:
defmodule MyApp.Repo.Migrations.CreateLotusTables do
use Ecto.Migration
def up do
Lotus.Migrations.up()
end
def down do
Lotus.Migrations.down()
end
endRun the migration:
mix ecto.migrate
Step 4: Mount LotusWeb Dashboard
Add to your router:
defmodule MyAppWeb.Router do
use MyAppWeb, :router
import Lotus.Web.Router
# ... other routes
scope "/", MyAppWeb do
pipe_through [:browser, :require_authenticated_user] # ⚠️ Add auth!
lotus_dashboard "/lotus"
end
end⚠️ Security Warning: Always mount behind authentication in production.
Step 5: Visit the Dashboard
Start your Phoenix server and visit /lotus to access the dashboard.
Next Steps
Continue with the Getting Started guide to learn how to use LotusWeb.