This repository has been archived on 2025-06-18. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
casino/backend/Readme.md
jank 5d600a4b21
All checks were successful
CI / Get Changed Files (pull_request) Successful in 10s
Label PRs based on size / Check PR size (pull_request) Successful in 24s
Pull Request Labeler / labeler (pull_request_target) Successful in 10s
CI / oxlint (pull_request) Successful in 40s
CI / prettier (pull_request) Successful in 46s
CI / eslint (pull_request) Successful in 50s
CI / test-build (pull_request) Successful in 1m17s
Claude PR Review / claude-code (pull_request) Successful in 1m29s
CI / Docker frontend validation (pull_request) Successful in 15s
CI / Docker backend validation (pull_request) Successful in 14s
CI / Backend Tests (pull_request) Successful in 2m21s
CI / Checkstyle Main (pull_request) Successful in 1m49s
chore: Update some README's
2025-06-04 09:53:29 +02:00

3.6 KiB

Casino Gaming Platform - Backend API

A Spring Boot backend application providing REST APIs for a casino gaming platform with multiple games, user management, authentication, and payment processing.

Features

Games

  • Blackjack - Classic card game with deck management
  • Coinflip - Simple heads/tails betting game
  • Dice - Dice rolling game
  • Slots - Slot machine with symbols and payouts
  • Lootboxes - Reward system with configurable prizes

User Management

  • User registration and authentication
  • OAuth2 integration (Google, GitHub)
  • Email verification and password reset
  • Balance management and transaction history

Payment System

  • Deposit functionality with webhook support
  • Transaction tracking and status management
  • Balance updates and fund validation

Tech Stack

  • Java 17 with Spring Boot
  • Spring Security with JWT authentication
  • Spring Data JPA with PostgreSQL
  • OAuth2 for social login
  • Email service for notifications
  • OpenAPI/Swagger for API documentation

Build & Run

Prerequisites

  • Java 17+
  • Gradle
  • Docker & Docker Compose (for PostgreSQL)

Build Commands

# Build the application
./gradlew build

# Clean build
./gradlew clean build

# Run the application
./gradlew bootRun

# Generate JAR file
./gradlew bootJar

Testing

# Run all tests
./gradlew test

# Run specific test class
./gradlew test --tests "FullyQualifiedClassName"

# Run checkstyle
./gradlew checkstyleMain checkstyleTest

API Endpoints

The application runs on http://localhost:8080

API Documentation

  • Swagger UI: http://localhost:8080/swagger-ui.html
  • OpenAPI Spec: http://localhost:8080/v3/api-docs

Main Endpoints

  • /api/auth/** - Authentication and user management
  • /api/games/blackjack/** - Blackjack game operations
  • /api/games/coinflip/** - Coinflip game operations
  • /api/games/dice/** - Dice game operations
  • /api/games/slots/** - Slot machine operations
  • /api/lootboxes/** - Lootbox management
  • /api/deposits/** - Payment and deposit handling
  • /api/users/** - User profile management
  • /api/health - Health check endpoint

Database Setup

PostgreSQL with Docker

# Start PostgreSQL container
cd docker/local
docker compose up

# Stop PostgreSQL container
docker compose down

# Reset database (if needed)
docker compose down
docker volume rm local_lf8_starter_postgres_data
docker compose up

Database Configuration

Database connection settings are configured in src/main/resources/application.properties

IntelliJ Database Setup

  1. Start the PostgreSQL Docker container
  2. Open application.properties and copy the database URL
  3. In IntelliJ, open the Database tab (right panel)
  4. Click the database icon with key in the toolbar
  5. Click the plus (+) icon
  6. Select "Datasource from URL"
  7. Paste the database URL and select PostgreSQL driver
  8. Enter credentials (username: lf8_starter, password: secret)
  9. In Schemas tab, uncheck all except lf8_starter_db and public
  10. Apply and confirm

Authentication

The application supports multiple authentication methods:

  • JWT-based authentication
  • OAuth2 (Google, GitHub)
  • Email/password with verification

Getting Bearer Token

For API testing, use the provided HTTP client file:

  1. Open GetBearerToken.http at project root
  2. Execute the request
  3. Copy the access_token from the response
  4. Use in Authorization header: Bearer <token>

Configuration

Key configuration files:

  • application.properties - Main application configuration
  • SecurityConfig.java - Security and CORS settings
  • OpenAPIConfiguration.java - API documentation setup