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

# Multi-Store Setup

## Root domain

You need to set a wildcard `root_domain` on the store to enable multi-store setup

```ruby theme={"theme":"night-owl"}
Spree.root_domain = ENV.fetch('SPREE_ROOT_DOMAIN', 'lvh.me')
```

This will be used to generate the store URLs, eg. `store1.lvh.me`, `store2.lvh.me`, etc.

`store1` part is the unique store `code` identifier, which is auto-generated based on the store name. You can change it in the admin panel in **Settings -> Domains**.

<Info>
  If you later change the `root_domain`, you will need to run:

  ```ruby theme={"theme":"night-owl"}
  Spree::Store.all.each(&:save)
  ```

  to update the store URLs.
</Info>

## Creating new stores

After you restart your application, you will see a new option in the admin panel, under new item menu:

<img src="https://mintcdn.com/spreecommerce/DZtREQtmJNhQ5ub_/images/new_store_dropdown.png?fit=max&auto=format&n=DZtREQtmJNhQ5ub_&q=85&s=311a864a08e920d95eaa11a75fa888f3" alt="" width="770" height="560" data-path="images/new_store_dropdown.png" />

You can also create a new store from the rails console:

```ruby theme={"theme":"night-owl"}
Spree::Store.create!(name: 'New Store')
```

This will create a new store with the given name, code and URL.
