Square CloudSquare Cloud

What is PaaS (platform as a service)?

PaaS (platform as a service) is the cloud model where you ship your code and the provider maintains the servers, operating system and runtime. You keep the application, its configuration and the size of each instance.

Updated 7 min read

Learning objectives

After reading this article you will be able to:

  • Understand what a PaaS provides and what stays with you
  • See what happens between pushing code and the app answering requests
  • Know when a PaaS fits and when a VPS or serverless fits better
On this page

Every piece of code that reaches production needs a server, an up-to-date operating system, an installed runtime, a TLS certificate and something that starts the process again when it crashes. You can build all of that on a virtual machine. You can also hand only the code to someone who already has that stack ready. The second path is PaaS.

The term shows up in almost every conversation about hosting bots, APIs and websites, often mixed up with serverless, containers and SaaS. This guide explains what a PaaS actually does, what it leaves to you and when it is not the best choice.

What is PaaS?#

PaaS (platform as a service) is the cloud model where you publish your application into an environment the provider already keeps ready to run code.

The reference definition comes from NIST, the US standards institute, in publication SP 800-145. There, PaaS is the capability to deploy onto the cloud applications you created or acquired, built with the languages, libraries, services and tools the provider supports. The customer does not control the underlying infrastructure (network, servers, operating system, storage) but does control the deployed applications and, sometimes, the configuration of the environment that hosts them.

In practice: you hand over a repository or a ZIP with the code and the dependency file (package.json, requirements.txt, go.mod). The platform supplies the rest of the stack up to the runtime.

How does a PaaS work under the hood?#

The details change from one provider to the next, but the path from pushing code to the first response usually has these stages:

  1. Upload. You send the code with git push, an upload, a CLI or a CI integration.
  2. Runtime detection. The platform identifies the language from the dependency file or from the settings you chose, and uses an environment with the OS and runtime ready.
  3. Install and, on some platforms, build. Dependencies get installed. Some platforms have a separate build stage; others install everything when the app starts.
  4. Process start. The start command (npm start, python main.py, java -jar app.jar) runs in an isolated container with the memory you set.
  5. Routing. A proxy in front receives HTTPS traffic, terminates TLS and forwards requests to the port your app listens on.
  6. Logs and restarts. The platform collects what the app writes to standard output, measures CPU and memory and can start the process again when it exits with an error.

Your part is stage 1 plus the configuration. That is why a first deploy on a PaaS takes minutes, while setting up a VPS from scratch takes hours.

What stays with you and what stays with the provider?#

The provider maintains the hardware, the physical network, the operating system and the runtime images, including security patches for those layers. It usually also supplies the proxy, the TLS certificate and log collection.

What stays with you:

  • Code and dependencies. A library with a known vulnerability in your package.json is your problem, not the provider's.
  • Configuration. Environment variables, secrets, the start command and each instance's memory. See what environment variables are.
  • Data and access. Who can sign in to your account, which API keys exist, where copies of your data live.
  • Capacity. On many platforms you decide how much RAM each app gets and how many instances run.

Microsoft sums this up in its shared responsibility model: in every cloud model, data, accounts and configuration remain the customer's. The full table, layer by layer, is in IaaS vs PaaS vs SaaS: the differences, with examples.

How do you prepare an app for a PaaS?#

An app that runs well on a PaaS follows a few rules described by the Twelve-Factor methodology: configuration in the environment, a port provided from outside, logs to standard output and a clean shutdown on SIGTERM. This Node.js server does all four:

js
// index.js (Node.js with "type": "module" in package.json)
import http from "node:http";

const port = Number(process.env.PORT ?? 3000);
const greeting = process.env.GREETING ?? "ok";

const server = http.createServer((req, res) => {
  console.log(`${req.method} ${req.url}`); // log to standard output
  res.end(greeting);
});

server.listen(port, "0.0.0.0", () => {
  console.log(`listening on port ${port}`);
});

// platforms usually send SIGTERM before stopping or replacing the instance
process.on("SIGTERM", () => {
  server.close(() => process.exit(0));
});

What each part solves:

  • PORT and 0.0.0.0. The platform picks the port and expects connections from outside the container. Listening on localhost or a hardcoded port is the classic cause of EADDRINUSE and 502 errors after deploy.
  • Configuration through variables. The same code runs in staging and production; only the variables change.
  • Logging with console.log. Don't write logs to a file hoping to read them later: the platform captures standard output.
  • SIGTERM. During a deploy or restart, Docker, Kubernetes and many platforms send SIGTERM and wait a few seconds before killing the process. The exit codes from that moment are covered in exit code 137, 143 and 1.

