This project demonstrates the iterative development, continuous refactoring, and DevOps practices through a simple showdown card game. By combining Object-Oriented Analysis, Design, Programming (OOADP), unit tests, and refactoring with modern development tools (e.g. Docker and Vagrant) and CI/CD pipelines, it serves as a hands-on example of how to build scalable and maintainable software for real-world applications.
The project emphasizes
-
Iterative Development and Continuous Refactoring:
-
Following a structured cycle to continuously refine design and implementation:
OOA -> OOD -> OOP -> Unit tests -> Refactoring
-
-
DevOps and CI/CD pipelines:
- Leveraging GitHub Actions workflows to implement Continuous Integration (CI) and Continuous Delivery (CD) pipelines, enabling automated testing, integration, and deployment.
- These practices ensure high code quality, early detection of bugs, and consistency across all stages of development and delivery.
- Supports multi-architecture compatibility (including amd64 and arm64) in the delivery artifacts.
-
Practical Development Environment:
- Leveraging modern tools like Docker and Vagrant to setup a realistic and efficient Node.js development environment.
- Supports multi-architecture platforms (including amd64 and arm64) for broad compatibility.
Contents [↑]
- Contents [↑]
- Tech Stack [↑]
- Project Objective [↑]
- Prerequisites [↑]
- Design Documentation [↑]
- DevOps and CI/CD pipelines [↑]
- Quick Start [↑]
- Development Environment [↑]
- Development Commands [↑]
- License
Tech Stack [↑]
- Programming Language: TypeScript (Node.js)
- Development Tools: Docker, Vagrant
- DevOps Tools: GitHub Actions
- Architecture: Multi-architecture support (amd64, arm64)
- Version Control: Git
Project Objective [↑]
- To demonstrate the OOA -> OOD -> OOP -> Unit tests -> Refactoring process.
- To illustrate the basics of software design and development cycles.
- To highlight the importance of DevOps practices by:
- Building, testing, and delivering the project using CI/CD pipelines powered by GitHub Actions.
- Automating delivery workflows to improve efficiency, reduce manual errors, and ensure code quality through rigorous automated processes.
- Generating multi-architecture artifacts/images (e.g., amd64, arm64) to ensure compatibility across diverse platforms.
- Offers hands-on practice with modern development tools:
- Docker and Vagrant for consistent and scalable environment setup across different platforms (e.g., amd64, arm64).
- GitHub Actions for implementing robust DevOps pipelines.
Prerequisites [↑]
Before starting, ensure you have at least one of the following installed:
NOTE:
The following versions are based on my tested environment. Lower versions may work but are not guaranteed.
- Local development environment:
- Node.js (>=18.x)
- Docker development environment:
- Docker (>=24.x)
- Vagrant development environment:
- VirtualBox (>=7.1)
- Vagrant (>=2.4)
Design Documentation [↑]
The design documents for this project can be found in the following files located in the docs/designs
directory:
These designs outline the conceptual and logical structures of the game, following the OOADP process.
DevOps and CI/CD pipelines [↑]
This section highlights the implementation of modern DevOps practices, focusing on the automation of testing, building, and delivery through CI/CD pipelines. These workflows ensure high efficiency, consistency, and reliability in the development lifecycle.
The CI/CD flowcharts can be found in the following files located in the docs/devops
directory:
Quick Start [↑]
You can run the game locally, via Docker, or via Node.js and Docker.
-
If you have local node.js installed, you can run the game by running the following commands:
npm install npm run start:dev
-
If you have Docker installed, you can choose to run the pre-built image or build the image locally:
-
Run the pre-built image (supports amd64 and arm64 platforms):
docker container run --name showdown-card-game --rm -it wshih/ooadp-showdown-game:latest
-
Build the image tailored to your platform and run it:
docker build -t showdown-card-game:latest . docker container run --name showdown-card-game --rm -it ooadp-showdown-game:latest
-
-
If you have local node.js and Docker installed, you can run the game by running the following commands:
npm install npm run start:container
Development Environment [↑]
This project supports three development setups:
- Requires Node.js (>=18.x).
-
Requires Docker (>=24.x).
-
Supports multi-architecture platforms, including amd64, arm64, etc., based on the base image.
-
To set up the containerized development environment:
docker-compose -f _dev-env/docker/docker-compose.dev-env.yml up -d docker container exec -it <container_id or container_name> bash npm install
-
Clean up and remove the Docker development environment by running the following commands:
docker-compose -f _dev-env/docker/docker-compose.dev-env.yml down
Then, remove the corresponding container and image.
-
Requires VirtualBox (>=7.1) and Vagrant (>=2.4).
-
Supports both amd64 and arm64 platforms, ensuring compatibility across different hardware architectures.
-
To start the virtual machine for development:
cd _dev-env/vagrant vagrant up vagrant ssh npm install
-
Clean up and remove the Vagrant development environment by running the following commands:
cd _dev-env/vagrant vagrant destroy
Development Commands [↑]
-
Run the unit tests with coverage by running the following commands:
npm run test:coverage
-
Run the lint by running the following commands:
npm run lint
-
Clean up the environment (
node_modules
,dist
,coverage
) by running the following commands:npm run clean
- See more commands in the
package.json
file.
This project is licensed under the MIT License. See the LICENSE file for details.