Authentication boilerplate in Laravel and React JS
In this article, I will share with you, a boilerplate for authentication created in Laravel 10 and React JS. User authentication is a module used in almost every project. Whether you are creating a blog website, or an E-commerce or a video streaming website, you need to have a page where user can create an account.
User authentication is also very crucial because it plays an important part in email marketing. You can get a gaint list of emails of your users, then you can use it to send emails for your new projects or updates etc.
This boilerplate will help you speed-up the development process by providing all the features you need for user authentication. So you don’t have to re-develop the user authentication module for each new project.
Screenshots
Features:
- User registration.
- Login with JWT (Json Web Token).
- Logout.
- Forgot password.
- User profile.
- Edit name and profile picture.
- Change password.
- Admin panel.
- Dynamic SMTP settings from admin panel.
- Add, edit, delete users from admin panel.
- Admin can enable or disable email verification feature.
These are all the features added so far in the authentication boilerplate developed in Laravel and React JS. I will keep adding more features. You can also give your own suggestions for new features or improvements.
Tech stack:
- PHP +8.2
- Laravel +10
- React +18
- Bootstrap +5
How to setup:
- Goto file “config/database.php” and set your database credentials.
'mysql' => [
...
'host' => '127.0.0.1',
'port' => '3306',
'database' => 'laravel_authentication',
'username' => 'root',
'password' => '',
...
],
Create a database named “laravel_authentication” in your phpMyAdmin.
- At root folder, run the following commands:
Note: You can write any name, email or password of your choice for super admin while running 5th command.
1) COMPOSER_MEMORY_LIMIT=-1 composer update
2) php artisan key:generate
3) php artisan storage:link
4) php artisan migrate
5) name="Admin" email="admin@adnan-tech.com" password="admin" php artisan db:seed --class=DatabaseSeeder
6) php artisan serve
You can access the project from: http://localhost:8000
If you face any issue in this, kindly let me know: support@adnan-tech.com
Conclusion
In this article, you have been introduced to source code for user authentication that will be used in almost website. You can download the source code for free and use it as many time as you want.