Universal Admin GitHub

An admin for your Rails app's database

Point Universal Admin at the database your Rails app already uses. It reads Rails' conventions on its own, so your team sees names instead of ids from the first run. No gem, no routes, no code added to your app.

Open the Rails sample in your browserGet Universal Admin
A Rails store's page: its owner shown by name, and a tab of its products

Run it

New Rails apps keep their development database in storage/. Point the admin at it, or at your Postgres or MySQL database:

./universal-admin --db sqlite:./storage/development.sqlite3
./universal-admin --db postgres://localhost/myapp_development

What it reads from a Rails app

It seesIt does
user_id with no foreign key, and a users tableA link that shows the user's name, picked by typing it. The user's page gets a tab of the rows that point to it. (Rails apps often skip foreign keys; the name is enough.)
password_digest from has_secure_passwordHidden: never read, never written
created_at, updated_atFilled in on save, shown read-only
products_count from counter_cacheRead-only: your app keeps that count
schema_migrations, ar_internal_metadataHidden
commentable_type and commentable_id (polymorphic)Shown as plain values for now, not as a link

Rails enums stored as integers show as numbers until you name them, in one line of the config:

databases:
  development:
    tables:
      products:
        columns:
          status: {type: enum, options: [{value: 0, label: Draft}, {value: 1, label: Published}, {value: 2, label: Archived}]}

Every guess is only a default. When one is wrong, universal-admin init writes a config file from your database, one line per column, and a line in it changes the guess. Every setting is in the README.

Next to your app in production

With Kamal, add it as an accessory. Leave the password out of the database URL, so people log in with their own database accounts, and give it a key for their logins in .kamal/secrets:

accessories:
  admin:
    image: ghcr.io/technoprodev/universal-admin:latest
    host: 192.168.0.1
    port: "127.0.0.1:8080:8080"
    cmd: --db postgres://myapp-db/myapp_production
    env:
      secret:
        - UA_SESSION_SECRET

More ways to run it on a server, and how to put it behind HTTPS: Deploy.