> For the complete documentation index, see [llms.txt](https://docs.adminly.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.adminly.com/self-hosting/ruby-on-rails.md). Agents can also search and read this documentation through its [MCP server](https://docs.adminly.com/~gitbook/mcp).

# Ruby on Rails

Integrate Adminly into an existing Ruby on Rails web application.

{% hint style="info" %}
**Tip:** This guide will show you how to quickly get setup with Adminly for anyone that is interested in self-hosting with an existing **Ruby on Rails** application.
{% endhint %}

## Requirements

Integrating Adminly into an existing application is currently supported for **Ruby on Rails 6+** web applications using the **adminly** gem. If your existing application does not run on Ruby on Rails, you can still elect to self-host by running adminly as a stand-alone server instance. See our guide to [Self-Hosting](https://docs.adminly.com/self-hosting/self-hosting.md) to learn how to easily deploy an Adminly REST server.&#x20;

**Self-Hosting Requirements**

* Ruby on Rails 6.0 or above
* Ruby 2.7.3 or above
* Relational database:
  * PostgreSQL
  * MySQL
  * SQLite

{% hint style="info" %}
**Note:** adminly gem is a Ruby on Rails engine, which means it can be mounted on existing applications to extend functionality by exposing new routes, controllers and models, among others. Adminly does not run any database migrations and your database schema will not be altered by integrating with the adminly gem.&#x20;
{% endhint %}

## Installation&#x20;

Begin by installing the `adminly` gem. Add this line to your `Gemfile`

{% tabs %}
{% tab title="Ruby" %}

```ruby
gem 'adminly'
```

{% endtab %}
{% endtabs %}

Install the gem using bundler:

```
$ bundle install
```

Mount the API routes by updating your `config/routes.rb` file:

{% tabs %}
{% tab title="Ruby" %}

```
mount Adminly::Engine, at: "/adminly"
```

{% endtab %}
{% endtabs %}

Now the Adminly API routes will be available at your server path `/adminly`.&#x20;

{% hint style="info" %}
You can select any endpoint but for purposes of this documentation we will assume you are using the /adminly endpoint path.
{% endhint %}

## Make your first request

To ensure your API is setup and working, point your browser or query the base endpoint. You should see a response that includes the current version of Adminly.

## View Adminly status and version.

<mark style="color:blue;">`GET`</mark> `https://api.myapi.com/adminly/v1`

Renders the version of adminly running.&#x20;

{% tabs %}
{% tab title="200 Pet successfully created" %}

```javascript
{
    "name"="Wilson",
    "owner": {
        "id": "sha7891bikojbkreuy",
        "name": "Samuel Passet",
    "species": "Dog",}
    "breed": "Golden Retriever",
}
```

{% endtab %}

{% tab title="401 Permission denied" %}

{% endtab %}
{% endtabs %}

Take a look at how you might call this method using our official libraries, or via `curl`:

{% tabs %}
{% tab title="ruby" %}

```ruby
Adminly.tap |config|
  config.jwt_secret = 'my_jwt_secret_token'
end
```

{% endtab %}
{% endtabs %}

## Add your API to Adminly

Once your API is installed, copy your `jwt_secret` and `adminly API endpoint` as you will use these to configure Adminly online.&#x20;

**Start a new project**

1. Start a new project in Adminly by selecting New Project from the dashboard.&#x20;
2. Select "Self-host: existing" when choosing which hosting option.
3. Enter the name of the project, then enter the `JWT_SECRET` and the Adminly API endpoint of your hosted server.&#x20;

Continue through the setup wizard to complete the onboarding process. You should now be able to explore your Adminly data online.&#x20;
