> ## Documentation Index
> Fetch the complete documentation index at: https://magic-book.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Manual setup

> Set up MagicBook from the command line when the web installer cannot be used, with the .env values it needs.

Use the [web installer](https://magic-book.mintlify.site/installation/web-installer.md) whenever you can. It creates the admin account, stores the license and runs the seeders for you. Use this page only when the installer cannot write its files, or when you prefer the command line.

> [!WARNING]
>
> Never run `php artisan migrate:fresh`, `migrate:refresh`, `migrate:reset` or `db:wipe` on a database that holds data. They delete every table. Run `php artisan migrate` to apply new migrations.

## Steps

**1. Upload the files**

Upload the application to the folder your domain points to. Include hidden files such as `.env.example` and `.htaccess`.

**2. Install the PHP dependencies**

From the project folder, run:

```bash theme={null}
composer install --no-dev --optimize-autoloader
```

**3. Create the .env file**

Copy `.env.example` to `.env`, then set at least these values:

```dotenv theme={null}
APP_NAME=MagicBook
APP_ENV=production
APP_DEBUG=false
APP_URL=https://your-domain.example
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database
DB_USERNAME=your_user
DB_PASSWORD=your_password
```

Keep `APP_DEBUG=false` on a live site. Debug pages can show database details to visitors.

**4. Generate the application key**

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

**5. Create the tables and seed the defaults**

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

The seeders add the roles, the payment gateway list, the default text and image models, the art styles and the finance settings.

**6. Create the first admin**

The web installer creates the admin account. Without it, create a user and give that user the `admin` role, for example in `php artisan tinker` with `$user->assignRole('admin')`. The `admin` role exists after the seeders have run.

**7. Activate the license**

Sign in as the admin and open **Platform → Activation**. Enter the license key and the Envato username, then click **Activate License**. See [License activation](https://magic-book.mintlify.site/license/activation.md).

**8. Add the cron job**

Add the cron line from [Cron and queue](https://magic-book.mintlify.site/installation/cron-and-queue.md).

## Permissions

The web server user must be able to write to `storage/` and `bootstrap/cache/`, and to `public/uploads/` for logos and media. Everything else can stay read-only.

## Next

Continue with the [post-install checklist](https://magic-book.mintlify.site/installation/post-install-checklist.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.