Laravel 11 - Genesis Starter Kit
Laravel 11 - Genesis Starter Kit
In this tutorial, we will discuss how to integrate the Genesis Starter Kit in Laravel 11 and guide you through the steps to get started with this essential development tool.
If you're a video person, feel free to skip the post and check out the video instead!
Quick Overview
This guide walks you through setting up a fresh Laravel project with the Genesis Starter Kit, which provides ready-to-use authentication and UI components. You'll begin by creating a new Laravel project using either the global Laravel installer or Composer, configuring it with Pest for testing and MySQL as the database, without default migrations. Once your project is set up, you'll install the Genesis Starter Kit, which adds authentication scaffolding, views, and controllers. After publishing the Genesis assets, you'll install the necessary front-end dependencies and start the Vite server to compile your assets in real-time. With the database migration complete, you'll run the Laravel development server and test your application by accessing the registration, login, and other authentication pages. This setup provides a solid foundation for developing Laravel applications with minimal setup.
Step # 1 : Create fresh Laravel project.
If Laravel is installed Globally you can use the following command.
laravel new genesis
Or
If Laravel is not installed globally you can use the Composer command.
composer create-project laravel/laravel --prefer-dist genesis
After running the command, you'll be prompted with a few options.
- For the starter kit installation, choose none.
- Select Pest as the testing framework.
- Choose mysql for the database.
- When asked about running the default database migration, select no.
Now you have a fresh Laravel project set up with Pest for testing, MySQL as your database, and no default migrations, providing you with a clean slate for building your application. By choosing Pest as the testing framework, you've set yourself up with a modern, easy-to-use tool that simplifies writing and running tests, ensuring your application's functionality remains reliable. MySQL, selected as the database, is a widely-used, robust relational database that will handle your data storage needs efficiently. The absence of default migrations means that you have complete control over your database structure and can implement custom migrations that align with your project's unique requirements, without the constraints of Laravel’s default setup. This configuration leaves you with a highly flexible starting point for your Laravel development, allowing you to customize your environment and build the features you need without unnecessary boilerplate.
Step # 2 : Access the project.
Now that you have your fresh Laravel project set up, open a terminal (such as Git Bash) and navigate to the root directory of your project by running the following command.
cd c:xampp/htdocs/genesis
This step is important because any subsequent commands you run will need to be executed in the context of your project directory. This is where Laravel’s files and dependencies reside, so make sure you're in the correct directory before proceeding to the next steps
Step # 3 : Install Genesis package.
With your Laravel project ready, it's now time to integrate the Genesis Starter Kit. The Genesis package is a powerful starter kit that provides pre-built authentication features, a beautiful UI, and other useful tools to accelerate your Laravel development.
To install the Genesis package, run the following command in your terminal.
composer require devdojo/genesis dev-main
This command will download and install the Genesis Starter Kit into your Laravel project. Once installed, you’ll need to publish the Genesis assets using the following command.
php artisan ui genesis
This command will set up the necessary views, controllers, and routes that the Genesis kit provides. It will also set up authentication scaffolding so that you can get started with user management right away.
After the assets have been published, you’ll need to install the required front-end dependencies and start the Vite server. Vite is a modern, fast build tool that will handle compiling your assets during development. To do this, run the following commands.
npm install && npm run dev
By running these commands, you’re setting up the front-end part of your Laravel project, allowing you to benefit from the Genesis UI and other assets. Keep the Vite server running as it watches for any changes in the front-end assets and compiles them on the fly.
It's important to note that while the Vite server is running, you will need to open a new terminal window or tab. In this new terminal, navigate to the same project directory to execute further Laravel commands.
Step # 4 : Migrate the database.
Run the database migration using the following command.
php artisan migrate
Type yes when prompted to create the database.
When you run this command, Laravel will execute the migration scripts that have been provided by the Genesis Starter Kit. These migrations will create the necessary database tables for things like user authentication and profile management
Step # 5 : It's time to test.
Start the Laravel development server by running.
php artisan serve
This will start the server, and you should see an output indicating that the server is running on a specific port, typically 127.0.0.1:8000. Now, you can access this URL in your browser to check and see the Genesis Starter Kit in action.
Now, you can access the authentication pages in your browser by navigating to the following URLs.
Register: /auth/register
Login: /auth/login
You should now see a beautifully styled registration and login page, ready for use. Additionally, the Genesis Starter Kit also provides routes for profile management, password reset, and more. You can explore these routes to start working with user profiles and other authentication features that Genesis provides.
Conclusion
By following this process, you've successfully set up a fresh Laravel project with the Genesis Starter Kit, providing a streamlined approach to building applications with built-in authentication and UI components. The integration of Pest for testing, MySQL as the database, and Vite for front-end asset management ensures a modern development workflow. With the Genesis Starter Kit installed and configured, you're ready to dive into building user authentication features, profile management, and more. This setup not only saves time by providing essential scaffolding out of the box but also offers flexibility to customize and extend as your project grows. Whether you're working on a small project or scaling up, this foundational setup provides a strong starting point for Laravel development. It also lays the groundwork for future enhancements, allowing you to seamlessly integrate new features as your application evolves.
For more details, please refer to the Genesis documentation.
Share this with friends!
To engage in commentary, kindly proceed by logging in or registering
Subscribe to Our Newsletter
Stay ahead of the curve! Join our newsletter to see what everyone’s talking about.
0 Comments