What’s the simplest frontend approach for calling a web API?
Asked by
fLight_pattern
I've been working as a backend developer for about 20 years, mostly building desktop applications and maintaining systems that grew organically rather than following modern best practices. I've used bits and pieces of many technologies, but I've deliberately avoided single-page applications and JavaScript frameworks. I also tend to prefer compiled applications, so the JavaScript ecosystem hasn't been especially appealing to me.
I'm now trying to learn more modern, best-practice approaches to building web application backends. I need a practical frontend that can call my web API and provide a functioning interface, but I'm not trying to become a frontend specialist. I mainly want the simplest, quickest way to build something adequate and maintainable.
Angular seems like it might fit my way of thinking, but it also looks like significant overkill. Vue seems more approachable, and I've also heard good things about Svelte, Alpine.js, and server-rendered approaches such as HTMX. Would vanilla HTML, CSS, and JavaScript with fetch be enough, or should I invest the time in learning React, Vue, or Angular? Which option would you recommend for this use case?
Answers
A server-rendered approach may suit you better than a SPA. Technologies such as HTMX, optionally combined with a lightweight tool like Alpine.js, let the server render most of the page while adding dynamic behavior where needed. This keeps the frontend small and lets you stay focused on backend code. If you’re using PHP, Livewire is another option that reduces the amount of JavaScript you need to write.
Reply to this answer
If the goal is simply a working client for your API, start with vanilla JavaScript and only introduce a framework once the interface becomes difficult to manage. That lets you learn the browser basics without committing to React, Angular, or another large ecosystem. If you later need components, routing, or more involved state management, Vue or Svelte would be reasonable next steps.
Reply to this answer
Svelte is worth considering if you want a framework with relatively simple syntax. It feels close to writing normal HTML while still giving you components and reactive updates, so you can get a basic API-driven application running quickly. Astro is also useful, but it may be unnecessary unless you’re primarily building a content-focused site.
Reply to this answer
You may not need a framework at all. For a straightforward interface, regular HTML and CSS plus a small amount of JavaScript using fetch can call the API and update the page. Adding a full SPA framework just to submit forms and display responses can be more complexity than it’s worth.
Reply to this answer
Vue is probably the safest framework choice for this situation. It’s approachable for someone coming from the backend, and its official tools for routing and state management give you a clear path if the application grows. React has a larger ecosystem, but its flexibility often means making more architectural decisions yourself. Angular is powerful and structured, but likely excessive for a small frontend.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions