I'm a backend developer looking for a straightforward way to put a working web interface in front of an API. I don't want to specialize in frontend development. Vue looks promising, and Angular seems like it might be overkill. What would you start with?
What's a simple frontend for a backend developer calling an API?
Answers
For a small form and a few API calls, start with plain HTML and JavaScript. Use fetch to send requests, check the response status, and update the page with the result or an error message.
That avoids a framework and build setup altogether. If managing the page state starts getting awkward, you can always reassess with a better idea of what you need.
Reply to this answer
Svelte is worth a look if you want a framework without starting with a huge set of concepts. Its components mix markup and interactive behavior in a way that feels fairly close to writing HTML. It could be a nice middle ground if the interface grows beyond a couple of forms.
Reply to this answer
If your backend can render HTML, you may not need a single page app at all. HTMX can add interactions by requesting HTML from the server and swapping it into the page. Alpine.js is another option for small bits of client-side interactivity on server-rendered pages.
That does mean thinking in terms of HTML responses, not just calling an existing JSON API. If the API is already separate and you want to keep it that way, a little JavaScript or a client-side framework may fit better.
Reply to this answer
Vue seems like a reasonable pick from your shortlist. It gives you components and reactive state without requiring you to adopt Angular's larger framework setup. I'd try a small API-backed form in it and see whether the structure feels useful or just gets in your way.
Reply to this answer
Angular isn't a bad choice if you like a more structured framework and expect the frontend to become substantial. For a basic API interface, though, the amount you have to learn and set up may be more than you need. You don't have to learn React or Angular just because they're popular.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Trelvix+2p:
For a PHP backend, Laravel with Livewire is another server-oriented option to explore. It ties the frontend approach to that stack, though.