Quickstart
Check your first flag from Elixir in under a minute.
1. Get your server key
In the dashboard, open Settings → API keys and copy the server key:
ck_srv_prod_1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6dKeep it in an environment variable. Never put it in code that ships to a client — the SDK requires a server key and refuses the publishable ck_client_… key at boot. The key also picks the environment: production key, production rules.
2. Install
# mix.exs
def deps do
[{:lucerna, "~> 0.0.1-alpha.0"}]
endElixir 1.18+, two runtime dependencies by design: finch for HTTP, telemetry for instrumentation.
3. Add one child to your supervision tree
# lib/my_app/application.ex
children = [
{Lucerna, server_key: System.fetch_env!("LUCERNA_SERVER_KEY")}
]That's the whole integration — the instance downloads your rules at boot and keeps them fresh in the background. There is no process on the hot path: every check is an ETS lookup plus a pure evaluation.
4. Use it
Say who the user is, then check gates anywhere:
# one identity per request — who is this check for?
identity = Lucerna.Identity.new!(
user_id: "u_42",
email: "sofia@acme.com",
traits: %{plan: "pro"}
)
# Feature flag → true / false
if Lucerna.Gates.flag("new_billing", identity) do
# show the new billing page
end
# Kill switch → false means the path is killed
unless Lucerna.Gates.switch("payments") do
# payments are paused
end
# Experiment → variant name, or nil if the user isn't in it
variant = Lucerna.Gates.experiment("checkout_test", identity)
# Send the user to People (powers targeting and audiences)
Lucerna.identify(identity)Checks are instant — no network call — and they never raise. Changes you make in the dashboard reach the SDK within 10 seconds.
5. On shutdown
Nothing to do: on a clean stop the supervisor drains pending events before the HTTP pool goes down.
That's it. Next: the Elixir SDK reference, or the Phoenix guide for the identity-plug and LiveView patterns.