Mooncore (mooncore v0.2.5)

Copy Markdown

Mooncore — A lightweight, action-based api framework for Elixir.

Mooncore is a Phoenix alternative built around the action pattern: every feature is an action (a named operation mapped to a module function), and actions are transport-agnostic — the same action works via HTTP, WebSocket, local Elixir call, or any other protocol.

Configuration

config :mooncore,
  port: 4000,
  router: MyApp.Router,
  app_module: MyApp.App,
  jwt: [key: "...", issuer: "myapp"],
  pools: [:default],
  mooncore_dev_tools: true,   # also requires MOONCORE_DEV_SECRET env var
  dev_tools_allowed_ips: ["127.0.0.1", "10.0.0.0/8"],
  oauth_redirect_uris: [],    # extra OAuth redirect URI allowlist (localhost/https always allowed)
  before_action: [],
  after_action: []

Summary

Functions

Get a mooncore config value.

Get a nested mooncore config value.

Get allowed dev tool IPs.

Get JWT config.

Check if mooncore_dev_tools is fully enabled.

Functions

config(key, default \\ nil)

Get a mooncore config value.

config(key, subkey, default)

Get a nested mooncore config value.

dev_tools_allowed_ips()

Get allowed dev tool IPs.

Returns the list from config :mooncore, dev_tools_allowed_ips. If not configured, all IPs are allowed (returns nil — used as "allow all" sentinel).

Supports plain IPs ("127.0.0.1", "::1") and CIDR ranges ("192.168.1.0/24", "10.0.0.0/8").

jwt(arg1)

Get JWT config.

mooncore_dev_tools_enabled?()

Check if mooncore_dev_tools is fully enabled.

Requires BOTH:

  • config :mooncore, mooncore_dev_tools: true
  • MOONCORE_DEV_SECRET environment variable set to a non-empty value

This prevents accidental exposure of dev tools on servers where the config flag is present but no secret is configured.