In the previous lesson you turned Colmena Bookings into an optimised dist/ folder: hashed chunks, hidden source maps, precompressed files and environment variables per mode. Deploying means taking that folder to a server and making sure that Colmena's members can use it securely. It looks like the easy part (they are only static files, after all), but it is where the problems you never see locally appear: reloading on an internal route that returns a 404 error, a new version that never reaches users because of caching (or caching that is never put to use), chunks that vanish in the middle of a session, security headers that nobody configured, a different build for each environment and no quick way of going back. In this lesson we keep the promise we made in Introduction to Vue Router: configuring the fallback to index.html on the most common platforms. Then we will package Colmena in a Docker container with nginx, configure its caching and its headers, make a single build serve both staging and production, also deploy the public website colmena-web, and finish with the post-deployment check and rollback.

Contents

  1. What deploying an SPA means
  2. HTML5 mode and the fallback to index.html
  3. The fallback on each platform
  4. Colmena's choice: a container with nginx
  5. The multi-stage Docker container
  6. The nginx configuration
  7. Cache headers and deployments without lost chunks
  8. HTTPS and security headers
  9. Runtime configuration: /config.json
  10. Staging and production
  11. Deploying colmena-web
  12. Post-deployment check
  13. Rollback
  14. Try it

  1. What deploying an SPA means

Once built, Colmena Bookings does not need any program of its own on the server: it is HTML, CSS, JavaScript and images. Any server capable of delivering files can publish it. All the logic runs in the browser, and the data comes from an API (simulated in src/api/ for now).

flowchart LR
    subgraph Build["Build (once per version)"]
        A["Source code"] --> B["npm run build"] --> C["dist/"]
    end
    subgraph Server["File server or CDN"]
        D["index.html<br/>assets/*-HASH.js, *.css<br/>config.json"]
    end
    C -- "deployment" --> D
    E["Member's browser"] -- "GET /, /rooms/nectar..." --> D
    E -- "data (fetch)" --> F["Colmena API"]

Deploying an SPA consists of:

  • Copying dist/ to a server or to a static hosting service (with or without a CDN, a network of servers spread around the world that keep copies of the files close to users).
  • Configuring that server for three things Vite cannot decide for you: what to respond to the application's routes (section 2), how long the files can be cached (section 7) and which security headers accompany the responses (section 8).
  • Doing it in a repeatable and reversible way: the same process every time, and a quick way of going back to the previous version if something goes wrong (section 13).

A desirable property is for the deployment to be atomic: users see either the complete previous version or the complete new one, never a mixture. Static platforms (Netlify, Vercel, Cloudflare Pages...) and containers guarantee this; copying files one by one to a server with scp or rsync does not. If you have no choice but to copy files, copy the resources in assets/ first (with new names, they bother nobody) and index.html last, as it is the file that "activates" the new version.

colmena-web, on the other hand, does need a program on the server, as you will see in section 11.

  1. HTML5 mode and the fallback to index.html

In 04-01 we chose createWebHistory, with clean URLs such as /rooms/nectar, and anticipated what it requires: when the user reloads that page or opens it from a link, the browser asks the server for /rooms/nectar, which is not a file in dist/. An unconfigured server responds with a 404 before Vue Router even gets to run. The development server and vite preview handle this for you; your production server does not.

The rule that any server publishing an SPA needs has three parts:

Request Example Correct response
A file that exists /assets/index-CvOePk43.js, /favicon.ico The file
An application route (not a file) /rooms/nectar, /dashboard/bookings index.html, with status 200, so that the router decides
A hashed resource that does not exist /assets/RoomsView-9f8e.js (from a previous version) 404, never index.html

The third row is often forgotten, and it matters. If the server returns index.html for a missing JavaScript file, the browser receives HTML where it expected a module, and the resulting error is more confusing. Worse still: if that response carries the resources' immutable cache header (section 7), the browser may store that HTML for a year under the chunk's name. If one day you roll back to the version that contained that chunk (section 13), the affected browsers would keep receiving HTML.

And a consequence you already know: since the server responds 200 with index.html to any unknown route, 404 error pages are the application's responsibility (NotFoundView, 04-02). For a private application behind a sign-in like Colmena Bookings, this does not matter. For a public site that should appear in search engines, returning 200 for pages that do not exist (a soft 404) is a problem, and it is one of the reasons why colmena-web uses server-side rendering (09-06), which can return a real 404.

  1. The fallback on each platform

3.1 Netlify

Netlify reads a _redirects file in the published folder. Since everything in public/ is copied to dist/, create it at public/_redirects:

