From 5d600a4b2146cda6e0261580efb6c85465b0935d Mon Sep 17 00:00:00 2001 From: jank Date: Wed, 4 Jun 2025 09:51:35 +0200 Subject: [PATCH] chore: Update some README's --- backend/Readme.md | 164 +++++++++++++++++++++++++++++++++------------ frontend/README.md | 104 +++++++++++++++++++++++++--- 2 files changed, 217 insertions(+), 51 deletions(-) diff --git a/backend/Readme.md b/backend/Readme.md index 8f945dc..228842e 100644 --- a/backend/Readme.md +++ b/backend/Readme.md @@ -1,59 +1,137 @@ -# Starter für das LF08 Projekt +# Casino Gaming Platform - Backend API -## Requirements -* Docker https://docs.docker.com/get-docker/ -* Docker compose (bei Windows und Mac schon in Docker enthalten) https://docs.docker.com/compose/install/ +A Spring Boot backend application providing REST APIs for a casino gaming platform with multiple games, user management, authentication, and payment processing. -## Endpunkt -``` -http://localhost:8080 -``` -## Swagger -``` -http://localhost:8080/swagger -``` +## 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 -# Postgres -### Terminal öffnen -für alles gilt, im Terminal im Ordner docker/local sein +### 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 ```bash +# Build the application +./gradlew build + +# Clean build +./gradlew clean build + +# Run the application +./gradlew bootRun + +# Generate JAR file +./gradlew bootJar +``` + +### Testing +```bash +# 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 +```bash +# Start PostgreSQL container cd docker/local -``` -### Postgres starten -```bash docker compose up -``` -Achtung: Der Docker-Container läuft dauerhaft! Wenn er nicht mehr benötigt wird, sollten Sie ihn stoppen. -### Postgres stoppen -```bash +# Stop PostgreSQL container docker compose down -``` -### Postgres Datenbank wipen, z.B. bei Problemen -```bash +# Reset database (if needed) docker compose down docker volume rm local_lf8_starter_postgres_data docker compose up ``` -### Intellij-Ansicht für Postgres Datenbank einrichten -```bash -1. Lasse den Docker-Container mit der PostgreSQL-Datenbank laufen -2. im Ordner resources die Datei application.properties öffnen und die URL der Datenbank kopieren -3. rechts im Fenster den Reiter Database öffnen -4. In der Database-Symbolleiste auf das Datenbanksymbol mit dem Schlüssel klicken -5. auf das Pluszeichen klicken -6. Datasource from URL auswählen -7. URL der DB einfügen und PostgreSQL-Treiber auswählen, mit OK bestätigen -8. Username lf8_starter und Passwort secret eintragen (siehe application.properties), mit Apply bestätigen -9. im Reiter Schemas alle Häkchen entfernen und lediglich vor lf8_starter_db und public Häkchen setzen -10. mit Apply und ok bestätigen -``` -# Keycloak +### Database Configuration +Database connection settings are configured in `src/main/resources/application.properties` -### Keycloak Token -1. Auf der Projektebene [GetBearerToken.http](../GetBearerToken.http) öffnen. -2. Neben der Request auf den grünen Pfeil drücken -3. Aus dem Reponse das access_token kopieren \ No newline at end of file +### 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 ` + +## Configuration + +Key configuration files: +- `application.properties` - Main application configuration +- `SecurityConfig.java` - Security and CORS settings +- `OpenAPIConfiguration.java` - API documentation setup \ No newline at end of file diff --git a/frontend/README.md b/frontend/README.md index daf35fe..a67f78f 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -1,18 +1,106 @@ # Casino Gaming Platform - Frontend -This is the frontend application for the Casino Gaming Platform. It's built with Angular 18 and TailwindCSS, providing a responsive and modern UI for the casino gaming experience. +A modern Angular 20 casino gaming platform featuring multiple games including Blackjack, Coinflip, Dice, Slots, and Lootboxes. Built with Angular 20, TailwindCSS 4, and powered by Bun for fast development. -## Development +## 🎮 Features -### Commands +- **Multiple Games**: Blackjack, Coinflip, Dice, Slots, Lootboxes +- **User Authentication**: OAuth2, email verification, password recovery +- **Real-time Gaming**: Interactive game mechanics with animations +- **Payment Integration**: Stripe integration for deposits +- **Responsive Design**: Mobile-first design with TailwindCSS +- **Audio Experience**: Game sounds and audio feedback +- **Transaction History**: Complete betting and transaction tracking -- **Build**: `bun run build` or `bunx @angular/cli build` -- **Start Dev Server**: `bun run start` or `bunx @angular/cli serve --proxy-config src/proxy.conf.json` -- **Format Code**: `bun run format` or `prettier --write "src/**/*.{ts,html,css,scss}"` -- **Lint**: `bun run lint` or `ng lint` -- **Test**: `bun run test` or `bunx @angular/cli test` +## 🚀 Getting Started + +### Prerequisites + +- [Bun](https://bun.sh/) (recommended) or Node.js 18+ +- Angular CLI 20+ + +### Installation + +```bash +# Install dependencies +bun install + +# Start development server +bun run start +``` + +The app will be available at `http://localhost:4200` + +## 📋 Commands + +### Development +- **Start Dev Server**: `bun run start` - Starts dev server with proxy configuration +- **Build**: `bun run build` - Production build +- **Watch Build**: `bun run watch` - Development build with file watching + +### Code Quality +- **Format**: `bun run format` - Format code with Prettier +- **Format Check**: `bun run format:check` - Check code formatting +- **Lint**: `bun run lint` - Run ESLint +- **OxLint**: `bun run oxlint` - Run OxLint with strict warnings + +### Testing +- **Test All**: `bun run test` - Run all tests with Karma/Jasmine - **Test Single File**: `bunx @angular/cli test --include=path/to/test.spec.ts` +## 🛠️ Technology Stack + +### Core +- **Angular 20**: Latest Angular framework with standalone components +- **TypeScript 5.8**: Strongly typed JavaScript +- **RxJS 7.8**: Reactive programming for HTTP and state management + +### Styling & UI +- **TailwindCSS 4**: Utility-first CSS framework +- **PostCSS**: CSS processing and optimization +- **FontAwesome**: Icon library with Angular integration + +### Animation & Interaction +- **GSAP**: High-performance animations +- **CountUp.js**: Number animation effects +- **Custom Audio Service**: Game sound effects and feedback + +### Development Tools +- **Bun**: Fast JavaScript runtime and package manager +- **ESLint + Angular ESLint**: Code linting with Angular-specific rules +- **OxLint**: Fast Rust-based linter +- **Prettier**: Code formatting +- **Karma + Jasmine**: Testing framework + +### Payment & APIs +- **Stripe**: Payment processing integration +- **Custom HTTP Interceptors**: API communication and error handling + +## 🏗️ Architecture + +### Project Structure +``` +src/ +├── app/ +│ ├── feature/ # Feature modules +│ │ ├── auth/ # Authentication (login, register, OAuth2) +│ │ ├── game/ # Game modules (blackjack, coinflip, dice, slots) +│ │ ├── lootboxes/ # Lootbox system +│ │ └── deposit/ # Payment and deposits +│ ├── model/ # Data models and interfaces +│ ├── service/ # Core services (auth, user, transaction) +│ └── shared/ # Shared components, directives, services +├── environments/ # Environment configurations +└── public/ # Static assets (images, sounds) +``` + +### Key Components +- **Game Components**: Modular game implementations with services +- **Shared Components**: Reusable UI components (navbar, footer, modals) +- **Services**: Business logic and API communication +- **Guards**: Route protection and authentication +- **Interceptors**: HTTP request/response handling + ## Style Guide ### Color Palette -- 2.47.2