This repository is a learning project to understand how to set up a frontend and backend application using Docker Compose. The applications are simple and serve as a dummy app to focus on the Docker Compose setup.
.
├── be/ # Backend directory
│ ├── .dockerignore
│ ├── .vscode/
│ │ └── settings.json
│ ├── deno.json
│ ├── deno.lock
│ ├── Dockerfile
│ ├── run-container.bash
│ └── src/
│ └── main.ts
├── fe/ # Frontend directory
│ ├── .dockerignore
│ ├── Dockerfile
│ ├── eslint.config.js
│ ├── index.html
│ ├── nginx.conf
│ ├── package.json
│ ├── public/
│ ├── README.md
│ ├── run-container.bash
│ ├── src/
│ │ ├── App.css
│ │ ├── App.tsx
│ │ ├── assets/
│ │ ├── index.css
│ │ ├── main.tsx
│ │ └── vite-env.d.ts
│ ├── tsconfig.app.json
│ ├── tsconfig.json
│ ├── tsconfig.node.json
│ └── vite.config.ts
├── compose.yml # Docker Compose file
├── rebuild.sh # Script to rebuild the Docker containers
└── .gitignore
The backend is a simple Deno application using the Hono framework. It provides two endpoints:
POST /api/db/increment
: Increments a counter.GET /api/db
: Retrieves the current counter value.
- Navigate to the
be
directory. - Run the following script to build and run the backend container:
./run-container.bash
The frontend is a React application built with Vite. It interacts with the backend to display and increment a counter.
- Navigate to the
fe
directory. - Run the following script to build and run the frontend container:
./run-container.bash
The compose.yml
file sets up both the frontend and backend services. The frontend service depends on the backend service.
- Run the following script to rebuild and start the Docker containers:
./rebuild.sh
- The frontend application is served using Nginx.
- The backend application is served using a compiled Deno binary.
- The frontend application proxies API requests to the backend.