| .. | ||
| .docker | ||
| config/checkstyle | ||
| gradle/wrapper | ||
| src | ||
| .dockerignore | ||
| .gitignore | ||
| build.gradle.kts | ||
| gradlew | ||
| gradlew.bat | ||
| Readme.md | ||
| settings.gradle.kts | ||
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
- Start the PostgreSQL Docker container
- Open application.propertiesand copy the database URL
- In IntelliJ, open the Database tab (right panel)
- Click the database icon with key in the toolbar
- Click the plus (+) icon
- Select "Datasource from URL"
- Paste the database URL and select PostgreSQL driver
- Enter credentials (username: lf8_starter, password:secret)
- In Schemas tab, uncheck all except lf8_starter_dbandpublic
- 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:
- Open GetBearerToken.httpat project root
- Execute the request
- Copy the access_tokenfrom the response
- 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