Add Uchi to your application

After having installed the gem to your application (See installation instructions) you are ready to configure Uchi.

Or ask your LLM to do it

Follow instructions from https://docs.uchiadmin.com/configuration/ to add a Uchi admin backend. Generate repositories for all existing models. Reuse existing authentication to lock down the controllers.

1

Mount Uchi in your application

Add to config/routes.rb:

  Uchi.routes.mount(self)
2

Add a repository for one of your models

Assuming you have a Customer model with an id and a name attribute, add the following in app/uchi/repositories/customer.rb:

module Uchi
  module Repositories
    class Customer < Repository
      def fields
        [
          Field::Number.new(:id),
          Field::Text.new(:name),
        ]
      end
    end
  end
end

You can learn more about Uchi Repositories in the Repositories documentation.

3

Create a controller to handle requests

In app/controllers/uchi/customers_controller.rb:

module Uchi
  class CustomersController < Uchi::RepositoryController
  end
end

Now start your Rails server and visit http://localhost:3000/uchi/customers. Welcome to Uchi 😁