New Laravel app with a head start from CLI

Sometimes, we want to quickly try out a new product idea. But where to start? 🤔

Just open your terminal, copy-paste the following commands, and you’ll get a basic Laravel app in 5 minutes. Additionally, it’ll have some basic things ready like login, registration, user profile, user listing, etc. Ready to build anything upon this base.

Now, it’s your time to focus on your very own idea. 🚀

Before you start

Before jumping on the command list, please have a look at the following points to avoid confusion later:

  • I am assuming you have docker and docker-compose ready to run Laravel with Sail. If not, please take a few minutes to set it up.
  • Choose sail services based on your requirements. But yes, you can add more services later.
  • I am using Larastarters for scaffolding basic things. More on it later.
  • To select the right theme for you, you should have a look at the supported Larastarters themes before running the commands.

Okay, so what is Larastarters?

It’s a Laravel Starter Kit by the Laravel Daily team.

Laravel already offers some first-party Starter Kits. Then why another starter kit here?

— Your curious mind

I’ve chosen this starter kit because it offers an option to choose from a handful of Tailwind and Bootstrap themes for scaffolding. Currently, it supports 3 Tailwind themes and 6 popular Bootstrap admin themes to choose from.

Not only the theme selection, but it also comes with some ready-made features like Profile management, a User listing page, Two-level sidebar menu, etc.

The sequence of commands to start a laravel app (with sail)

Run the following commands one by one and respond to the prompts carefully.

curl -s "https://laravel.build/ProjectName?with=mysql,mailpit" | bash
cd ProjectName

# Setting application port to 8009. Feel free to ignore or use another port
sed -i '1s/^/APP_PORT=8009 3\n/' .env
# If you're on MacOS, run the following instead
# sed -i '' '1s/^/APP_PORT=8009 3\n/' .env

./vendor/bin/sail up -d
./vendor/bin/sail composer require laraveldaily/larastarters --dev
./vendor/bin/sail artisan larastarters:install
./vendor/bin/sail artisan migrate

Done! Your app is running…


See your brand new project running at http://localhost:8009 (or your choice of port).

The login screen at this step (with Notus JS theme).

Add the first user

To log in to the new application, you’ll need a user. You can use tinker to quickly add a new user in Laravel.

Remember to change the name, email and password in the second line.

./vendor/bin/sail artisan tinker
DB::table('users')->insert(['name'=>'admin','email'=>'admin@example.com','password'=> Hash::make('123123')])
exit

Final thoughts

For any new idea, starting immediately, releasing in short cycles, and getting feedback early can be an effective way. This approach allows for quick iterations, faster improvements, and avoids wasting efforts.

And starting in no time is helpful to overcome the mental barrier of taking the first step. Go, start the journey, now!

Make something awesome!

Leave a Comment

Your email address will not be published. Required fields are marked *