Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

CODE-AXION's avatar

Is it possible to create website powered by Laravel API , without using any frontend framework like vue js ?

My boss is telling me to create a website powered by API but without any SPA Framework , and i don't think so that's possible because I have not seen anywhere people using these. I heavily researched on Google and youtube and didn't find proper solution , I am wondering how we will handle the authentication and authorization like I am very confused how is it possible won't be there security loop holes and I think it will also be difficult to manage

0 likes
6 replies
LaryAI's avatar
Level 58

Yes, it is possible to create a website powered by Laravel API without using any frontend framework like Vue.js. You can use traditional server-side rendering techniques to render the HTML on the server and send it to the client. You can use Laravel's built-in Blade templating engine to create the views and use Laravel's routing system to handle the requests.

For authentication and authorization, you can use Laravel's built-in authentication system or implement your own custom authentication system using Laravel's middleware. You can also use Laravel's built-in CSRF protection to prevent cross-site request forgery attacks.

Here's an example of how you can create a simple website powered by Laravel API without using any frontend framework:

// routes/web.php

Route::get('/', function () {
    return view('welcome');
});

Route::get('/posts', function () {
    $posts = App\Models\Post::all();
    return view('posts', ['posts' => $posts]);
});

// views/welcome.blade.php

<!DOCTYPE html>
<html>
    <head>
        <title>Welcome</title>
    </head>
    <body>
        <h1>Welcome to my website</h1>
        <p>Click <a href="/posts">here</a> to view all posts</p>
    </body>
</html>

// views/posts.blade.php

<!DOCTYPE html>
<html>
    <head>
        <title>Posts</title>
    </head>
    <body>
        <h1>All Posts</h1>
        <ul>
            @foreach ($posts as $post)
                <li>{{ $post->title }}</li>
            @endforeach
        </ul>
    </body>
</html>

In this example, we have two routes: one for the homepage and one for the posts page. The homepage simply displays a welcome message and a link to the posts page. The posts page retrieves all the posts from the database and displays them in a list.

Note that this is just a simple example and you can create more complex websites using this approach. However, keep in mind that using a frontend framework like Vue.js can make your website more interactive and responsive.

Snapey's avatar

you need to ask your boss what is driving this requirement? What is the real reason they want no frontend tooling?

Are they just wanting a clean api so that they can give front end dev to someone else? or maybe show the content on other types of devices?

CODE-AXION's avatar

@Snapey yes he wants the API to be Centralized so that it can be used both in mobile and web so whenever the client want changes if we add a new feature it can be added both in mobile and web platforms, but as I said the problem is how I am gonna build a website fully Powered by API without using any SPA Framework , I am the only developer here who do both frontend and backend and I tried to explain him that this approach does not make any sense but he just don't listen idk what should I do !

Snapey's avatar

@CODE-AXION Its not impossible. Its just a lot more work. You can use the fetch API to get and update content in the browser but you will need to write your own router and manage page history state etc etc

CODE-AXION's avatar

@Snapey we are not building SPA here , the website will be multi page which will be powered by API , that's the actual thing of what I am confused like seriously I have not seen anyone building a website like this how I am gonna manage authentication, authorization, Middlewares its alot tough to manage , the code will be horrible and difficult to manage.

Please or to participate in this conversation.