---
title: "Discussion on \"How to use Docker Compose to Build and Run a Node.js and React Web Application\" | Hashnode"
description: "Discussion on \"How to use Docker Compose to Build and Run a Node.js and React Web Application\". Docker is a powerful tool that allows you to create, deploy, and run applications using containers. Containers are isolated environments that contain everything your application needs to run, such as code, libraries, and configuration files. Containe..."
url: "https://hashnode.com/posts/how-to-use-docker-compose-to-build-and-run-a-nodejs-and-react-web-application/6579b22a059bf26fc63158a5"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to use Docker Compose to Build and Run a Node.js and React Web Application](https://kafilatadeleke.hashnode.dev/how-to-use-docker-compose-to-build-and-run-a-nodejs-and-react-web-application?utm_source=hashnode&utm_medium=feed)

Docker is a powerful tool that allows you to create, deploy, and run applications using containers. Containers are isolated environments that contain everything your application needs to run, such as code, libraries, and configuration files. Containe...

Oct 30, 2023 · 7 min read · kafilatadeleke.hashnode.dev  
Updated Jan 6, 2024  
Read the article

-   [#devops](https://hashnode.com/tag/devops)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#nodejs](https://hashnode.com/tag/nodejs)
-   [#docker](https://hashnode.com/tag/docker)
-   [#containers](https://hashnode.com/tag/containers)

## Written by

[Kafilat Adeleke](https://hashnode.com/@KafilatAdeleke)

@KafilatAdeleke · Nigeria

  
[View profile](https://hashnode.com/@KafilatAdeleke)

Software Developer

## Responses 1

Markdown supported · ⌘↵ to post

[Node Edge Ops](https://hashnode.com/@nodeedgeops)

[Nov 5](https://hashnode.com/posts/how-to-use-docker-compose-to-build-and-run-a-nodejs-and-react-web-application/6579b22a059bf26fc63158a5/comment/6aebf1e218d5d4efb9c53d91)

For a Compose stack with a Node API and a React front, the production habits that save the most time are: one reverse proxy as the only public listener, app and data services on an internal network only, and upstreams resolved by service name rather than host-published ports. Publishing the Node or database port on the host can bypass ufw and widen the attack surface. Pin proxy\_http\_version 1.1 with Connection cleared for keepalive into Node, and forward Host plus X-Forwarded-For / X-Forwarded-Proto so the API sees the public scheme for absolute URLs and cookies.

Path joining and stale DNS still cause most post-redeploy 502s: a trailing-slash mismatch between location and proxy\_pass doubles or strips a prefix, and a long-lived proxy worker can keep a dead task IP after recreate unless you use a variable-plus-resolver pattern or recreate the proxy on deploy. After compose up I hit the Node service name from the proxy container first, then the same path through published 80/443, and compare status and timing. Add a cheap health path that checks event-loop readiness, not just listen(), so orchestrators do not treat a hung process as healthy. Leave Postgres and Redis unpublished.