It also pays not to depend on files written to the local disk. On many platforms the disk is ephemeral and goes back to the deployed state on every restart; on others it persists. Check the documentation and read why uploaded files disappear after a deploy.

When is a PaaS the right choice?#

A PaaS fits when your app is an ordinary process in a popular language and your time is worth more than control over the system:

  • Discord, Telegram and WhatsApp bots, which need a process that is always on;
  • APIs and backends in Node.js, Python, Go, Java and similar languages;
  • websites and web apps from small teams with nobody dedicated to servers;
  • projects that deploy on every push and want staging and production with the same setup.

A concrete example: a Python API with FastAPI and a PostgreSQL database. On a PaaS, you push the code with requirements.txt, set DATABASE_URL as a variable, choose the memory and publish. On a VPS, before that same deploy, you would install Python, a process supervisor, a reverse proxy and the certificate, and keep all of it updated.

What are the limits of a PaaS?#

What a PaaS takes off your plate in maintenance, it also takes in control:

  • No root access to the system. You can't load a kernel module, tune system network parameters or install arbitrary OS packages.
  • Supported runtimes. If your stack isn't on the provider's list, or depends on a rare system library, the fit gets hard. Platforms that accept your own container image widen that margin.
  • Ports and protocols. Many platforms expose only HTTP and HTTPS. A server that needs UDP or an arbitrary TCP port may have nowhere to run.
  • Disk and state. As mentioned above, not every PaaS keeps files across restarts.
  • Cost at scale. For large, steady workloads, renting machines and building the stack yourself can be cheaper, in exchange for hours of maintenance.

If two or more of these points matter for your project, a VPS or an infrastructure cloud tends to serve you better. The head-to-head comparison is in VPS, cloud or hosting platform.

PaaS, serverless, containers and SaaS: where does each fit?#

  • IaaS: you rent virtual machines, disks and networks and build the stack. It sits one layer below PaaS.
  • Containers as a service (CaaS): you hand over a ready container image and the provider runs it. It sits between IaaS and PaaS, because the system inside the image is yours.
  • Serverless (FaaS): you hand over functions that run per request and can scale to zero. Microsoft classifies Azure Functions as PaaS, but the execution model is different: see serverless vs containers.
  • SaaS: you use a finished application, such as email or a CRM, without publishing any code.

The lines between them are blurry, and every provider uses the names its own way. The useful question is always the same: what do you hand over, and what does the provider maintain?

How to do this on Square Cloud#

Square Cloud works in this model as self-service hosting: you ship the code and control the deploy, scaling and configuration of each application. Each one runs in an isolated container that is always on, with no cold start and no sleep on inactivity, and the disk persists across restarts and deploys.

You deploy by ZIP upload in the dashboard, with the CLI, through GitHub (a push deploys, via the official GitHub Action or a webhook) or with the VS Code extension. The squarecloud.app config file is optional: the dashboard generates it during the deploy, or you write it at the project root. Runtimes include Node.js, Python, Go, Java and Rust (see the list on Runtimes). There is no build step: on start, the platform installs the dependencies, and a build can go to an external CI or into the start command. There is also no Dockerfile, no custom image and no root access.

Environment variables are set per application in the dashboard, the API, the CLI or VS Code, and apply on the next restart. To scale, you change each application's RAM in its settings or through the API, or use load balancing from the Standard plan up. There is no autoscaling. All plans are paid, starting at R$12.49 per month on Hobby.

See what is included in Square Cloud features.

Deploy

Push from GitHub, the CLI or a ZIP and go live in seconds

Platform features

FAQs

What is the difference between PaaS and IaaS?

With IaaS you get virtual machines, networking and disks, and everything from the operating system up is yours. With PaaS the provider maintains the OS and runtime, and you hand over the code and the configuration.

Is serverless the same as PaaS?

They are close relatives. In both you don't run a server yourself, but a serverless function runs per request with a duration limit, while on a container PaaS the process usually stays on all the time.

Can I use Docker on a PaaS?

It depends on the platform. Some accept a Dockerfile or a prebuilt image; others take only the source code and build the environment from the runtime you pick. Check the documentation before you migrate.

Does a PaaS lock my app to one provider?

Less than it seems, if the app reads its configuration from environment variables and listens on the port it is given. What locks you in most are services and SDKs exclusive to one provider.

Next articleExit code 137, 143 and 1: why your process stoppedExit code 137 is SIGKILL (128 + 9), usually out of memory; 143 is SIGTERM and 1 is an application error. See the full table of codes and how to find the cause.

More in Deploy

See all 38 articles