What Is a Web Application? How It Works and Where to Host It

What a web application is, how it handles a request, SPAs and PWAs, and which hosting fits PHP, Node.js or Python apps, with tested examples.

Short answer: a web application is a program you use through a web browser. Part of it runs on a server, where it receives your request, reads or changes data in a database and builds a response. The other part runs in your browser as HTML, CSS and JavaScript. Unlike a plain website that shows the same page to everyone, a web app reacts to what you do: you log in, search, buy, upload or edit. Webmail, online shops, booking systems and control panels such as cPanel are all web applications. Where you host one depends mostly on the language its server part is written in.

Terminal showing the hello.php web application returning a JSON greeting for each request on PHP 8.3
The hello.php example from this post, served by PHP 8.3.35's built-in server: each request gets its own JSON answer.

Website or web application?

MDN’s client-server overview draws the line clearly. A static site returns the same hard-coded content every time a page is requested. A dynamic site generates its content based on the request URL and data. Web applications are dynamic, but the line is blurry in practice: a WordPress blog is a web application behind the scenes, even if most visitors only read it.

Static websiteWeb application
ContentThe same for every visitorBuilt for each request and user
Server workSends filesRuns code, talks to a database
Typical examplesBrochure site, portfolio, documentationShop, webmail, CRM, booking system, dashboard
Hosting needsAny web hostingA runtime for its language, usually a database
MaintenanceVery littleUpdates, backups, security patches

How a web application handles a request

  1. Your browser sends an HTTP request. MDN’s rule of thumb: a GET request fetches data, while a request that changes data, such as saving a form, should be a POST.
  2. The web server (Apache, nginx, LiteSpeed) passes the request to the application code.
  3. The application works out what the request is for, from the URL and any form data.
  4. It reads or writes the database.
  5. It builds the response, usually by filling an HTML template, or by returning JSON for JavaScript in the browser to use.
  6. The web server sends the response back with a status code, such as 200 for success.

Three common shapes of web app

  • Server-rendered. The server builds a full HTML page for every click. Most PHP applications, including WordPress, work this way.
  • Single-page application (SPA). MDN defines an SPA as a web app that loads a single document and then updates its content with JavaScript APIs such as Fetch. It can feel faster, but MDN lists trade-offs: SEO and more work to handle state, navigation and performance monitoring.
  • Progressive web app (PWA). According to MDN, a PWA is built with web technologies but feels like an installed app: it can be installed on the device and, through service workers, keep working with a poor connection. Service workers only run in secure contexts, so a PWA needs HTTPS (browsers make an exception for http://localhost during development).

A tiny web app, written two ways

The language decides how the app runs on the server, and that decides the hosting you need. Here is the same small app in PHP and in Node.js. Both return a greeting as JSON, using the name from the URL.

PHP: upload a file and it runs

<?php
// hello.php: builds its answer for each request
$name = $_GET['name'] ?? 'visitor';
header('Content-Type: application/json');
echo json_encode([
    'message' => 'Hello, ' . $name,
    'time'    => date('H:i:s'),
]);

Requesting hello.php?name=Asha under PHP 8.3 returned:

{"message":"Hello, Asha","time":"18:07:48"}

The host’s web server runs the PHP code for each request, so you do not have to keep a program of your own running. That is why PHP apps run happily on ordinary shared hosting.

Node.js: a program that keeps running

// app.js
const http = require('node:http');

const server = http.createServer((req, res) => {
  const url = new URL(req.url, 'http://localhost');
  const name = url.searchParams.get('name') || 'visitor';
  res.writeHead(200, { 'Content-Type': 'application/json' });
  res.end(JSON.stringify({ message: `Hello, ${name}` }));
});

server.listen(3000, '127.0.0.1');

This app is its own small web server. It must be started with node app.js and kept running, and it listens on port 3000 on the server itself. Visitors reach it through a web server acting as a reverse proxy, which also handles HTTPS. An nginx site for it looks like this:

server {
    listen 80;
    server_name app.example.com;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

We ran this with Node.js 24.21 behind nginx 1.31.6. A request to /?name=Asha through nginx came back HTTP/1.1 200 OK with {"message":"Hello, Asha"}. To keep a Node.js, Python or Go app running after a reboot or a crash, run it as a service: see how to run a custom script as a systemd service, or run it in a container with Docker Compose. If the app stops, nginx answers with a 502 error: 502 Bad Gateway explained.

Where to host a web application

Your appWhat it needsGood fit
Static files or an SPA that talks to someone else’s APIA place to serve files over HTTPSWeb hosting
PHP with MySQL or MariaDB (WordPress, many CMS, shop and CRM apps)PHP, a database, emailWeb hosting with cPanel
Node.js, Python, Go, Java or RubyA long-running process, a reverse proxy, often Redis or background workersA VPS with root access
Self-hosted tools such as n8n, Odoo or NextcloudDocker or several services, regular updatesA VPS, or managed hosting if you prefer not to maintain it
High traffic, large databases, AI featuresGuaranteed CPU, RAM and disk, sometimes a GPUA dedicated or GPU server

If you are not sure how big a server to start with, server requirements explained walks through CPU, RAM and storage.

Before you launch

  • HTTPS everywhere. Logins and forms must not travel in plain text, and PWAs will not work without it.
  • Backups of both files and database, stored somewhere other than the same server, and a restore you have actually tried.
  • An update routine for the app, its plugins or packages, and the language runtime.
  • Secrets out of the code: database passwords and API keys in environment variables or a config file outside the web root.
  • Logs you know how to read, so you can tell a bug from an attack.
  • Only the ports you need open. In the Node.js example, port 3000 listens on 127.0.0.1, so only nginx can reach it.

For a PHP application, our premium web hosting gives you cPanel, multiple PHP versions and MySQL databases. For Node.js, Python or anything that needs its own processes, a KVM VPS gives you full root access to set it up your way. And if you would rather hand over the setup, our engineers are available by the hour.

Ashily Shaji
Ashily Shaji