Back to blog

P2 | Installation of Craftable PRO

Jun 28, 2024
.
Samuel Trstenský

Hello everyone, Samuel here from the Craftable PRO team. Welcome to Part 2 of our series on building a Laravel admin panel with Craftable PRO! In the previous part, I gave you a demo of what Craftable PRO can achieve, showing you how quickly and easily you can create an admin panel. Now, let’s get hands-on.

In this part, I’ll walk you through the initial setup for creating an empty admin panel, which will serve as the foundation for the rest of our series. This process involves creating a fresh Laravel project, setting up your environment, and installing Craftable PRO to access the essential features. By the end, you’ll have a fully functional, though empty, admin panel accessible at localhost/admin. Let’s dive in!

Step 1: Creating a Fresh Laravel Project

First, we need to create a new Laravel project. Open your terminal and type the following command to initiate an empty Laravel project:

composer create-project laravel/laravel training-backend-app

Laravel 11, by default, uses SQLite as its database driver. However, Craftable PRO works best with PostgreSQL or MySQL, so I recommend setting up one of these databases. If you don’t already have a local setup for PostgreSQL or MySQL, Laravel Sail, a tool built on Docker, simplifies this process.

Step 2: Setting Up PostgreSQL with Laravel Sail

To use PostgreSQL, I’ll use Laravel Sail. Start by running this command to install Sail:

php artisan sail:install

When prompted, select PostgreSQL as your database engine. Once configured, start Sail with:

sail up -d

If you’re using an older version of Laravel or Sail, you may need to update the .env file to set your database configuration manually.

Step 3: Accessing the Project

With the Laravel project set up, you can now access it at localhost. Currently, the project is empty, but it’s ready to be configured with Craftable PRO.

Step 4: Installing Craftable PRO

To use Craftable PRO, you’ll need a license. If you haven’t obtained your license yet, take a moment to do so. Once ready, we can continue with the installation.

Adding the Craftable PRO Repository

In the terminal, add the Craftable PRO private repository by running:

composer config repositories.craftable-pro composer https://packages.craftable.pro/

Next, install the Craftable PRO package:

composer require brackets/craftable-pro

When prompted, enter your email and license key.

Step 5: Finalizing the Installation

To complete the setup, install the core components with the following command:

sail php artisan craftable-pro:install

This command publishes necessary assets, database migrations, and core modules, and it also creates an Administrator account with a default password—be sure to save this information for later use.

Step 6: Setting Up Frontend Packages

With the backend ready, let’s set up the frontend. Run the following command in the terminal to install the necessary frontend packages:

npm install

Then, build the assets using:

npm run craftable-pro:build

For hot module replacement during development, you can use:

npm run craftable-pro:dev

Step 7: Accessing Your Admin Panel

Now, open your browser and visit localhost/admin. Use the Administrator login credentials saved from the installation, and you’ll see your empty admin panel ready for customization.

In the next video, I’ll introduce the core features of Craftable PRO already included in our newly created admin panel. With our setup complete, we’re ready to start building out features!