{"id":26273065,"url":"https://github.com/gearbeagel/fepsino","last_synced_at":"2026-05-03T01:39:15.260Z","repository":{"id":281521034,"uuid":"941170059","full_name":"gearbeagel/FEPsino","owner":"gearbeagel","description":"Group project, that is a casino.","archived":false,"fork":false,"pushed_at":"2025-05-17T11:06:44.000Z","size":371,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-10T04:34:09.905Z","etag":null,"topics":["django-rest-framework","docker","postgresql","react"],"latest_commit_sha":null,"homepage":"https://fepsino.vercel.app","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gearbeagel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-01T16:53:20.000Z","updated_at":"2025-05-17T11:06:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"32d5ffe4-4648-4f64-b295-f437af33c2bd","html_url":"https://github.com/gearbeagel/FEPsino","commit_stats":null,"previous_names":["gearbeagel/fepsino"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gearbeagel/FEPsino","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gearbeagel%2FFEPsino","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gearbeagel%2FFEPsino/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gearbeagel%2FFEPsino/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gearbeagel%2FFEPsino/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gearbeagel","download_url":"https://codeload.github.com/gearbeagel/FEPsino/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gearbeagel%2FFEPsino/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002673,"owners_count":26083442,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django-rest-framework","docker","postgresql","react"],"created_at":"2025-03-14T08:14:51.055Z","updated_at":"2025-10-10T04:34:10.858Z","avatar_url":"https://github.com/gearbeagel.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align='center'\u003eFEPsino\u003c/h1\u003e \n\n\u003cp align='center'\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Python-3.12-blue?style=for-the-badge\u0026logo=python\" alt=\"Python\"/\u003e\n  \u003cimg src=\"https://img.shields.io/badge/DJANGO-REST-ff1709?style=for-the-badge\u0026logo=django\u0026logoColor=white\u0026color=ff1709\u0026labelColor=gray\" alt=\"Django REST\"/\u003e\n  \u003cimg src=\"https://img.shields.io/badge/react-%2320232a.svg?style=for-the-badge\u0026logo=react\u0026logoColor=%2361DAFB\" alt=\"React\"/\u003e\n  \u003cimg src=\"https://img.shields.io/badge/tailwindcss-%2338B2AC.svg?style=for-the-badge\u0026logo=tailwind-css\u0026logoColor=white\" alt=\"TailwindCSS\"/\u003e\n  \u003cimg src=\"https://img.shields.io/badge/postgres-%23316192.svg?style=for-the-badge\u0026logo=postgresql\u0026logoColor=white\" alt=\"PostgreSQL\"/\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Docker-blue?style=for-the-badge\u0026logo=docker\u0026logoColor=white\" alt=\"Docker\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/SonarQube-black?style=for-the-badge\u0026logo=sonarqube\u0026logoColor=4E9BCD\" alt=\"Sonarqube\"/\u003e\n\u003c/p\u003e\n\n---\n\n## Table of Contents\n- [Overview](#overview)\n- [Components](#components)\n- [Architecture](#architecture)\n  - [Architecture Diagram](#architecture-diagram)\n  - [Architecture Characteristics](#architecture-characteristics)\n- [Getting Started](#getting-started)\n- [SonarQube Integration](#sonarqube-integration)\n- [Environment Configuration](#environment-configuration)\n- [Usage](#usage)\n- [Development](#development)\n\n---\n\n## Overview\n\nFEPsino is a comprehensive online casino platform that offers multiple games including BlackJack, Slots, and Dice. The project is built as a modern web application with a focus on scalability, maintainability, and user experience.\n\nKey features:\n- Multiple casino games with realistic gameplay\n- User account management with balance tracking\n- Responsive design for desktop and mobile devices\n- Fully containerized architecture for easy deployment\n- Integrated code quality analysis\n\nThe application leverages modern technologies such as Django REST Framework for the backend API, React for the frontend UI, PostgreSQL for data persistence, and Docker for containerization. SonarQube is integrated for continuous code quality monitoring.\n\n---\n\n## Components\n\nFEPsino consists of several key components:\n\n### Backend Components\n- **Core**: Central configuration and settings for the Django application\n- **User**: User authentication, registration, and profile management\n- **Game Modules**:\n  - **BlackJack**: Game logic and API endpoints for the BlackJack game\n  - **Slots**: Game logic and API endpoints for the Slots game\n  - **Dice**: Game logic and API endpoints for the Dice game\n\n### Frontend Components\n- **User Interface**: React components for navigation, user authentication, and game selection\n- **Game Components**: Specialized React components for each game type\n- **Animation Components**: Reusable animation effects for enhanced user experience\n\n### Infrastructure Components\n- **PostgreSQL Database**: Persistent storage for user data and game statistics\n- **SonarQube**: Code quality analysis and reporting\n- **Docker**: Containerization for consistent deployment across environments\n\n---\n\n## Architecture\n\nFEPsino follows a modern microservices-inspired architecture with clear separation of concerns between frontend and backend components.\n\n### Architecture Diagram\n\n```mermaid\ngraph TD\n    User[User] --\u003e Frontend[Frontend React App]\n    Frontend --\u003e API[Backend API]\n    API --\u003e Auth[User Authentication]\n    API --\u003e Games[Game Services]\n    API --\u003e DB[(PostgreSQL Database)]\n    Games --\u003e Blackjack[Blackjack Game]\n    Games --\u003e Slots[Slots Game]\n    Games --\u003e Dice[Dice Game]\n    Dev[Developer] --\u003e Code[Code Repository]\n    Code --\u003e CI[CI Pipeline]\n    CI --\u003e SonarQube[SonarQube Analysis]\n    CI --\u003e Docker[Docker Build]\n    Docker --\u003e Deploy[Deployment]\n```\n\n### System Interaction Diagram\n\n```mermaid\nsequenceDiagram\n    actor User\n    participant Frontend\n    participant API\n    participant Database\n\n    User-\u003e\u003eFrontend: Access Application\n    Frontend-\u003e\u003eAPI: Authentication Request\n    API-\u003e\u003eDatabase: Validate Credentials\n    Database--\u003e\u003eAPI: Authentication Response\n    API--\u003e\u003eFrontend: Auth Token\n\n    User-\u003e\u003eFrontend: Select Game\n    Frontend-\u003e\u003eAPI: Game Initialization\n    API-\u003e\u003eDatabase: Get User Balance\n    Database--\u003e\u003eAPI: User Data\n    API--\u003e\u003eFrontend: Game State\n\n    User-\u003e\u003eFrontend: Place Bet\n    Frontend-\u003e\u003eAPI: Bet Request\n    API-\u003e\u003eDatabase: Update Balance\n    API--\u003e\u003eFrontend: Game Result\n    Database--\u003e\u003eAPI: Confirm Update\n```\n\n### Class Diagram \n\n```mermaid\nclassDiagram\n    class User {\n        +email: EmailField\n        +is_active: BooleanField\n        +is_staff: BooleanField\n        +__str__()\n    }\n    \n    class UserManager {\n        +create_user(email, password)\n        +create_superuser(email, password)\n    }\n    \n    class Profile {\n        +user: OneToOneField\n        +username: CharField\n        +balance: DecimalField\n        +__str__()\n        +add_balance(amount)\n        +deduct_balance(amount)\n        +process_transaction(amount, transaction_type)\n    }\n    \n    class Transaction {\n        +profile: ForeignKey\n        +amount: DecimalField\n        +date: DateTimeField\n        +transaction_type: CharField\n        +__str__()\n    }\n    \n    class Symbol {\n        +name: CharField\n        +payout_multiplier: DecimalField\n        +__str__()\n    }\n    \n    class Spin {\n        +id: UUIDField\n        +user: ForeignKey\n        +bet_amount: DecimalField\n        +payout: DecimalField\n        +result: JSONField\n        +win_data: JSONField\n        +timestamp: DateTimeField\n    }\n    \n    class GameHistory {\n        +user: ForeignKey\n        +bet_amount: DecimalField\n        +outcome: CharField\n        +player_score: PositiveSmallIntegerField\n        +dealer_score: PositiveSmallIntegerField\n        +player_hand: TextField\n        +dealer_hand: TextField\n        +balance_change: IntegerField\n        +balance_before: PositiveIntegerField\n        +balance_after: PositiveIntegerField\n        +created_at: DateTimeField\n        +updated_at: DateTimeField\n        +__str__()\n    }\n    \n    class DiceGameModel {\n        +user: ForeignKey\n        +bet: DecimalField\n        +guessed_number: IntegerField\n        +choice1: CharField\n        +choice2: CharField\n        +roll1: IntegerField\n        +roll2: IntegerField\n        +total: IntegerField\n        +payout: DecimalField\n        +__str__()\n    }\n    \n    class ReelService {\n        -symbols: list\n        +__init__(symbols)\n        +generate_spin(num_reels, visible_rows)\n        -_extract_horizontal_values(result)\n        -_transpose_matrix(matrix)\n        -_reverse_rows(matrix)\n        +flip_horizontal(result)\n        +longest_seq(hit)\n        -_find_winning_combinations(horizontal)\n        +check_wins(result)\n        -_get_symbol_multiplier(symbol_name)\n        -_calculate_win_payout(symbol_name, indices, bet_amount)\n        +calculate_payout(win_data, bet_amount)\n    }\n    \n    class SlotMachineService {\n        -reel_service: ReelService\n        +__init__()\n        -_update_user_balance_for_bet(user, bet_amount)\n        -_update_user_balance_for_win(user, payout)\n        -_create_spin_record(user, bet_amount, payout, result, win_data)\n        +play_spin(user, bet_amount)\n    }\n    \n    class DiceGameService {\n        +execute_game_flow(user, data)\n        +save_game_to_db(user, data, result)\n        +build_response(result, user)\n    }\n    \n    class CoinService {\n        +check_user_coins(user, bet)\n        +deduct_bet(user, bet)\n        +update_balance(user, payout)\n    }\n    \n    class Card {\n        +rank: string\n        +suit: string\n        +__init__(rank, suit)\n        +__str__()\n        +to_dict()\n    }\n    \n    class BlackjackGame {\n        +RANKS: list\n        +SUITS: list\n        -player_hand: list\n        -dealer_hand: list\n        -deck: list\n        -game_over: boolean\n        +__init__()\n        +deal_card()\n        +create_deck()\n        +card_value(card)\n        +get_hand_score(hand)\n        +calculate_hand(hand)\n        +start_game()\n        -_deal_initial_cards()\n        +player_hit()\n        +dealer_play()\n        -_dealer_draw_cards()\n        -_determine_outcome(player_score, dealer_score)\n        +get_game_state()\n    }\n    \n    class SlotsGame {\n        -reels: state\n        -isSpinning: state\n        -balance: state\n        -bet: state\n        -lastWin: state\n        -winData: state\n        -spinIntervalRef: ref\n        +convertBackendResultToReels(result)\n        +generateRandomReels()\n        +handleSpinEnd(finalReels, payout, newBalance, winData)\n        +spin()\n        +isWinningSymbol(colIndex, rowIndex)\n        +render()\n    }\n    \n    class BlackjackGame {\n    }\n    \n    class DiceGame {\n    }\n    \n    class GameApi {\n        +fetchBalance(setBalance, user)\n    }\n    \n    class Profile {\n    }\n    \n    class SignUpIn {\n    }\n    \n    class UserApi {\n    }\n    \n    class DateApi {\n        +DisplayDate(dateString)\n    }\n    \n\n    User \"1\" -- \"1\" Profile : has\n    Profile \"1\" -- \"*\" Transaction : has\n    User -- UserManager : managed by\n    User \"1\" -- \"*\" Spin : has\n    User \"1\" -- \"*\" GameHistory : has\n    User \"1\" -- \"*\" DiceGameModel : has\n    \n    SlotMachineService -- ReelService : uses\n    SlotMachineService -- User : updates balance\n    SlotMachineService -- Spin : creates\n    \n    DiceGameService -- CoinService : uses\n    DiceGameService -- DiceGameModel : creates\n    DiceGameService -- User : updates balance\n    \n    BlackjackGame -- Card : uses\n    \n    SlotsGame -- GameApi : uses\n    BlackjackGame -- GameApi : uses\n    DiceGame -- GameApi : uses\n    \n    Profile -- UserApi : uses\n    SignUpIn -- UserApi : uses\n    Profile -- DateApi : uses\n```\n\n### Architecture Characteristics\n\n| Characteristic  | Rating (1-5) | Description                                                   |\n|-----------------|--------------|---------------------------------------------------------------|\n| Deployability   | ★★★★★        | Fully containerized with Docker for easy deployment           |\n| Elasticity      | ★★★☆☆        | Can scale horizontally but requires manual configuration      |\n| Evolutionary    | ★★★★☆        | Modular design allows for easy addition of new games          |\n| Fault tolerance | ★★★☆☆        | Basic error handling but limited automatic recovery           |\n| Modularity      | ★★★★★        | Clear separation between components and services              |\n| Overall cost    | ★★★★☆        | Low infrastructure requirements with efficient resource usage |\n| Performance     | ★★★★☆        | Optimized for responsive gameplay with minimal latency        |\n| Reliability     | ★★★★☆        | Stable operation with proper error handling                   |\n| Scalability     | ★★★★☆        | Can handle increased load through horizontal scaling          |\n| Simplicity      | ★★★★☆        | Clean architecture with intuitive component organization      |\n| Testability     | ★★★★★        | Comprehensive test coverage with SonarQube integration        |\n\n#### Detailed Architecture Characteristics Analysis\n\n**Deployability (★★★★★)**: FEPsino achieves maximum deployability through its comprehensive Docker containerization strategy. The entire application stack—including frontend, backend, database, and SonarQube—is defined in the docker-compose.yml file, enabling one-command deployment across any environment. This approach eliminates \"works on my machine\" issues and significantly reduces deployment time from hours to minutes, making it ideal for both development and production environments.\n\n**Elasticity (★★★☆☆)**: The system scores moderately on elasticity as it supports horizontal scaling of both frontend and backend components, but lacks automated scaling mechanisms. While the containerized architecture allows for adding more instances manually, the absence of orchestration tools like Kubernetes or auto-scaling policies prevents it from achieving higher elasticity. This design choice balances complexity against the current scale requirements of the application.\n\n**Evolutionary (★★★★☆)**: FEPsino's architecture earns four stars for evolutionary capability due to its modular design that isolates game logic into separate components. New games can be added with minimal changes to existing code, following the established pattern of game modules. The system falls short of five stars only because some cross-cutting concerns like user balance management require careful coordination across modules when evolving the system.\n\n**Fault Tolerance (★★★☆☆)**: The three-star rating for fault tolerance reflects the system's basic error handling capabilities without sophisticated recovery mechanisms. While the application implements proper exception handling and transaction management to prevent data corruption, it lacks advanced features like circuit breakers, automatic failover, or self-healing capabilities. This level is appropriate for the application's current needs but could be enhanced for mission-critical deployments.\n\n**Modularity (★★★★★)**: The perfect score in modularity is justified by the clean separation of concerns throughout the architecture. Each game is implemented as an independent module with well-defined interfaces, the frontend and backend are completely decoupled, and infrastructure components are isolated. This high modularity enables parallel development by different team members and simplifies maintenance by containing changes within specific modules.\n\n**Overall Cost (★★★★☆)**: FEPsino achieves excellent cost efficiency through its containerized architecture that minimizes resource requirements and allows for precise allocation of computing resources. The use of open-source technologies eliminates licensing costs, while the efficient database design reduces storage needs. The system falls short of five stars only because the development environment includes SonarQube, which increases resource consumption during development.\n\n**Performance (★★★★☆)**: The four-star performance rating is achieved through several optimizations: efficient API design that minimizes network overhead, React's virtual DOM for responsive UI updates, and database query optimization. The architecture supports low-latency gameplay essential for a satisfying casino experience. The system doesn't receive five stars because it prioritizes maintainability and clarity over absolute performance in some areas, a reasonable trade-off for this application domain.\n\n**Reliability (★★★★☆)**: FEPsino's reliability rating is based on its robust error handling, data validation, and transaction management that ensure consistent system behavior even under unexpected conditions. The containerized architecture provides isolation that prevents cascading failures. The four-star rating acknowledges that while the system handles most error scenarios gracefully, it lacks some advanced reliability features like comprehensive retry policies or distributed tracing.\n\n**Scalability (★★★★☆)**: The architecture earns four stars for scalability through its stateless backend design, separation of concerns, and efficient database access patterns. The system can handle increasing user loads by adding more container instances of the frontend or backend components. The rating reflects that while horizontal scaling is supported, some manual configuration is required, and the database might become a bottleneck under extreme loads without additional partitioning strategies.\n\n**Simplicity (★★★★☆)**: The four-star simplicity rating reflects the architecture's intuitive organization and clear component boundaries that make it easy for new developers to understand and contribute to the project. The consistent patterns used across game modules and the well-documented API reduce cognitive load. The system doesn't achieve five stars because some advanced features like the betting system introduce necessary complexity that requires deeper understanding.\n\n**Testability (★★★★★)**: FEPsino excels in testability with its five-star rating due to several factors: the modular architecture naturally supports unit testing of isolated components, the clear API boundaries enable comprehensive integration testing, and the SonarQube integration provides continuous code quality and test coverage monitoring. The separation of frontend and backend also allows for independent testing of each layer, resulting in a highly testable system that maintains quality as it evolves.\n\n**Partitioning Type**: Technically partitioned by functionality (games, user management, etc.)\n\n**Number of Quanta**: 5 (Frontend, Backend API, Database, SonarQube, Game Services)\n\n### Architecture Decisions\n\nThe architecture of FEPsino was designed with the following considerations:\n\n1. **Separation of Frontend and Backend**: Clear separation allows independent development and scaling of each component.\n\n2. **Containerization**: Docker provides consistency across development and production environments, simplifying deployment.\n\n3. **Modular Game Design**: Each game is implemented as a separate module, allowing for independent development and maintenance.\n\n4. **REST API**: The backend exposes a RESTful API for the frontend to consume, providing a clean interface between components.\n\n5. **Continuous Quality Monitoring**: Integration with SonarQube ensures code quality is maintained throughout development.\n\n---\n\n## Getting Started\n\n### Prerequisites\n- Docker and Docker Compose\n- Git\n\n### Installation\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/yourusername/fepsino.git\ncd fepsino\n```\n\n2. Create a `.env` file in the root directory (see [Environment Configuration](#environment-configuration))\n\n3. Build and start the containers:\n```bash\ndocker-compose up --build\n```\n\n4. Access the application:\n   - **Backend API**: http://localhost:8000\n   - **Frontend**: http://localhost:5173\n   - **SonarQube**: http://localhost:9000\n\n### Running the Application\n\nAfter the initial build, you can start the application with:\n\n```bash\ndocker-compose up\n```\n\nTo stop the application:\n\n```bash\ndocker-compose down\n```\n\n---\n\n## SonarQube Integration\n\nFEPsino integrates SonarQube for continuous code quality analysis. SonarQube helps identify code smells, bugs, vulnerabilities, and test coverage issues.\n\n### Accessing SonarQube\n\nOnce the application is running, SonarQube is available at:\n```\nhttp://localhost:9000\n```\n\nDefault credentials (if not changed in .env):\n- Username: admin\n- Password: admin\n\n### Running SonarQube Analysis Manually\n\nTo manually trigger a SonarQube analysis:\n\n```bash\ndocker-compose up sonarscanner\n```\n\n### Key Metrics Monitored\n\n- Code coverage\n- Duplicated code\n- Code smells\n- Bugs and vulnerabilities\n- Technical debt\n\n---\n\n## Environment Configuration\n\nCreate a `.env` file in the root directory with the following variables:\n\n```bash\n# Django Secret Key\nSECRET_KEY=your-secret-key\n\n# Database Configuration\nDB_HOST=db\nDB_NAME=dbname\nDB_USER=username\nDB_PASS=userpass\n\n# SonarQube Configuration\nSONAR_HOST_URL=http://sonarqube:9000\nSONAR_PROJECT_KEY=fepsino\nSONAR_PROJECT_NAME=FEPsino\nSONAR_TOKEN=your-sonar-token\n\nSONAR_JDBC_URL=jdbc:postgresql://db:5432/sonar\nSONAR_JDBC_USERNAME=sonar\nSONAR_JDBC_PASSWORD=sonar-password\n\n# Frontend Configuration\nVITE_API_URL=http://localhost:8000/api\n```\n\nReplace the placeholder values with your actual configuration.\n\n---\n\n## Usage\n\n### User Registration and Login\n\n1. Navigate to the homepage at http://localhost:5173\n2. Click on \"Sign Up\" to create a new account\n3. After registration, log in with your credentials\n\n### Playing Games\n\n1. After logging in, you are navigated to the homepage\n2. Choose from available games:\n   - BlackJack\n   - Slots\n   - Dice\n3. Each game has its own instructions and betting options\n\n### Managing Your Account\n\n1. Access your profile by clicking on your username\n2. View your balance and transaction history\n3. Update your profile information as needed\n\n---\n\n## Development\n\n### Project Structure\n\n```\nfepsino/\n├── backend/               # Django backend\n│   ├── core/              # Core settings and configuration\n│   ├── user/              # User management\n│   ├── blackjack/         # BlackJack game logic\n│   ├── slots/             # Slots game logic\n│   ├── dice/              # Dice game logic\n│   └── scripts/           # Utility scripts\n├── frontend/              # React frontend\n│   ├── src/\n│   │   ├── components/    # React components\n│   │   ├── assets/        # Static assets\n│   │   └── tests/         # Frontend tests\n│   └── public/            # Public assets\n└── docker-compose.yml     # Docker configuration\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgearbeagel%2Ffepsino","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgearbeagel%2Ffepsino","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgearbeagel%2Ffepsino/lists"}