> ## Documentation Index
> Fetch the complete documentation index at: https://docs.shardcloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Ruby Hosting Guide

> Learn how to deploy Ruby applications on ShardCloud platform.

# Getting Started with Ruby Hosting

Deploy your Ruby applications on ShardCloud with minimal configuration and maximum performance.

<Info>
  ShardCloud supports Ruby applications with automatic dependency management via Bundler.
</Info>

## Prerequisites

Before uploading your Ruby application, ensure you have the following project structure ready.

<CardGroup cols={2}>
  <Card title="Required Files" icon="circle">
    Essential files for deployment
  </Card>

  <Card title="Excluded Files" icon="x">
    Files to exclude before upload
  </Card>
</CardGroup>

## Required Files

Your Ruby application must include these essential files:

### 1. Entry Point File

* **File**: `app.rb` or `main.rb`
* **Purpose**: Main application entry point
* **Requirements**: Must contain your application's main execution code

### 2. Dependencies Configuration

* **File**: `Gemfile`
* **Purpose**: Defines Ruby gem dependencies
* **Requirements**: Valid Bundler format with all dependencies listed

### 3. ShardCloud Configuration

* **File**: `.shardcloud`
* **Purpose**: Platform-specific deployment settings
* **Requirements**: Plain text configuration file in root directory

<Warning>
  All three files are mandatory. Missing any of these files will prevent successful deployment.
</Warning>

## Files to Exclude

Remove these files/folders before creating your deployment archive:

* `vendor/bundle/`
* `.bundle/`
* `Gemfile.lock` (optional, can include for version locking)
* `tmp/`
* `log/`

## ShardCloud Configuration

The [.shardcloud](/config) file configures your application deployment settings.

### Configuration Example

```bash theme={null}
DISPLAY_NAME=myfirstrubyproject
DESCRIPTION=a simple Ruby application
MAIN=app.rb
MEMORY=512
VERSION=recommended
```

<Note>
  Choose memory based on your application's requirements. Web frameworks may need more memory.
</Note>

## Deployment Process

<Steps>
  <Step title="Prepare Application">
    Ensure all required files are present and configured
  </Step>

  <Step title="Verify Gemfile">
    Confirm all dependencies are listed in your Gemfile
  </Step>

  <Step title="Exclude Unnecessary Files">
    Remove `vendor/bundle/`, `.bundle/`, and cache folders
  </Step>

  <Step title="Create Archive">
    Zip or RAR your project
  </Step>

  <Step title="Upload via Dashboard">
    Use [ShardCloud dashboard](https://shardcloud.app/dash) to upload your archive
  </Step>

  <Step title="Deploy & Monitor">
    Application automatically installs gems and deploys
  </Step>
</Steps>

## Common Configuration Examples

### Rails Web Application

```bash theme={null}
DISPLAY_NAME=rails-app
DESCRIPTION=Web application with Ruby on Rails
MAIN=Gemfile
MEMORY=1024
VERSION=recommended
SUBDOMAIN=rails
CUSTOM_COMMAND=chmod +x bin/rails && bin/rails server -b 0.0.0.0
```

### Sinatra API

```bash theme={null}
DISPLAY_NAME=sinatra-api
DESCRIPTION=REST API with Sinatra
MAIN=app.rb
MEMORY=256
VERSION=LATEST
SUBDOMAIN=sinatra
```

### Sidekiq Background Worker

```bash theme={null}
DISPLAY_NAME=sidekiq-worker
DESCRIPTION=Background job processor
MAIN=worker.rb
MEMORY=512
VERSION=LATEST
```
