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

# Project Setup

> Follow the instructions bellow to setup the project locally

Follow these steps to install and run Mintlify on your operating system:

**Step 1**: Clone the repository

```bash theme={null}
git clone git@github.com:larastore-io/laravel-react-inertia.git
```

**Step 2**: Navigate to project's root directory and create `.env` file.

```bash theme={null}
cp .env.example .env
```

Open `.env` file and adjust environment variables.

Set application URL to be:

1. [http://localhost](http://localhost) or [http://larastore.test](http://larastore.test) (You will need to update `hosts` file) If you are setting the project up **with** docker.
2. [http://localhost:8000](http://localhost:8000) (Port might change if port 8000 is occupied) if you are setting the project up **without** docker.

<Tabs style={{padding: '2rem'}}>
  <Tab title="For Docker">
    ```bash theme={null}
    APP_URL=http://localhost
    ```
  </Tab>

  <Tab title="Without Docker">
    ```bash theme={null}
    APP_URL=http://localhost:8000
    ```
  </Tab>
</Tabs>

If you want to use MySql instead of sqlite, modify the `DB_*` variables.

```bash theme={null}
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=larastore
DB_USERNAME=sail
DB_PASSWORD=password
```

**Step 3**: Setup the Project

There are two options to setup the project:

1. Setup with docker (using laravel sail)
2. Or setup manually

<Tabs>
  <Tab title="Setup with Docker">
    <Tip>
      You don't need to have `php`, `composer` or `npm` commands available in your machine. You only need docker.
    </Tip>

    This command will install composer packages using docker and you should see `vendor` folder appearing in your file system.

    ```bash theme={null}
    docker run --rm \
        -u "$(id -u):$(id -g)" \
        -v "$(pwd):/var/www/html" \
        -w /var/www/html \
        laravelsail/php84-composer:latest \
        composer install --ignore-platform-reqs
    ```

    **Start the project**

    The following command will start necessary docker containers and start the project at [http://localhost](http://localhost) port 80. `-d` flag will run the containers in detached mode.

    ```bash theme={null}
    ./vendor/bin/sail up -d
    ```

    **Stop the project**

    If you started the project without `-d` flag you can simply hit `ctrl + c` (`cmd + c` on Mac) to stop running containers. However if you started the project with `-d` you need to execute the following commands to stop running containers.

    ```bash theme={null}
    ./vendor/bin/sail stop
    ```

    If you want to drop all containers, execute

    ```bash theme={null}
    ./vendor/bin/sail down
    ```

    **Running terminal commands**

    Whenever you need to execute terminal commands (such as artisan commands) you need to execute them from inside docker container.

    The command bellow will get you inside the docker container.

    <Warning>Before executing the command bellow make sure docker containers are up and running (By command `./vendor/bin/sail up`</Warning>

    If you started docker containers without `-d` you probably need to open a new terminal and execute the following command there.

    ```bash theme={null}
    ./vendor/bin/sail bash
    ```

    **Install npm dependencies**

    ```bash theme={null}
    npm install
    ```

    **Start Vite Server**

    ```bash theme={null}
    npm run dev
    ```
  </Tab>

  <Tab title="Manual Setup">
    <Info>Make sure you have `php`, `composer` and `npm` commands available in your terminal</Info>

    **Install Dependencies**

    ```bash theme={null}
    composer install && npm install
    ```

    **Start the application**

    ```bash theme={null}
    composer run dev
    ```
  </Tab>
</Tabs>

***

<Note>
  If you are setting up the project with docker you need to execute every command from inside the container.
</Note>

**Step 4:** Generate application key

```bash theme={null}
php artisan key:generate
```

**Step 5:** Create storage link

```bash theme={null}
php artisan storage:link
```

**Step 6:** Run Migrations

```bash theme={null}
php artisan migrate --seed
```

**Application URL**

Now you can access the application in your browser

1. [http://localhost](http://localhost) or [http://larastore.test](http://larastore.test) If you set up the project **with** docker.
2. [http://localhost:8000](http://localhost:8000) (Port might be different if port 8000 was occupied) if you are set up the project **without** docker.