# public/_redirects (Netlify)
# 1. A hashed resource that does not exist: 404, never the application
/assets/*    /404.html     404
# 2. Any other route that is not a file: the SPA
/*           /index.html   200
  • Netlify only applies a rule if there is no file at that path (it calls this shadowing). That is why /* does not affect /assets/index-CvOePk43.js or /favicon.ico: they exist and are served as they are.
  • The 200 status turns the rule into a rewrite: the browser's URL does not change, but the content is that of index.html. With 301 or 302 it would be a redirect, and the user would end up on the home page.
  • The first rule catches non-existent resources before the second. If there is no 404.html, Netlify responds with its own error page, but with the 404 status, which is what matters.

The alternative is netlify.toml at the root of the repository, which also lets you define the build and the headers:

# netlify.toml
[build]
  command = "npm run build"
  publish = "dist"

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200

[[headers]]
  for = "/assets/*"
  [headers.values]
    Cache-Control = "public, max-age=31536000, immutable"

3.2 Vercel

Vercel detects Vite projects and serves dist/ with no configuration, but the fallback has to be declared in vercel.json, at the root:

{
  "rewrites": [{ "source": "/((?!assets/).*)", "destination": "/index.html" }],
  "headers": [
    {
      "source": "/assets/(.*)",
      "headers": [{ "key": "Cache-Control", "value": "public, max-age=31536000, immutable" }]
    }
  ]
}
  • Vercel serves files that exist first and only then applies the rewrites, just like Netlify.
  • /((?!assets/).*) captures any route that does not start with assets/ (a regular expression negative lookahead). That way, a missing resource is not rewritten to index.html and receives a 404.

3.3 nginx

In nginx, the directive is try_files, which tries alternatives in order:

location / {
    try_files $uri $uri/ /index.html;
}

"Try to serve the requested file ($uri); if it does not exist, the directory ($uri/); if that does not exist either, serve /index.html." Colmena's complete configuration, with the rule for resources, caching and headers, is in section 6.

3.4 Apache

On Apache hosting (common with shared hosting), you use an .htaccess file. Put it in public/.htaccess so that Vite copies it to dist/:

# public/.htaccess (Apache with mod_rewrite)
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  # index.html is served as is
  RewriteRule ^index\.html$ - [L]
  # Hashed resources that do NOT exist: 404
  RewriteCond %{REQUEST_URI} ^/assets/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ - [R=404,L]
  # Anything that is neither a file nor a directory: the SPA
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.html [L]
</IfModule>
  • The conditions (RewriteCond) only apply to the rule that follows them, and all of them must be met. !-f and !-d mean "what was requested is not an existing file" and "it is not an existing directory".
  • The /assets/ rule needs its own !-f condition: without it, it would also respond 404 to resources that do exist. It is a good example of why rewrite rules must always be tested, including with a file that does exist.
  • [R=404,L]: with a code outside the redirect range, Apache responds with that status and stops processing rules.
  • If the hosting does not allow mod_rewrite, the FallbackResource /index.html directive (from mod_dir) achieves the basic fallback in a single line, although without distinguishing the resources.
  • RewriteBase and the last rule must change if the application lives in a subdirectory (/bookings/index.html), consistently with the base option from 10-01.

3.5 GitHub Pages

GitHub Pages publishes static files for free from a repository, but it does not support rewrite rules or custom headers. In addition, a project is published in a subdirectory: https://username.github.io/colmena-bookings/. There are three ways of publishing an SPA there:

Option How Advantages Drawbacks
Hash mode createWebHashHistory() in the router Always works, no tricks URLs with # (/#/rooms/nectar)
The 404.html trick Copy index.html as 404.html Clean URLs Internal routes respond with a 404 status (even though the application works): bad for search engines and monitoring
Custom domain Configure a domain in GitHub Pages No subdirectory (base: '/') Still no rewrites: you need one of the two previous options

The 404.html trick works because GitHub Pages serves that file for any route that does not exist: the browser receives the complete application, Vue Router reads the URL and renders the screen. In the first two cases, the build needs the repository's base:

"build:pages": "vite build --base /colmena-bookings/ && cp dist/index.html dist/404.html"

(cp does not exist in the classic Windows console; in a cross-platform project, use a small Node script or a package such as shx.) The publishing itself will be done by a GitHub action, which you will see in 10-03. In addition, GitHub Pages sets its own caching policy (a few minutes) and does not allow security headers: it is an excellent option for demos and documentation, not for the production application.

3.6 Summary

Platform File Fallback Missing resources → 404 Custom headers
Netlify _redirects or netlify.toml /* /index.html 200 Earlier rule for /assets/* Yes (netlify.toml or _headers)
Vercel vercel.json rewrites Negative lookahead in source Yes (headers)
nginx nginx.conf try_files $uri $uri/ /index.html location /assets/ { try_files $uri =404; } Yes (add_header)
Apache .htaccess RewriteRule . /index.html Condition on /assets/ Yes (Header set, with mod_headers)
GitHub Pages — The 404.html trick or hash mode Not configurable No

  1. Colmena's choice: a container with nginx

For Colmena Bookings, the team has decided to publish a Docker image with nginx, which will run on the container platform Colmena already uses for other services. The reasons:

  • The same artefact in every environment. The image tested in staging is, byte for byte, the one that reaches production. The only thing that changes is the environment variables it starts with (section 9).
  • Full control over the headers: caching, compression and security, in a file committed alongside the code.
  • Portability. The image works the same on a developer's laptop, on your own server and with any container provider.
  • Trivial rollback: going back means starting the previous image (section 13).

The cost is maintaining an nginx configuration. A static platform such as Netlify or Vercel would be simpler and also a valid option; in fact, in 10-03 we will use one for the previews of each change.

  1. The multi-stage Docker container

A container packages an application with everything it needs to run. For Colmena, we need Node to build and nginx to serve, but we do not want Node (or node_modules, or the source code) in the final image: it would take up hundreds of megabytes and widen the attack surface. The solution is a multi-stage build: several stages in the same Dockerfile, of which only the last one makes up the image.

flowchart LR
    subgraph E1["Stage 1: build (node)"]
        A["package.json<br/>package-lock.json"] --> B["npm ci"]
        C["Source code"] --> D["npm run build"]
        B --> D --> E["dist/ (without .map files)"]
    end
    subgraph E2["Stage 2: final image (nginx)"]
        F["nginx template<br/>+ startup script"]
        G["/usr/share/nginx/html"]
    end
    E -- "COPY --from=build" --> G

Create a Dockerfile at the root of colmena-bookings:

# Dockerfile: Colmena Bookings image
# ---------- Stage 1: build with Node ----------
# Use the same major version of Node as stated in .nvmrc
FROM node:lts-alpine AS build
WORKDIR /app

# Cypress is a development dependency with a binary of hundreds of megabytes:
# there is no need to download it for building
ENV CYPRESS_INSTALL_BINARY=0

# First, only the dependency files: this layer is reused
# as long as package.json and package-lock.json do not change
COPY package.json package-lock.json ./
RUN npm ci

# Then, the code and the production build
COPY . .
RUN npm run build && find dist -name '*.map' -delete

# ---------- Stage 2: serve with nginx ----------
FROM nginx:stable-alpine

# Configuration template: on startup, the official image substitutes the
# environment variables and writes the result to /etc/nginx/conf.d/default.conf
COPY nginx/default.conf.template /etc/nginx/templates/default.conf.template

# Script that generates config.json when the container starts (section 9)
COPY --chmod=755 nginx/40-colmena-config.sh /docker-entrypoint.d/40-colmena-config.sh

# Only the result of the build
COPY --from=build /app/dist /usr/share/nginx/html

EXPOSE 80

Line by line:

  • FROM ... AS build gives the first stage a name so that you can copy from it later.
  • npm ci (rather than npm install) installs exactly what package-lock.json says, fails if it does not match package.json and always starts from scratch: it is the command for reproducible builds.
  • Copying the dependency files first takes advantage of Docker's layer cache: if you only change a component, Docker reuses the npm ci layer and the build takes seconds instead of minutes.
  • find dist -name '*.map' -delete: the hidden maps from 10-01 must not reach the image. In 10-03 we will upload them to the error service beforehand.
  • nginx:stable-alpine: the official nginx image, on its stable branch and based on Alpine Linux (very small).
  • /etc/nginx/templates/ and /docker-entrypoint.d/ are two mechanisms of the official image that we will use in sections 6 and 9. --chmod=755 makes the script executable (it requires BuildKit, the default build engine in current versions of Docker).

And a .dockerignore, which avoids sending Docker anything that must not go into the build:

# .dockerignore
node_modules
dist
dist-e2e
coverage
cypress/screenshots
cypress/videos
bundle-report.html
.git
# Personal settings: if they got in, they would override the production variables
*.local

The last line is more important than it looks: if a developer's .env.local got into the build, their personal VITE_API_URL would beat the one in .env.production (10-01, section 5.2), and it would be published.

To build and start the image locally (you need Docker installed):

docker build -t colmena-bookings:local .
docker run --rm -p 8080:80 \
  -e ENVIRONMENT=local \
  -e API_URL=http://localhost:8080/api \
  colmena-bookings:local

Open http://localhost:8080. We will explain the two -e variables in section 9.

  1. The nginx configuration

Create the nginx/ folder with the nginx/default.conf.template template:

# nginx/default.conf.template
# Template: when the container starts, the official nginx image substitutes the
# defined ${...} environment variables and writes /etc/nginx/conf.d/default.conf

# Caching policy according to the requested path (section 7)
map $uri $colmena_cache {
    default         "no-cache";
    /config.json    "no-store";
    ~^/assets/      "public, max-age=31536000, immutable";
}

server {
    listen 80;
    server_name _;

    root /usr/share/nginx/html;
    index index.html;

    # Do not advertise the nginx version in the headers or on error pages
    server_tokens off;

    # --- Compression ---
    # Serves file.gz if it exists (precompressed in 10-01) and the browser accepts gzip
    gzip_static on;
    # Compresses on the fly whatever has not been precompressed (for example, config.json)
    gzip on;
    gzip_vary on;
    gzip_types text/css application/javascript text/javascript application/json image/svg+xml;

    # --- Headers on every response ---
    add_header Cache-Control $colmena_cache always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;
    add_header X-Frame-Options "DENY" always;
    add_header Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=()" always;
    add_header X-Robots-Tag "noindex, nofollow" always;
    add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; font-src 'self'; connect-src 'self' ${API_URL}; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always;

    # --- Routes ---
    # Hashed resources: the file or a 404, never index.html
    location /assets/ {
        try_files $uri =404;
    }

    # Runtime configuration, generated on startup (section 9)
    location = /config.json {
        try_files $uri =404;
    }

    # Source maps: not published even if someone leaves them in the image
    location ~ \.map$ {
        return 404;
    }

    # Everything else: the file if it exists; otherwise, the SPA
    location / {
        try_files $uri $uri/ /index.html;
    }
}

Let's go through it piece by piece.

The template. On startup, the official nginx image processes each file in /etc/nginx/templates/*.template with the envsubst tool, which replaces ${VARIABLE} with the value of that environment variable, and writes the result to /etc/nginx/conf.d/ without the .template extension. It only replaces the variables that are defined in the container's environment; nginx's own variables ($uri, $colmena_cache) are left intact. In this template there is only one: ${API_URL}, in the security policy (section 8).

map. It calculates one variable ($colmena_cache) from another ($uri, the requested path). Exact strings are compared first; those that start with ~ are regular expressions. That way, each response carries its own caching policy:

Request Final $uri Cache-Control
/assets/index-CvOePk43.js /assets/index-CvOePk43.js public, max-age=31536000, immutable
/config.json /config.json no-store
/ /index.html no-cache
/rooms/nectar (SPA route) /index.html (after the try_files) no-cache
/img/rooms/panal.webp (from public/) /img/rooms/panal.webp no-cache

Why a map and not a different add_header in each location? Because of an nginx rule that causes a lot of bugs: if a location block defines any add_header, it stops inheriting all the add_header directives from the server block. With a Cache-Control inside location /assets/, the resources would silently lose all the security headers. With the map, all the headers are declared just once, in the server, and no location touches them.

always. Without it, nginx only adds the headers to successful responses (200, 204, 301...), not to errors such as 404.

Compression. gzip_static on looks for the precompressed .gz version of each file and serves it if the browser accepts gzip. The module that does this is part of the official image. The .br files from 10-01 are not used here: serving precompressed brotli requires the ngx_brotli module, which the official image does not include. If the platform or the proxy in front of nginx compresses with brotli on its own, that will be put to use; if not, gzip already achieves most of the saving. gzip_vary adds Vary: Accept-Encoding, so that intermediate caches do not deliver the compressed version to clients that do not accept it.

The location blocks. nginx chooses the longest matching prefix location, but if a regular expression (~) also matches, the regular expression wins. That is why /assets/index-CvOePk43.js.map falls into the source maps block and receives a 404, even though it starts with /assets/.

  1. Cache headers and deployments without lost chunks

7.1 The three values

Value Meaning What for
public, max-age=31536000, immutable Any cache can store it for a year; immutable indicates that it does not even need revalidating on reload Hashed resources: if they change, their name changes (10-01)
no-cache It can be stored, but the cache must ask the server before using it (with ETag/If-None-Match); if it has not changed, the server responds 304 Not Modified with no body index.html and unhashed files from public/
no-store It is not stored in any cache config.json: every load must see the environment's current configuration

A very common mistake is to think that no-cache means "do not store": that is no-store. With no-cache, index.html is revalidated on every visit at minimal cost.

7.2 The connection with the loading failures from 09-05

In 09-05 you saw the problem: a user has version 1 open; version 2 is deployed; when they navigate, their application requests a chunk from version 1 that no longer exists. The cache headers explain why the problem has exactly that shape:

  • Thanks to no-cache on index.html, any new load of the page receives version 2 instantly. Without that header, some users would keep loading version 1 for hours, even though it no longer existed on the server.
  • Thanks to immutable on the resources, the chunks the user had already downloaded are still in their cache, and version 1 keeps working as long as it does not need a new one.
  • The failure only appears with the version 1 chunks that had not been downloaded yet. And since /assets/ responds with a 404 (not index.html), the error is a clear loading failure, which isCodeLoadFailure recognises and which triggers the reload in router.onError or vite:preloadError (10-01).

The reload is a safety net. Can the failure be avoided? Yes, if the previous version's files still exist for a while after the deployment:

Strategy How Cost
Reload on failure (Colmena) router.onError and vite:preloadError None in infrastructure; the user sees an occasional reload
Keep the previous versions Publish assets/ to object storage or a CDN where each deployment adds files without deleting the previous ones, and clean up those older than a few weeks Separate storage and a clean-up process
Platforms that do it for you Some static platforms keep the resources from previous deployments accessible Depends on the provider; check their documentation

With containers, each image contains only the resources for its own version: when the container is replaced, the previous ones disappear. For an internal application such as Colmena, with deployments that take a few minutes and a transparent reload, the first strategy is enough. An application with many simultaneous users and frequent deployments should consider the second.

  1. HTTPS and security headers

8.1 HTTPS

An application that people sign in to must be served over HTTPS: without encryption, anyone on the same network can read or modify what travels over it, including the application's JavaScript. In addition, many browser features (service workers, the clipboard, cookies with Secure, brotli) only work in secure contexts.

In a container architecture, the certificate is usually not managed by the container, but by whatever sits in front of it:

flowchart LR
    N["Browser"] -- "HTTPS (certificate)" --> P["Platform proxy /<br/>load balancer"]
    P -- "HTTP, internal network" --> C1["nginx container<br/>Colmena Bookings"]
    P -- "HTTP, internal network" --> C2["Node container<br/>colmena-web"]

This is TLS termination: the proxy (the container platform's, or one of your own such as Caddy or Traefik) automatically obtains and renews free certificates from Let's Encrypt, decrypts the traffic and forwards it to the containers over the internal network. That is why our nginx listens on port 80.

If nginx served directly on a virtual machine, the block would look something like this (with certificates obtained with a tool such as certbot):

# Redirect HTTP to HTTPS
server {
    listen 80;
    server_name bookings.colmena.example;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    http2 on;
    server_name bookings.colmena.example;

    ssl_certificate     /etc/letsencrypt/live/bookings.colmena.example/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/bookings.colmena.example/privkey.pem;

    # HSTS: only enable it once HTTPS works across the whole domain (see below)
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

    # ... root, map, headers and location blocks, as in default.conf.template
}

HSTS (Strict-Transport-Security) tells the browser never to use HTTP with that domain for max-age seconds, even if the user types it. It is very effective and very hard to undo: if you enable it with includeSubDomains and some subdomain does not have HTTPS yet, it will become inaccessible to those browsers for a year. Start with a small max-age (for example, 300) and increase it once you have checked everything. With TLS termination on the platform, this header is usually configured there.

8.2 Colmena's security headers

Header Value What it prevents
X-Content-Type-Options nosniff The browser "guessing" a file's type and running something as a script that is not one
Referrer-Policy strict-origin-when-cross-origin Internal URLs (/dashboard/bookings?new=...) being sent in full to other sites when following a link
X-Frame-Options DENY Another website embedding Colmena in an <iframe> to trick the user (clickjacking). It is the old version of frame-ancestors; both are kept for compatibility
Permissions-Policy camera=(), microphone=()... The application (or an injected script) requesting access to features it never uses
X-Robots-Tag noindex, nofollow Search engines indexing a private application (the public part is colmena-web)
Content-Security-Policy See 8.3 Running code that does not come from the site's own domain

8.3 A CSP compatible with Colmena

The Content Security Policy (CSP) tells the browser which origins it may load each type of resource from. Its great value is that it limits the damage of an XSS flaw: even if an attacker managed to inject HTML, the browser would refuse to run scripts that do not come from the allowed origins. Colmena's, directive by directive:

Directive Value Why it works with Colmena
default-src 'self' By default, only the site's own domain
script-src 'self' Vite's build has no inline scripts: index.html only links to files in assets/. Vue templates are compiled at build time, so 'unsafe-eval' is not needed, and the current version of Vue I18n compiles messages without eval
style-src 'self' CSS is extracted into .css files, including that of the lazy chunks. The styles Vue applies with :style, the v-bind() variables in <style> (02-06) and the positioning of Floating Vue's tooltips are assigned from JavaScript to element.style, which the CSP does not block
img-src 'self' data: Small imported images are embedded as data: URIs (10-01)
font-src 'self' Colmena does not load external fonts
connect-src 'self' ${API_URL} fetch requests can only go to the site's own domain (config.json) and to the API. When a real monitoring service exists, its domain too
object-src 'none' No Flash and no plugins
base-uri 'self' Nobody can inject a <base> that changes where relative paths point
form-action 'self' An injected form cannot send data to another site
frame-ancestors 'none' The same as X-Frame-Options, in its modern version

Notice the connection with v-html and DOMPurify (06-01). The reception note in AppHeader is rendered with v-html after sanitising it with sanitizeHtml. The CSP is a second line of defence: if the sanitisation ever failed and let an <img src=x onerror="..."> through, the onerror attribute is an inline script, and script-src 'self' prevents it from running. But the CSP does not replace sanitisation: sanitizeHtml also restricts the allowed tags and attributes, which is why any style attributes the note might contain (which the CSP would indeed block) never reach the DOM.

A badly tuned CSP breaks the application without warning the user. The prudent way to introduce it:

  1. Publish it in report mode first on staging: with the name Content-Security-Policy-Report-Only, the browser blocks nothing, but shows each violation in the console.
  2. Go through the application (or run the E2E tests against staging) and review the console.
  3. Enforce it with the definitive name once there are no violations.

One case that report mode often uncovers: style attributes written in the templates (<p style="margin: 0">). To save the browser work, Vue's compiler may turn large blocks of static markup into an HTML string that is inserted in one go, and a style attribute that arrives as HTML is subject to style-src. The solution is simple and cleaner too: use classes.

If something legitimate is blocked, extend the specific directive with the origin it needs; avoid 'unsafe-inline' in script-src, which cancels out much of the protection.

Warning. Security headers, the CSP and the HTTPS configuration are security controls. The values in this lesson are a reasonable starting point for Colmena, not an audit. Before publishing a real application, have a security professional review them together with the API, the authentication and the infrastructure, and check the result with header analysis tools.

  1. Runtime configuration: /config.json

9.1 The problem with one build per environment

In 10-01, the variables for each environment (VITE_API_URL, VITE_ENVIRONMENT) are replaced at build time. That forces you to build once for staging (build:staging) and again for production (build). And that has a serious problem: what is tested on staging is not what is published to production. They are two different builds, only one of which has passed the team's tests. A dependency that was resolved differently, a misspelt variable in .env.production... and the bug appears straight in production.

The alternative is to build just once and give each environment its values on startup, as Nuxt does with runtimeConfig (10-01, section 15). An SPA has no server of its own to read the environment, but it can request its configuration before mounting:

sequenceDiagram
    participant N as Browser
    participant S as nginx (container)
    Note over S: On startup, 40-colmena-config.sh<br/>writes config.json with ENVIRONMENT and API_URL
    N->>S: GET /
    S-->>N: index.html
    N->>S: GET /assets/index-*.js, vue-*.js...
    S-->>N: Application code (the same in every environment)
    par Before mounting
        N->>S: GET /config.json
        S-->>N: { "name": "staging", "apiUrl": "..." }
    and
        N->>S: GET /assets/es-*.js (initial language, if it is not English)
    end
    Note over N: app.mount('#app')

9.2 What goes where

Moment Mechanism What goes there in Colmena
Build VITE_ variables in .env.[mode] Whatever must be decided at build time: VITE_STABLE_SIMULATION (for security: it must not be possible to enable it in a published build, 08-04) and the defaults for the rest
Container startup Environment variables → config.json Whatever changes from one environment to another: the environment's name and the apiUrl
Never in the front end — Secrets (10-01, section 5.4). config.json is just as public as the JavaScript

9.3 Generating config.json on startup

Before starting the server, the official nginx image runs the executable scripts in /docker-entrypoint.d/ in alphabetical order. Create nginx/40-colmena-config.sh:

#!/bin/sh
# nginx/40-colmena-config.sh
# Runs when the container starts and generates config.json from the
# ENVIRONMENT and API_URL environment variables.
# set -u: if any variable is missing, the script fails and the container does not start
set -eu

cat > /usr/share/nginx/html/config.json <<EOF
{
  "name": "${ENVIRONMENT}",
  "apiUrl": "${API_URL}"
}
EOF

echo "Colmena Bookings: config.json generated for the ${ENVIRONMENT} environment"
  • The 40- prefix places it after the image's own scripts (the one that processes the templates starts with 20-).
  • set -u makes an undefined variable an error. It is deliberate that the Dockerfile does not define defaults: a container started without ENVIRONMENT must not pass itself off as production; it must refuse to start.
  • The values are controlled by the team (they do not come from users), so there is no need to escape special JSON characters. If one day they came from an uncontrolled source, it would have to be generated with a tool that escapes them correctly.

9.4 Reading it in the application

src/environment.js is no longer an object frozen from the start: it now has defaults (the build-time values) and a function that completes them with config.json:

// src/environment.js
// Settings that depend on the environment in which Colmena Bookings runs.
// Defaults: the build-time variables (.env.[mode], 10-01).
// On deployment, /config.json overrides them without rebuilding.
export const environment = {
  name: import.meta.env.VITE_ENVIRONMENT ?? import.meta.env.MODE,
  apiUrl: import.meta.env.VITE_API_URL ?? ''
}

// Called just once, in main.js, before mounting the application. It never rejects.
export async function loadEnvironment() {
  if (import.meta.env.DEV) return Object.freeze(environment) // in development, the .env files rule

  try {
    const response = await fetch(`${import.meta.env.BASE_URL}config.json`, { cache: 'no-store' })
    if (!response.ok) throw new Error(`status ${response.status}`)
    const remote = await response.json()
    // Only known keys are accepted, and only if they are strings
    for (const key of Object.keys(environment)) {
      if (typeof remote[key] === 'string') environment[key] = remote[key]
    }
  } catch (error) {
    console.warn('[environment] Could not read config.json; using the build-time values.', error)
  }
  return Object.freeze(environment)
}
  • BASE_URL: respects the base if the application lives in a subdirectory.
  • cache: 'no-store': in addition to the server's header, it asks the browser not to use any stored copy.
  • If it fails, nothing breaks: with vite preview or in the E2E build there is no config.json, and the values from .env.production or .env.e2e are used. That is why nginx responds with a 404 to /config.json if it does not exist: if it returned index.html, response.json() would fail with a syntax error, which is also caught, but the 404 makes the diagnosis obvious.
  • Unknown keys are ignored: config.json cannot add unexpected properties to the object.
  • Object.freeze at the end: once loaded, nobody can change it. The test in exercise 1 of 10-01 must now call await loadEnvironment() before checking that the object is frozen (in the tests, import.meta.env.DEV is true and the function freezes it without requesting anything).

In src/main.js, mounting waits for the configuration and the language in parallel:

// src/main.js
import { loadEnvironment } from './environment.js'

// ... creating the application and plugins, unchanged

// 5. Mounting, once the environment and the initial language are ready
Promise.all([
  loadEnvironment(), // never rejects
  changeLanguage(initialLanguage()).catch((error) =>
    console.error('[i18n] Could not load the initial language:', error)
  )
]).finally(() => app.mount('#app'))

AppHeader and logError do not change: they still read environment.name, which already has its definitive value by the time the application mounts. The cost is a small request before the first paint, in parallel with the language request.

  1. Staging and production

With runtime configuration, staging and production run the same image with different variables:

# staging
docker run -d --name colmena-bookings -p 8080:80 \
  -e ENVIRONMENT=staging -e API_URL=https://api.staging.colmena.example \
  registry.colmena.example/colmena-bookings:v1.4.0

# production: the same image, already tested on staging
docker run -d --name colmena-bookings -p 8080:80 \
  -e ENVIRONMENT=production -e API_URL=https://api.colmena.example \
  registry.colmena.example/colmena-bookings:v1.4.0

In practice, they are not run by hand: the container platform has each service defined with its variables, and deploying consists of telling it which version of the image to run. The differences that there should be between the two environments:

Aspect Staging Production
Address staging.bookings.colmena.example bookings.colmena.example
Image The candidate version The same version, once staging has validated it
API and data Staging API with fictitious data Real API with real data
Who has access Only the team (restricted at the proxy by network, VPN or authentication) The members
Environment badge Visible Hidden
Errors To the monitoring service, tagged as staging The same, tagged as production

A consequence worth accepting: in 10-01 we decided to keep console.* in staging mode. With a single build, staging runs the production build, without console. That is the price of testing exactly what gets published, and it is worth paying: for diagnosis you still have the error service, the source maps and, locally, npm run build:staging.

  1. Deploying colmena-web

colmena-web (09-06) is not a collection of static files: it renders HTML on the server, has API routes (server/api/rooms.get.js) and swr caching rules. Nuxt builds its server with Nitro, which can generate the output for different targets by means of presets:

Option How Result When
Node server nuxt build (the node-server preset, the default) .output/server/index.mjs + .output/public/ SSR, swr, API routes; full control; in a container like Colmena Bookings
Platform with functions nuxt build with the platform's preset (NITRO_PRESET=netlify, vercel, cloudflare-pages...), or automatically when building on it Serverless or edge functions + static files No servers to manage; isr rules with the platform's CDN cache
Static nuxt generate .output/public/: every route prerendered as HTML No server; content that changes little; the server/api routes only exist during generation

colmena-web needs a server (it has swr and an API that the website itself queries while navigating). The team uses the same container platform, with this Dockerfile at the root of colmena-web:

# colmena-web Dockerfile (Nuxt, Node server)
FROM node:lts-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
# --ignore-scripts: the postinstall (nuxt prepare) needs the code, which has not been copied yet;
# nuxt build will do it anyway
RUN npm ci --ignore-scripts
COPY . .
RUN npm run build

FROM node:lts-alpine
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=3000
# .output is self-contained: it includes the dependencies the server needs
COPY --from=build /app/.output ./.output
# Do not run as root
USER node
EXPOSE 3000
CMD ["node", ".output/server/index.mjs"]
  • .output/ is self-contained: Nitro copies to .output/server/node_modules only the dependencies the server really uses. The final image does not need npm ci.
  • USER node: the official Node image includes an unprivileged user; a server that does not need to be root should not be.
  • Nuxt's runtime configuration is provided with environment variables on startup: NUXT_PUBLIC_BOOKINGS_URL=https://bookings.colmena.example replaces the bookingsUrl in runtimeConfig, without rebuilding. It is the native equivalent of our config.json.
  • Caching: Nitro already serves the hashed resources in /_nuxt/ with a long-lived cache, and the swr rules add their own headers. Security headers can be added with routeRules ('/**': { headers: { ... } }) or at the proxy; the CSP for an application with SSR is more delicate (Nuxt inserts inline scripts with the state for hydration), and deserves a study of its own.
docker build -t colmena-web:local .
docker run --rm -p 3000:3000 -e NUXT_PUBLIC_BOOKINGS_URL=http://localhost:8080 colmena-web:local

  1. Post-deployment check

A deployment does not end when the container starts, but when it has been verified that the application responds as it should. That quick, superficial check (does it switch on? is there smoke?) is called a smoke test. It does not replace the tests; it detects what can only fail in the real environment: the server configuration, the headers, the config.json.

Create scripts/check-deployment.sh in colmena-bookings:

#!/usr/bin/env bash
# scripts/check-deployment.sh
# Post-deployment check for Colmena Bookings.
# Usage: scripts/check-deployment.sh https://staging.bookings.colmena.example staging
set -euo pipefail

URL="${1%/}"            # without a trailing slash
EXPECTED_ENVIRONMENT="$2"

fail() { echo "FAIL: $1" >&2; exit 1; }
ok() { echo "OK     $1"; }

status() { curl -s -o /dev/null -w '%{http_code}' "$URL$1"; }
headers() { curl -sI "$URL$1"; }

# 1. The home page and an internal route respond (SPA fallback)
[ "$(status /)" = 200 ] || fail "/ does not respond 200"
ok "/ responds 200"
[ "$(status /rooms/nectar)" = 200 ] || fail "/rooms/nectar does not respond 200: is the fallback missing?"
ok "/rooms/nectar responds 200"

# 2. A non-existent resource gives a 404, not index.html
[ "$(status /assets/does-not-exist-0000.js)" = 404 ] || fail "a non-existent resource does not respond 404"
ok "non-existent resources respond 404"

# 3. Caching: index.html is revalidated; the main script is immutable
headers / | grep -qi '^cache-control: no-cache' || fail "index.html without Cache-Control: no-cache"
ok "index.html with no-cache"
SCRIPT=$(curl -s "$URL/" | grep -o '/assets/index-[^"]*\.js' | head -n 1)
[ -n "$SCRIPT" ] || fail "the main script cannot be found in index.html"
headers "$SCRIPT" | grep -qi 'immutable' || fail "$SCRIPT without immutable caching"
ok "$SCRIPT immutable"

# 4. Source maps are not published
[ "$(status "$SCRIPT.map")" = 404 ] || fail "the source map is accessible"
ok "source maps not accessible"

# 5. Security headers
for HEADER in content-security-policy x-content-type-options referrer-policy; do
  headers / | grep -qi "^$HEADER:" || fail "the $HEADER header is missing"
done
ok "security headers present"

# 6. The configuration is the expected environment's
curl -s "$URL/config.json" | grep -q "\"name\": *\"$EXPECTED_ENVIRONMENT\"" \
  || fail "config.json does not match the $EXPECTED_ENVIRONMENT environment"
ok "config.json for $EXPECTED_ENVIRONMENT"

echo "Successful deployment at $URL"
  • set -euo pipefail: the script stops at any error, undefined variable or failure in a pipeline. It exits with a non-zero code if anything fails, which will let us use it in 10-03 to halt an automated deployment.
  • Each check corresponds to a decision in this lesson: the fallback (2), the 404s for resources (2 and 6), caching (7), the maps (5 and 6), security (8) and the runtime configuration (9).
  • It does not sign in or go through the application: that is the job of the E2E tests. If you want to check something more in the real environment, you can run a Cypress test with baseUrl pointing to staging.

Make it executable (chmod +x scripts/check-deployment.sh) and try it against the local container:

scripts/check-deployment.sh http://localhost:8080 local

For colmena-web, it is enough to check that /, /rooms and /rooms/nectar respond 200, that /rooms/basement responds 404 (a real 404, thanks to SSR) and that /api/rooms returns JSON.

  1. Rollback

13.1 Going back to the previous version

However many tests there are, sooner or later a version will reach production with a serious bug. The question is not whether it will happen, but how long it takes to get back to a good version. With Docker images, the rollback means starting the previous image, which is still in the registry:

# Production was running v1.4.0 and it is failing: go back to v1.3.2
docker pull registry.colmena.example/colmena-bookings:v1.3.2
docker stop colmena-bookings && docker rm colmena-bookings
docker run -d --name colmena-bookings -p 8080:80 \
  -e ENVIRONMENT=production -e API_URL=https://api.colmena.example \
  registry.colmena.example/colmena-bookings:v1.3.2
scripts/check-deployment.sh https://bookings.colmena.example production

On the container platform, the equivalent is to specify the previous version; on Netlify or Vercel, to "publish" an earlier deployment again from their dashboard, instantly. To make sure rollback is always possible:

  • Tag each image with its version (v1.4.0) or its commit, never just with latest: "the previous one" must have a name.
  • Keep the images of the latest versions in the registry.
  • The environment variables do not change with the rollback: the runtime configuration belongs to the environment, not to the version.
  • Rehearse the rollback on staging from time to time. A procedure that has never been carried out is not a procedure.

13.2 What users notice

After the rollback, index.html (with no-cache) points to the v1.3.2 files again, and any new load works instantly. Anyone who had v1.4.0 open will request chunks that no longer exist and will run into the same case as in 09-05: the automatic reload will take them to v1.3.2. And since non-existent resources respond with a 404 (section 2), no browser will have stored HTML under the name of a v1.3.2 chunk that is now back.

13.3 Rolling back or rolling forward

Rolling back (rollback) Fixing forward (roll forward)
What it is Going back to the previous version Publishing a new version with the fix
Speed Seconds or minutes However long it takes to write, test and deploy the fix
When A serious bug in production, an unknown cause or a fix that is not immediate A minor bug with a clear fix, or when going back is not possible (for example, because the API has already changed and the previous version is not compatible)

The rule of thumb: if the bug prevents people from using the application, roll back first and investigate calmly afterwards. For a front end, rolling back is almost always possible; the exception is changes coordinated with the API, which must be designed so that the previous version of the front end keeps working with the new API for a while.

  1. Try it

  1. The problem. Build Colmena (npm run build) and serve it with a file server without a fallback, such as the one included with Python: python3 -m http.server -d dist 8000. Open http://localhost:8000, navigate to a room using the links (it works) and reload: 404. It is the problem from 04-01, live.
  2. The container. If you have Docker, build the image and start it with ENVIRONMENT=local (section 5). Navigate, and reload on /rooms/nectar and on /dashboard/bookings (after signing in): it works. The header shows "Environment: local".
  3. No variables. Start the container without -e ENVIRONMENT=...: it does not start, and docker logs shows the set -u error.
  4. Headers. With curl -sI http://localhost:8080/ and curl -sI http://localhost:8080/assets/index-*.js (copy the real name from dist/index.html), compare Cache-Control and check that the security headers are on both responses. Do the same with curl -sI -H 'Accept-Encoding: gzip' ...: Content-Encoding: gzip appears.
  5. The add_header trap. Temporarily add add_header Cache-Control "public, max-age=31536000, immutable"; inside location /assets/, rebuild and repeat step 4: the resources have lost all their security headers. Remove it.
  6. The CSP in action. In the browser console, with the container's application open, run document.body.insertAdjacentHTML('beforeend', '<img src=x onerror="alert(1)">'): the console shows the CSP violation and no alert appears.
  7. Runtime configuration. Stop the container and start it with -e ENVIRONMENT=staging -e API_URL=https://api.staging.colmena.example: the same image now shows "Environment: staging". Open http://localhost:8080/config.json.
  8. The check. Run scripts/check-deployment.sh http://localhost:8080 staging: everything "OK". Run it with production as the second argument: it fails at check 6.
  9. A deployment with users online. With the application open on the home page, change a text in RoomsView.vue, rebuild the image with a different tag and replace the container. Without reloading, click "Rooms": the page reloads on its own with the new text.
  10. colmena-web. Build and start its image (section 11) and check /rooms and /rooms/basement with curl -I.

Common Mistakes and Tips

  • Publishing with createWebHistory without a fallback. Everything works until someone reloads or shares a link. Always check a reload on an internal route after deploying.
  • Applying the fallback to resources too. A non-existent /assets/*.js must give a 404, never index.html, and still less with immutable caching.
  • Putting add_header inside an nginx location and silently losing the server headers. Declare them in a single place.
  • Caching index.html with a long max-age: users do not see new versions, or they load a version whose chunks no longer exist.
  • Confusing no-cache with no-store. The first revalidates; the second does not store.
  • Building once per environment and publishing to production something nobody has tested. Build once and configure at deployment time.
  • Treating config.json as a safe place. It is public, just like the JavaScript.
  • Copying .env.local into the image for lack of a .dockerignore.
  • Enabling HSTS with includeSubDomains and a one-year max-age without having checked all the subdomains.
  • Adding 'unsafe-inline' or 'unsafe-eval' to script-src to "fix" the CSP. Find out what is being blocked and why.
  • Deploying latest. Without a named version, there is no previous version to go back to.
  • Tip: vite preview supports the preview.headers option in vite.config.js. You can copy the CSP there to detect violations locally before building the image.

Exercises

Exercise 1. The demo version from exercise 2 of 10-01 is going to be published on GitHub Pages, at https://colmena-demo.github.io/colmena-bookings/. Write the build:pages script that builds in demo mode with the correct base and applies the 404.html trick, and explain: (a) which parts of Colmena adapt to the base on their own and which ones we reviewed in 10-01; (b) what will happen with loadEnvironment() there; (c) what HTTP status anyone who opens /colmena-bookings/rooms/nectar directly will receive, and why that is acceptable for a demo.

Exercise 2. One of Colmena's clients wants to host a copy of Colmena Bookings on their shared hosting with Apache, inside the /bookings/ folder of their domain. Explain how to build it and adapt the .htaccess from section 3.4 (which will be uploaded to that folder together with the rest of dist/). Then explain what would happen with a request to /bookings/assets/index-CvOePk43.js (which exists), to /bookings/assets/RoomsView-9f8e.js (which does not exist) and to /bookings/dashboard/bookings, following the order in which Apache evaluates the rules.

Exercise 3. The team wants to be able to switch a scheduled maintenance notice in the header on or off from the runtime configuration ("Bookings will be unavailable on Saturday from 8:00 to 10:00"), without publishing a new version. Extend config.json, the startup script, src/environment.js and AppHeader to support an optional maintenanceNotice text. What care must be taken when rendering it, bearing in mind the CSP and 06-01?

Solutions

Solution 1.

"build:pages": "vite build --mode demo --base /colmena-bookings/ --outDir dist-pages && cp dist-pages/index.html dist-pages/404.html"

(And dist-pages in .gitignore.)

  • (a) index.html, the chunks, the imported resources and the router (createWebHistory(import.meta.env.BASE_URL)) adapt on their own. In 10-01 we reviewed the photos from public/ in RoomCard (with BASE_URL) and the reload after a deployment in errors.js (with router.resolve(destination).href).
  • (b) loadEnvironment() will request /colmena-bookings/config.json (it uses BASE_URL). It does not exist, so GitHub Pages will respond with the 404.html and a 404 status: response.ok is false, the function catches the error and the build-time values from .env.demo remain, so the badge will show "demo". The console.warn message will not even appear, because demo mode removes the console.* calls (10-01). A config.json could be added to public/ to avoid the request, but it would add nothing.
  • (c) They will receive the content of 404.html (the application) with a 404 status. The browser runs the application anyway and Vue Router renders the room's spec sheet. It is acceptable because the demo does not need to appear in search engines or have HTTP error monitoring; in production it would not be.

Solution 2.

The build needs the folder's base (10-01, section 7): npx vite build --base /bookings/. And the .htaccess:

# .htaccess in the hosting's /bookings/ folder
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /bookings/
  RewriteRule ^index\.html$ - [L]

  # Hashed resources that do NOT exist: 404
  RewriteCond %{REQUEST_URI} ^/bookings/assets/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ - [R=404,L]

  # SPA routes (neither file nor directory): index.html
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /bookings/index.html [L]
</IfModule>
  • RewriteBase /bookings/ and the /bookings/index.html target point to the application's folder.
  • %{REQUEST_URI} contains the full requested path, including the folder: that is why the condition is ^/bookings/assets/. In an .htaccess, on the other hand, the RewriteRule pattern is compared with the path relative to the folder, which is why ^index\.html$ does not change.

Apache goes through the rules in order; the conditions only apply to the rule that follows them and are combined with "and" (unless [OR] is used); [L] stops processing if the rule applies:

  • /bookings/assets/index-CvOePk43.js: it is not index.html; it matches ^/bookings/assets/ but not !-f (the file exists), so the 404 rule does not apply; in the last rule, it does not match !-f either. No rule rewrites it and Apache serves the file.
  • /bookings/assets/RoomsView-9f8e.js: it meets both conditions of the second rule: 404 and done.
  • /bookings/dashboard/bookings: it does not match ^/bookings/assets/; in the last rule it is neither a file nor a directory, so it is rewritten to /bookings/index.html, and Vue Router (with createWebHistory(import.meta.env.BASE_URL)) renders the bookings screen.

Solution 3.

# nginx/40-colmena-config.sh: the notice is optional (empty value if it is not defined)
cat > /usr/share/nginx/html/config.json <<EOF
{
  "name": "${ENVIRONMENT}",
  "apiUrl": "${API_URL}",
  "maintenanceNotice": "${MAINTENANCE_NOTICE:-}"
}
EOF
// src/environment.js: new key with a default value
export const environment = {
  name: import.meta.env.VITE_ENVIRONMENT ?? import.meta.env.MODE,
  apiUrl: import.meta.env.VITE_API_URL ?? '',
  maintenanceNotice: ''
}
<!-- AppHeader.vue -->
<p v-if="environment.maintenanceNotice" class="header__notice" role="status">
  {{ environment.maintenanceNotice }}
</p>
  • ${MAINTENANCE_NOTICE:-} is the shell syntax for "the variable's value, or empty if it does not exist": with set -u, without it the container would not start when there is no notice.
  • loadEnvironment does not change: it copies the known keys that are strings, and the new one is already known.
  • The care needed: render it with interpolation ({{ }}), never with v-html. The text comes from outside the code (a variable someone types into the platform) and, if it contained HTML, interpolation would display it as text. With v-html it would have to be sanitised with sanitizeHtml (06-01), and even then the CSP would block any style attributes or inline handlers it contained. Furthermore, the notice is a fixed text in a single language: if it had to be translated, config.json would have to include all three versions, or a code that the application translates with its message files.
  • Changing the notice requires restarting the container (the script runs on startup), but not building or publishing a new version.

Conclusion

Deploying an SPA means publishing static files with three server decisions: the fallback to index.html for HTML5-mode routes (with a 404 for missing resources), which you have configured for Netlify (_redirects or netlify.toml), Vercel (vercel.json), nginx (try_files), Apache (.htaccess) and GitHub Pages (base and the 404.html trick, or hash mode); caching (immutable for hashed resources, no-cache for index.html, no-store for config.json), which explains and contains the chunk loading failures from 09-05; and the security headers, with a CSP tuned to what Colmena uses and HTTPS terminated at the platform's proxy. Colmena Bookings is published as a multi-stage Docker image (Node to build, nginx to serve) with an nginx template and a startup script that generates config.json, so that a single build serves both staging and production, and what is tested is what gets published. colmena-web is published as a Node server (.output/server/index.mjs) in its own container, with nuxt generate and Nitro's presets as alternatives. And every deployment ends with scripts/check-deployment.sh, with rollback to a tagged image as the emergency plan.

But you have done all this by hand: running the tests, building, uploading the maps, building the image, starting it on staging, checking it, repeating it in production... Every manual step is an opportunity to skip one, to publish from the wrong branch or for the deployment to depend on one person's machine. In the next lesson we will automate the whole journey, from each proposed change to its publication, in Continuous Integration and Deployment (CI/CD).

New edition · October 2026

Vue.js Course

Module 1: Introduction to Vue.js

Module 2: Vue.js Basics

Module 3: Vue.js Components

Module 4: Vue Router

Module 5: State Management with Vuex and Pinia

Module 6: Vue.js Directives

Module 7: Vue.js Plugins

Module 8: Testing in Vue.js

Module 9: Advanced Vue.js Concepts

Module 10: Building and Deploying Vue.js Applications

Module 11: Real-World Vue.js Projects

© Copyright 2026. All rights reserved