DEV Community

AL EMRAN
AL EMRAN

Posted on

Why we shifted from Node JS( Adonis JS & Nuxt JS) to Laravel for refactoring uihut.com

UIHUT is a platform that provides design and coding resources for developers, entrepreneurs, and designers. As the platform grows and evolves, we have decided to refactor our system using the Laravel Ecosystem. Laravel is a popular PHP framework that has gained a lot of popularity in recent years, and it provides a robust and reliable foundation for building web applications.
In this article, we will share the reasons why we chose to shift from Node JS (Adonis JS and Nuxt JS) to Laravel for refactoring UIHUT.

UIHUT

Here are main reasons:

  • Ready Authentication System
  • Almost Ready Social Login system
  • Ready Queue System with UI with Horizon
  • Awesome testing system for frontend and api with Dusk and Pestphp
  • Good Websocket Backend with Laravel Websocket and broadcast
  • Laravel Inertia JS is fantastic tool for SSR and hydration with - React JS or Vue JS
  • Awesome Laravel Eloquent Model
  • Nice Code formatter with Laravel Pint
  • Code Static Analysis with LaraStan
  • Fantastic Laravel Telescope for deeply debugging application
  • Laravel Debugbar

- Ready Authentication System

Laravel provides an out-of-the-box authentication system that can be easily set up with just a few commands. This system is secure, reliable, and follows best practices for password hashing and user authentication. With Laravel's built-in authentication scaffolding, we were able to quickly and easily set up user registration and login functionality for our application.

For example, if we wanted to create a simple registration form with fields for name, email, and password, we might have to write our own middleware to handle form validation and authentication in Node JS. However, with Laravel, we can simply generate the authentication scaffolding with the make:auth command, and Laravel will automatically generate the necessary views, controllers, and routes for us.

This not only saves us time and effort, but it also ensures that our authentication system is secure and reliable. Additionally, Laravel provides many customization options for the authentication system, so we can tailor it to fit our specific needs.

- Almost Ready Social Login system

Another factor that led us to choose Laravel for our refactoring project was its built-in social authentication features. Social login is becoming increasingly popular as it allows users to quickly and easily sign up or log in to a website using their existing social media accounts such as Facebook, Google, or Twitter.

Laravel Socialite supports many popular social networks, including Facebook, Twitter, Google, LinkedIn, and GitHub. With just a few lines of code, we were able to set up social authentication for our UIHUT application, saving us time and effort while providing a seamless user experience for our users.


*** You May like Ezytor:

ezytor.com

- Ready Queue System with UI with Horizon

One of the main reasons we chose Laravel for refactoring UIHUT is its ready-to-use queue system with a beautiful UI called Horizon.

In UIHUT, we have many background jobs that need to be processed efficiently without slowing down the main application. Laravel's queue system provides an elegant solution to this problem by allowing us to handle time-consuming tasks in the background, freeing up resources for other critical operations.

Using Laravel's queue system is very easy. We can define jobs as classes and dispatch them to be processed by a worker. Laravel comes with several ready-made queue drivers, including a database driver that allows us to store jobs in a database table.

What makes Laravel's queue system even more powerful is the inclusion of Horizon, a beautiful dashboard that provides real-time monitoring of queues and jobs. With Horizon, we can easily see what jobs are currently running, how long they take to complete, and how many jobs are waiting to be processed.

Overall, Laravel's queue system with Horizon gives us a powerful toolset to manage background jobs efficiently.

- Awesome testing system for frontend and api with Dusk and Pestphp:

Dusk is Laravel's official browser testing tool that allows us to simulate user interactions with our application's frontend. We can write expressive and readable tests using Laravel's fluent syntax and assertions to ensure that our frontend behaves as expected.

On the other hand, Pestphp is a modern and elegant testing framework that provides a developer-friendly syntax for writing tests for our application's API. Pestphp's syntax is clean and easy to read, making it accessible to developers of all levels of experience.

With Dusk and Pestphp, we were able to create a comprehensive testing suite that covered both our frontend and API, ensuring that our application was thoroughly tested and reliable.

- Good Websocket Backend with Laravel Websocket and broadcast

Laravel offers an excellent backend for real-time communication with its WebSockets (❤️🙏 beyondcode ) and broadcasting capabilities. With Laravel WebSockets, we can easily set up a WebSocket server and handle real-time events like user notifications, chat messages, and other updates. The broadcasting system provides a unified API to send events to different broadcasting drivers like Pusher, Redis, and even WebSocket server.

In our UIHUT project, we needed to have real-time updates on various pages, and Laravel's broadcasting and WebSocket capabilities allowed us to easily achieve this functionality. We were able to create a seamless user experience that keeps users engaged and informed with minimal latency.

Additionally, Laravel's WebSockets and broadcasting system come with built-in support for authentication and authorization, allowing us to secure WebSocket connections and broadcasting channels with ease. Overall, Laravel's WebSockets and broadcasting system offer a robust solution for real-time communication needs in web applications.

- Laravel Inertia JS is fantastic tool for SSR and hydration with - React JS or Vue JS

Laravel Inertia JS is another reason why we chose Laravel for refactoring UIHUT. Inertia is a fantastic tool that provides a seamless integration of server-side rendering (SSR) with client-side single-page applications (SPA) like React JS or Vue JS. It allows us to build modern web applications without having to compromise on the benefits of SSR.

With Inertia, we can write our frontend code using the familiar syntax of React or Vue, but still have the benefits of SSR for improved performance and SEO. Inertia also allows us to easily pass data between the frontend and backend, which is especially useful when working with complex user interfaces.

In addition, Inertia provides a great developer experience. It allows us to write frontend code in a modern framework like React or Vue, but still use Laravel's powerful backend features like Eloquent models, Blade templates, and route helpers.

Overall, Inertia JS is a fantastic tool that allows us to build modern, high-performing web applications while leveraging the strengths of both server-side and client-side rendering.

-Awesome Laravel Eloquent Model

Laravel's Eloquent Model is one of the main reasons why we chose Laravel for refactoring UIHUT. Eloquent is an ORM (Object-Relational Mapping) system that allows us to interact with the database using PHP objects instead of writing raw SQL queries.

With Eloquent, we can easily define our database tables as PHP classes, and then manipulate data by creating and modifying objects based on those classes. This makes it easier to read, write, and maintain database code, as well as reducing the risk of SQL injection attacks.

In addition, Eloquent provides a variety of helpful features, such as model relationships, query scopes, and eager loading. These features make it easier to work with complex data structures and improve the overall performance of the application.

flowgiri.com

-Nice Code formatter with Laravel Pint

Laravel Pint is a package that provides an easy and configurable way to format your PHP code according to the PSR-2 coding standard. This package integrates with Laravel's command-line interface, Artisan, allowing you to easily format your code using the command line.

Pint comes with sensible default settings, but you can also customize the formatting to fit your team's coding standards. This makes it a great tool for maintaining a consistent code style across your entire codebase.

Using Pint is as simple as running the php artisan pint:fix command in your terminal. This command will automatically format your PHP files according to the PSR-2 coding standard, making your code more readable and maintainable.

In addition to formatting your code, Pint can also check your code for compliance with the PSR-2 coding standard using the php artisan pint:check command. This can help you catch coding style issues early, before they become a problem in your production code.

Overall, Laravel Pint is a fantastic tool for maintaining a consistent and readable code style across your Laravel application.

-Code Static Analysis with LaraStan

Code static analysis is the process of evaluating the codebase for potential issues and vulnerabilities without actually executing the code. It is an important aspect of software development as it helps in identifying potential issues early on in the development process, allowing developers to fix them before they cause any major problems.

Laravel offers a fantastic tool for code static analysis called LaraStan. LaraStan is a static analysis tool that analyzes your Laravel codebase and provides insights into any issues or vulnerabilities that it finds. Some of the issues that LaraStan can detect include unused variables, undefined functions, and type mismatches.

One of the key advantages of LaraStan is that it integrates seamlessly with Laravel and can be easily integrated into your existing development workflow. You can run LaraStan as part of your CI/CD pipeline, ensuring that your codebase is analyzed and any issues are identified before your code is deployed.

Overall, the use of LaraStan can help improve the quality of your codebase and make it more robust and secure. By using a code static analysis tool like LaraStan, you can identify and fix issues early on in the development process, which can save time and money in the long run.

-Fantastic Laravel Telescope for deeply debugging application

Laravel Telescope is a powerful debugging tool that provides insight into the requests coming to the application, database queries, logs, and more. It is a convenient and elegant way to debug Laravel applications, allowing developers to track and debug errors in real-time. Telescope provides an easy-to-use dashboard that displays various statistics and data about the application, allowing developers to quickly identify and resolve any issues.

One of the most useful features of Laravel Telescope is its ability to display detailed information about each request. This includes the response time, status code, and any exceptions that were thrown during the request. This information is invaluable for debugging performance issues and identifying the root cause of any errors.

Telescope also provides a comprehensive view of all database queries that are executed by the application, including their duration, the number of rows affected, and the exact SQL statements that were executed. This allows developers to quickly identify slow or inefficient queries and optimize them for better performance.

In addition to its core functionality, Laravel Telescope is also highly customizable. Developers can easily create custom views and notifications to track specific application events and errors, making it a versatile tool that can be adapted to the unique needs of any project.

-Laravel Debugbar

Laravel Debugbar is a package that provides a simple way to debug Laravel applications. It adds a debug bar to the bottom of the application, displaying information about the current request and response, database queries, and other useful information.

The package provides a lot of features such as a timeline of the current request, displaying all the executed queries, including the time it took to execute them, detailed information about the current view, including all the variables passed to it, the number of database queries, the time it took to execute them, and much more.

Laravel Debugbar is incredibly useful when developing Laravel applications, as it provides an easy way to see what is happening under the hood. It allows developers to quickly identify and fix issues, saving time and effort. The package is easy to install and configure, and it works seamlessly with Laravel.
Overall, Laravel Debugbar is a great tool for any Laravel developer.

Top comments (3)

Collapse
 
envoy49 profile image
Envoy49

Meh, I was expecting to see why you moved away from AdonisJS and NuxtJs instead I was reading how awesome Laravel is.

Collapse
 
fininhors profile image
Francisco Junior

Now that you've commented on laravel, explain why you left the stack Nuxt + Adonis?

Collapse
 
arthurp93 profile image
Michael Marc-Arthur PIERRE

Good comment