Skip to content
Dan Donahoe edited this page Aug 26, 2024 · 1 revision

= Welcome to Crude Cards =

== Introduction == Welcome to the Crude Cards Wiki! This guide provides documentation for our real-time card game project built using modern web technologies like React, Next.js, and NestJS. Whether you're a developer, designer, or curious user, you'll find helpful information here.


== Key Features == - Real-Time Gameplay: Supports multiplayer with WebSocket integration. - Cross-Platform Support: Play on desktop or mobile seamlessly. - Customizable Game Rules: Modify the rules to fit your party’s style. - Educational Purpose: Learn full-stack development with fun examples.


== Project Structure ==

The project is organized into the following directories:

+--- /backend | +--- /controllers | +--- /models | +--- /services +--- /frontend | +--- /components | +--- /pages | +--- /styles +--- /shared

+--- /constants +--- /utils

Each directory serves a specific purpose in the overall architecture. Detailed information is available in their respective sections.


== Getting Started ==

=== Installation Steps ===

To set up the project locally, follow these steps:

1. Clone the repository: [source,bash] ---- git clone https://github.com/ConstructWorks/cards.git ---- 2. Navigate to the project directory: [source,bash] ---- cd cards ---- 3. Install the required dependencies: [source,bash] ---- pnpm install ---- 4. Run the development server: [source,bash] ---- pnpm dev ----

Visit http://localhost:3000 to view the game in your browser.


== Game Rules ==

Setup: - Players join a game session via a room code. - A "Dealer" is selected for each round.

Gameplay: - The Dealer plays a black card with a prompt. - The other players choose the funniest white card from their hand. - The Dealer selects the winning card.

Winning: - Points are awarded to the player whose card is chosen. - The first player to reach the predefined number of points wins.


== Technical Stack ==

[cols="3,3,6", options="header"] |=== | Layer | Technology | Purpose

Frontend
React
User Interface (UI) development and rendering

Next.js
Server-side rendering and routing

Mantine
UI components and styling
Backend
NestJS
Backend framework

TypeORM
Database ORM

Socket.io
Real-time communication
Infrastructure
GCP
Cloud hosting and deployment

Docker
Containerization

Terraform
Infrastructure as Code (IaC)
Testing
Jest
Unit and integration testing

Testing Library
UI testing

|===

== Code Example: WebSocket Integration ==

Here’s a sample WebSocket integration using Socket.io:

[source,javascript]

import { Server } from 'socket.io';

const io = new Server(server, {
cors: {
origin: '*',

}

});

io.on('connection', (socket) => {

console.log('A user connected');

socket.on('joinRoom', (roomCode) => {
socket.join(roomCode); console.log(User joined room: ${roomCode});

});

socket.on('sendMessage', (message) => {
io.to(message.room).emit('receiveMessage', message);

});

socket.on('disconnect', () => {
console.log('A user disconnected');

});

});

export default io;


== Frequently Asked Questions ==

Q1: How do I customize the game rules?

You can modify the rule settings in the /shared/constants/game-rules.js file.

Q2: Is this project mobile-friendly?

Yes, the game is fully responsive and works seamlessly across different devices.

Q3: How can I contribute to this project?

Feel free to fork the repository, create a feature branch, and submit a pull request.


== Contribution Guidelines ==

We welcome contributions! Please follow these steps:

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feature/new-feature.
  3. Commit your changes: git commit -m 'Add new feature'.
  4. Push to the branch: git push origin feature/new-feature.
  5. Submit a pull request.

== Useful Links ==


== License ==

This project is licensed under...

Clone this wiki locally