Skip to content

Fcstro/Colored-Lotto

Repository files navigation

Vite + Express + WebSocket Example

This project demonstrates a setup using Vite for the frontend, Express for the backend, and WebSocket for real-time communication.

Features

  • Vite for fast frontend development
  • Express for backend server
  • Socket.IO for WebSocket communication
  • ESLint for code linting
  • Hot Module Replacement (HMR) for fast development

Getting Started

Prerequisites

  • Node.js (>= 14.x)
  • npm or yarn

Installation

  1. Clone the repository:

    git clone https://github.com/Fcstro/ColoredLotto.git
    cd ColoredLotto
  2. Install dependencies:

    npm install
    # or
    yarn install

Running the Development Server

  1. Start the development server:

    npm run dev
    # or
    yarn dev
  2. Open your browser and navigate to http://localhost:3000.

Building for Production

  1. Build the project:

    npm run build
    # or
    yarn build
  2. Start the production server:

    npm run start
    # or
    yarn start

Game Mechanics

This project includes a simple game where players roll cubes and receive results in real-time. The game mechanics are as follows:

  1. Countdown Timer: A countdown timer starts from 10 seconds. When the timer reaches zero, the cubes are rolled.
  2. Cube Roll: The server rolls the cubes and sends the result to all connected clients.
  3. Real-Time Updates: The countdown timer and cube roll results are sent to clients in real-time using WebSocket events.

Betting and Winning Mechanics

  1. Placing Bets: Players can place bets on the outcome of the cube roll before the countdown timer reaches zero.
  2. Winning Conditions: Players win if their bet matches the result of the cube roll.
  3. Payouts: The server calculates and distributes payouts to the winning players based on the odds and the amount bet.

Expanding the ESLint Configuration

If you are developing a production application, we recommend using TypeScript and enabling type-aware lint rules. Check out the TS template to integrate TypeScript and typescript-eslint in your project.

License

This project is licensed under the MIT License.

Developers

  • Fredderico Castro
  • Bj Ashley Mercado

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors