A Cards against Humanity clone online game.
This project is divided into two primary sections:
client
: This is the frontend of the application powered by Next.js.server
: This is the backend of the application handling API and data-related operations.
Additionally, there's a types
folder which contains shared types and utilities that both the client
and server
might need access to.
Before starting, ensure you have the following installed:
-
Clone the Repository
Use the following command to clone the repository:
git clone https://github.com/IgorBayerl/CCC-Cards-Game.git
-
Install Dependencies
After cloning, navigate to the project directory and install the dependencies using pnpm:
pnpm install
-
Start the Development Servers
To start the development servers:
-
For both
client
andserver
:pnpm dev
-
For only the
server
:pnpm dev-server
-
For only the
client
:pnpm dev-client
-
To run the application in a development environment using Docker, follow these steps:
-
Ensure Docker is Installed
Before proceeding, make sure Docker is installed on your machine. You can download it from Docker's official website.
-
Start the Development Environment
Use the following command in the root of the project directory to start the development environment:
docker-compose -f docker-compose.yaml up --build
This command builds and starts both the
client
andserver
services as defined indocker-compose.yaml
. It mounts the source code into the container to enable live reloading, so any changes you make to the source code will automatically reflect in the running containers.
To run the application in a production environment using Docker, you will use a different Docker Compose file that is optimized for production:
-
Ensure Docker is Installed
If not already done, make sure Docker is installed on your machine.
-
Start the Production Environment
Use the following command in the root of the project directory to start the production environment:
docker-compose -f docker-compose.prod.yaml up --build
This command uses
docker-compose.prod.yaml
, which is configured to build and run theclient
andserver
using their respective production Dockerfiles (Dockerfile.prod
). Unlike the development environment, the production setup does not mount the source code into the container. Instead, it builds static assets and runs the optimized version of your application.
Note: It's important to ensure that your production Dockerfiles (Dockerfile.prod
for both client and server) are properly configured to build your application for production. This includes installing dependencies, building your Next.js application for the client, and setting up any necessary production configurations for your server.
- Docker Compose Files: The project includes two Docker Compose files:
docker-compose.yaml
for development.docker-compose.prod.yaml
for production.
- Live Reloading: In development, the application is set up to support live reloading. This means you can edit your code, and the changes will automatically reflect in the running containers without needing to rebuild them.
Happy coding!