Skip to content

nahom4/pocker_game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

37 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Simplified Poker Game

β–Ά Live demo

This project is a Simplified Poker Game built with Next.js (TypeScript) for the frontend and FastAPI (Python) for the backend. It simulates a poker environment with basic poker actions and multiple game rounds.

πŸš€ Features

  • Multiplayer poker game simulation
  • Poker Actions: Bet, Call, Fold, Raise, Check, Allin
  • Game Rounds: Pre-Flop, Flop, Turn, River, Showdown
  • State Management: Zustand for frontend state
  • RESTful API: FastAPI backend with clean architecture
  • Real-time Updates: Live game state synchronization
  • Responsive Design: Mobile-friendly interface

πŸ—οΈ Architecture

The project follows a clean architecture pattern with:

  • Backend: FastAPI with layered architecture (Controllers, Services, Repositories)
  • Frontend: Next.js 14 with App Router and TypeScript
  • Database: SQLite (development) with SQLAlchemy ORM
  • Testing: Comprehensive test suites for both backend and frontend

πŸ“ Project Structure

pocker_game/
β”œβ”€β”€ backend/                 # FastAPI backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ controllers/    # API endpoints
β”‚   β”‚   β”œβ”€β”€ services/       # Business logic
β”‚   β”‚   β”œβ”€β”€ models/         # Data models
β”‚   β”‚   β”œβ”€β”€ repositories/   # Data access layer
β”‚   β”‚   └── infrastructure/ # External services
β”‚   β”œβ”€β”€ tests/              # Backend tests
β”‚   β”œβ”€β”€ Dockerfile          # Backend container
β”‚   β”œβ”€β”€ pyproject.toml      # Python dependencies
β”‚   └── README.md          # Backend documentation
β”œβ”€β”€ frontend/               # Next.js frontend
β”‚   β”œβ”€β”€ app/               # Next.js app directory
β”‚   β”œβ”€β”€ components/        # Reusable components
β”‚   β”œβ”€β”€ e2e/              # End-to-end tests
β”‚   β”œβ”€β”€ Dockerfile         # Frontend container
β”‚   └── package.json       # Node.js dependencies
β”œβ”€β”€ docker-compose.yml     # Multi-container setup
└── README.md             # This file

πŸ› οΈ Tech Stack

Backend

  • FastAPI - Modern, fast web framework for Python
  • Pydantic - Data validation and serialization
  • SQLAlchemy - SQL toolkit and ORM
  • Poetry - Python dependency management
  • Pytest - Testing framework

Frontend

  • Next.js 14 - React framework with App Router
  • TypeScript - Type-safe JavaScript
  • Tailwind CSS - Utility-first CSS framework
  • Zustand - State management
  • Playwright - End-to-end testing

🚦 Getting Started

Prerequisites

Quick Start with Docker

  1. Clone the repository:

    git clone https://github.com/nahom4/pocker_game.git
    cd pocker_game
  2. Build and run all services:

    docker-compose up --build
  3. Access the application:

Local Development

Backend Development

cd backend
poetry install
poetry run uvicorn main:app --reload --host 0.0.0.0 --port 8000

Frontend Development

cd frontend
npm install
npm run dev

πŸ§ͺ Testing

Backend Tests

cd backend
poetry run pytest

Frontend Tests

cd frontend
npm run test
npm run test:e2e

🎯 Game Rules

The application implements standard Texas Hold'em rules:

  • Each player receives 2 hole cards
  • 5 community cards dealt in 3 stages: Flop (3 cards), Turn (1 card), River (1 card)
  • Players make the best 5-card hand using any combination of their 2 hole cards and 5 community cards
  • Standard poker hand rankings apply (Royal Flush, Straight Flush, etc.)

πŸ”§ Configuration

Environment Variables

Backend (.env)

DATABASE_URL=sqlite:///./poker.db
SECRET_KEY=your-secret-key
DEBUG=True

Frontend (.env.local)

NEXT_PUBLIC_API_URL=http://localhost:7995

πŸš€ Deployment

Production Deployment

  1. Set production environment variables
  2. Build and run with Docker Compose:
docker-compose -f docker-compose.prod.yml up -d

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (di"so "git checkout -b feature/amazing-feature")
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors