DEV Community

Saroj Pradhan
Saroj Pradhan

Posted on

3 1 1

What is Inertiajs? No API required to connect Backend and Frontend?

Inertia.js is an approach that allows you to build single-page applications (SPAs) using server-side rendering and traditional server-side routing. In other words, it allows you to build SPAs using just PHP (Laravel), Ruby (Rails), or any other server-side language, and client-side framework such as React, Vuejs without worrying about maintaining two different repository, two different domain to host backend and frontend separately.

Inertia has no client-side routing, nor does it require an API. Simply you can build controllers and page views in easier way.

One of the easiest methods to get started with React/Vue, Inertiajs and Laravel is by installing Laravel/breeze scaffolding:

  • Start a Laravel Project
composer create-project laravel/laravel laravel-inertia-react
Enter fullscreen mode Exit fullscreen mode
  • Install laravel/breeze in your laravel project.
composer require laravel/breeze --dev
Enter fullscreen mode Exit fullscreen mode
  • Then install the frontend scaffolding as per your desire
php artisan breeze:install vue

# Or...

php artisan breeze:install react

php artisan migrate
npm install
npm run dev
Enter fullscreen mode Exit fullscreen mode
  • Run server to view the Laravel/breeze default authentication scaffolding.
php artisan serve
Enter fullscreen mode Exit fullscreen mode

Note: Inertia is not appropriate for those who value SEO, even though inertia make life easier to integrate frontend and backend.

Useful links: Inertiajs, Laravel-breeze

If you liked this post please leave a reaction/comment.

Read More in BlazeCodes.com

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs