🌍 ExpressJS · subject

ExpressJS Deploying ExpressJS Applications Syllabus

The Deploying ExpressJS Applications syllabus for ExpressJS in full: 4 chapters and 10 topics, every one listed below, plus 51 Deploying ExpressJS Applications flashcards with answers.

4Chapters
10Topics
51Flashcards

Deploying ExpressJS Applications syllabus: all 4 chapters

Expand any chapter to see its topics and sub-topics.

  1. Preparing for Deployment

    2 topics
    • Environment Variables
    • Configuring Production Settings
  2. Deployment Platforms

    3 topics
    • Deploying to Heroku
    • Deploying to AWS
    • Deploying to DigitalOcean
  3. CI/CD Pipelines

    2 topics
    • Setting Up GitHub Actions
    • Using Jenkins
  4. Monitoring and Maintenance

    3 topics
    • Logging
    • Health Checks
    • Scaling Applications

ExpressJS Deploying ExpressJS Applications flashcards — 51 questions with answers

  1. What is an environment variable in the context of an ExpressJS application?

    A key-value pair defined outside the application code (in the OS or process environment) that supplies configuration such as secrets, ports, and connection strings without hardcoding them into source files.

  2. In Node.js/Express, which object exposes all environment variables to your code?

    The global `process.env` object, e.g. `process.env.PORT` or `process.env.DATABASE_URL`.

  3. What is the conventional file used to store environment variables locally, and which package loads it?

    A `.env` file, loaded by the `dotenv` package via `require('dotenv').config()`, which populates `process.env`.

  4. Why should a `.env` file be added to `.gitignore`?

    Because it typically contains secrets (API keys, DB passwords, tokens); committing it exposes credentials in version control.

  5. How do you make an Express app read its listening port from the environment with a fallback?

    Use `const port = process.env.PORT || 3000;` so the platform-assigned port is used in production and 3000 in local dev.

  6. What is the standard environment variable used to indicate the runtime mode of an Express app, and its common production value?

    `NODE_ENV`, set to `production` in production (other common values are `development` and `test`).

  7. What performance and behavior changes occur in Express when `NODE_ENV` is set to `production`?

    Express caches view templates, caches CSS from extensions, generates less verbose error output, and many middleware/libraries enable optimizations, improving performance.

  8. What is the security risk of leaking stack traces in production error responses, and how does Express address it?

    Stack traces reveal internal paths and logic to attackers; when `NODE_ENV=production`, Express's default error handler omits the stack trace from the response body.

  9. In production Express configuration, why should you enable `app.set('trust proxy', ...)` behind a load balancer or reverse proxy?

    So Express correctly reads client info from `X-Forwarded-*` headers (real client IP, protocol), which is needed for secure cookies, rate limiting, and HTTPS detection.

  10. Which two popular middleware packages are commonly added to harden and compress a production Express app?

    `helmet` (sets secure HTTP headers) and `compression` (gzip/deflate compresses responses).

  11. What is a process manager, and name the most common one used to keep Express apps running in production.

    A tool that runs, monitors, auto-restarts, and load-balances Node processes; the most common is PM2 (with `pm2 start app.js` and cluster mode).

  12. What is Heroku in one sentence?

    A cloud Platform-as-a-Service (PaaS) that runs apps in managed containers called dynos, abstracting away server provisioning.

  13. What is a Procfile in a Heroku deployment and what does a typical Express entry look like?

    A text file at the project root declaring process types/commands; a typical web process line is `web: node index.js` (or `web: npm start`).

  14. How does Heroku assign the port your Express app must listen on?

    Heroku sets the `PORT` environment variable at runtime, so the app must use `process.env.PORT`; binding to a hardcoded port causes the app to fail to bind.

  15. What is the primary command used to deploy code to Heroku with Git?

    `git push heroku main` (or `git push heroku master`), which triggers a build and release of the app.

  16. How do you set an environment variable (config var) on Heroku from the CLI?

    `heroku config:set KEY=value`; you can view them with `heroku config` and remove with `heroku config:unset KEY`.

  17. How does Heroku know how to build a Node.js/Express app during deployment?

    It detects the `package.json` and applies the Node.js buildpack, running `npm install` and (if present) the `build`/`start` scripts.

  18. What is AWS Elastic Beanstalk and why is it convenient for deploying Express apps?

    A PaaS-like AWS service that automatically handles provisioning, load balancing, auto-scaling, and deployment of your app; you upload code and it manages the underlying EC2 infrastructure.

  19. Compare deploying an Express app on a raw AWS EC2 instance versus Elastic Beanstalk.

    EC2 gives full control but requires you to manually provision, configure OS, install Node, set up a reverse proxy, and manage scaling; Beanstalk automates provisioning, deployment, load balancing, and scaling with less control.

  20. What AWS service lets you run an Express app serverlessly, and what adapter is commonly used?

    AWS Lambda (behind API Gateway); the `serverless-http` package (or `@vendia/serverless-express`) wraps the Express app as a Lambda handler.

Show the other 31 Deploying ExpressJS Applications flashcards
  1. On a manually managed AWS EC2 Linux server, what reverse proxy is typically placed in front of an Express app and why?

    Nginx, to terminate TLS/HTTPS, serve static files, load-balance, and forward requests to the Node process on an internal port (e.g., proxy_pass to localhost:3000).

  2. What AWS service provides object storage often used to serve an Express app's static assets or user uploads?

    Amazon S3 (Simple Storage Service), frequently paired with the CloudFront CDN for global delivery.

  3. What is a DigitalOcean Droplet?

    A DigitalOcean virtual private server (VM) that you provision and manage yourself, on which you can install Node.js and run your Express app.

  4. What is the DigitalOcean App Platform, and how does it differ from a Droplet?

    A managed PaaS that builds and deploys your app directly from a Git repo with automatic scaling and TLS, whereas a Droplet is an unmanaged VM you must configure manually.

  5. On a DigitalOcean Droplet, what combination is commonly used to keep an Express app alive and publicly reachable over HTTPS?

    PM2 (or systemd) to run/restart the Node process plus Nginx as a reverse proxy, with a free TLS certificate from Let's Encrypt (Certbot).

  6. What is CI/CD an abbreviation for, and what does each part mean?

    Continuous Integration (automatically building and testing code on each change) and Continuous Delivery/Deployment (automatically releasing that code to staging/production).

  7. What is GitHub Actions?

    GitHub's built-in CI/CD platform that runs automated workflows (build, test, deploy) in response to repository events like pushes and pull requests.

  8. Where must GitHub Actions workflow files be located and in what format?

    In the `.github/workflows/` directory of the repository, written as YAML files (e.g., `ci.yml`).

  9. In a GitHub Actions workflow, what is the purpose of the `on:` key?

    It defines the events that trigger the workflow, such as `push`, `pull_request`, `schedule`, or `workflow_dispatch`.

  10. What are the core structural units of a GitHub Actions workflow, from largest to smallest?

    Workflow → Jobs → Steps; jobs run on runners and contain steps, which are either shell commands (`run`) or reusable actions (`uses`).

  11. Which GitHub Actions action is commonly used to install a specific Node.js version in a workflow?

    `actions/setup-node@v4` (paired with `actions/checkout` to pull the repo), configured with a `node-version` input.

  12. How should secrets like deployment tokens be handled in a GitHub Actions workflow?

    Store them in repository/organization Secrets and reference them as `${{ secrets.NAME }}` in the workflow, never hardcoding them in the YAML.

  13. What is Jenkins?

    An open-source, self-hosted automation server used to build, test, and deploy software through configurable CI/CD pipelines, extensible via plugins.

  14. What file defines a Jenkins pipeline as code, and what are its two main syntaxes?

    A `Jenkinsfile` stored in the repo; its two syntaxes are Declarative Pipeline (structured, `pipeline { }`) and Scripted Pipeline (Groovy-based).

  15. In a Declarative Jenkins pipeline, what is a `stage` and what is an `agent`?

    A `stage` is a named phase of the pipeline (e.g., Build, Test, Deploy) containing steps; an `agent` specifies where/how the pipeline or stage executes (e.g., a node or Docker container).

  16. Contrast Jenkins with GitHub Actions for CI/CD.

    Jenkins is self-hosted (you maintain the server and plugins) offering deep control; GitHub Actions is cloud-hosted and tightly integrated with GitHub with minimal maintenance but less infrastructure control.

  17. What is application logging and why is it essential in a production Express app?

    Recording runtime events, requests, and errors to a durable output; it's essential for debugging, monitoring, auditing, and diagnosing incidents you cannot reproduce interactively.

  18. What is Morgan in the Express ecosystem?

    An HTTP request logging middleware for Express that logs incoming requests in configurable formats such as `combined`, `common`, `dev`, or `tiny`.

  19. Name two dedicated structured-logging libraries commonly used in Node/Express instead of `console.log`.

    Winston and Pino; they support log levels, structured/JSON output, and multiple transports (console, file, external services).

  20. List common log severity levels from most to least severe used by loggers like Winston.

    error, warn, info, http/verbose, debug, silly (roughly: error > warn > info > debug > trace), letting you filter output by importance.

  21. Why is structured (JSON) logging preferred over plain-text logs in production?

    JSON logs are machine-parseable, enabling aggregation, searching, filtering, and analysis by log-management tools (e.g., ELK, Datadog, CloudWatch).

  22. In a containerized/PaaS deployment, why is logging to stdout/stderr preferred over writing to local files?

    Because the platform captures stdout/stderr and forwards it to a centralized log system; local files are ephemeral and lost when the container/dyno restarts.

  23. What is a health check endpoint in an Express app?

    A lightweight route (commonly `/health` or `/healthz`) that returns a success status (e.g., HTTP 200) so load balancers and orchestrators can verify the app is alive and ready.

  24. Distinguish a liveness probe from a readiness probe.

    A liveness probe checks whether the process is alive (restart it if not); a readiness probe checks whether the app is ready to receive traffic (e.g., DB connected) and removes it from the load balancer until ready.

  25. What HTTP status code should a healthy health check return, and what indicates unhealthy?

    Healthy returns `200 OK` (sometimes `204`); unhealthy typically returns `503 Service Unavailable` so the orchestrator marks the instance as failing.

  26. What should a thorough (deep) health check verify beyond the process being up?

    Critical dependencies such as database connectivity, cache/Redis availability, and required downstream services, returning unhealthy if any essential dependency is down.

  27. What is the difference between vertical scaling and horizontal scaling?

    Vertical scaling (scaling up) adds more resources (CPU/RAM) to a single machine; horizontal scaling (scaling out) adds more instances/machines and distributes load across them.

  28. Why can a single Node.js/Express process not utilize multiple CPU cores, and how is this overcome?

    Node runs JavaScript on a single thread, so one process uses one core; the cluster module (or PM2 cluster mode) forks multiple worker processes to use all cores.

  29. For horizontal scaling of Express across many instances, why must session state not be stored in process memory?

    Because requests may hit different instances; in-memory sessions won't be shared, so state must be externalized to a shared store like Redis or a database (making the app stateless).

  30. What is a load balancer's role when scaling an Express application horizontally?

    It distributes incoming requests across multiple app instances (using algorithms like round-robin or least-connections), improving throughput and providing redundancy if an instance fails.

  31. What is autoscaling and what metrics commonly trigger it for an Express deployment?

    Automatically adding or removing instances based on load; common triggers are CPU utilization, memory usage, request rate, or response latency crossing configured thresholds.

ExpressJS Deploying ExpressJS Applications FAQ

What is in the ExpressJS Deploying ExpressJS Applications syllabus?

ExpressJS Deploying ExpressJS Applications is split into 4 chapters: Preparing for Deployment, Deployment Platforms, CI/CD Pipelines and Monitoring and Maintenance. Together they contain 10 topics.

How many chapters are in ExpressJS Deploying ExpressJS Applications?

4 chapters, containing 10 topics. The largest chapter is Deployment Platforms, with 3 topics.

Are there flashcards for ExpressJS Deploying ExpressJS Applications?

Yes — a 51-card Deploying ExpressJS Applications deck, printed in full in the flashcards section of this page and available in the Examius app with spaced repetition. The free plan covers one exam of your choice, including its flashcards; Examius Pro, a one-time purchase, unlocks every other exam and deck.