Running the Application
This guide describes how to run the Casino Gaming Platform locally.
Prerequisites
Ensure you have all requirements installed as described in the Development Environment Setup guide.
Starting the Infrastructure
Before running the application, you need to start the required infrastructure:
-
Start Docker services
cd docker docker-compose up -d
This starts:
- PostgreSQL database (port 5432)
- PostgreSQL for Keycloak (port 9433)
- Keycloak authentication server (port 9090)
-
Verify services are running
docker ps
Running the Backend
-
Navigate to the backend directory
cd backend
-
Start the Spring Boot application
./gradlew bootRun
Alternatively, you can run it from your IDE by running the
CasinoApplication
class. -
Verify the backend is running
- Open http://localhost:8080/swagger in your browser to see the Swagger UI
- Run a health check: http://localhost:8080/api/health
Running the Frontend
-
Navigate to the frontend directory
cd frontend
-
Install dependencies (if not already done)
bun install
-
Start the development server
bun run start
or
bunx @angular/cli serve --proxy-config src/proxy.conf.json
-
Access the application
- Open http://localhost:4200 in your browser
Using Docker Compose for Everything
For convenience, you can run the entire stack using Docker Compose:
-
Build the containers
docker-compose -f docker/docker-compose.yml build
-
Start the services
docker-compose -f docker/docker-compose.yml up -d
-
Access the application
- Frontend: http://localhost:4200
- Backend: http://localhost:8080
- Keycloak: http://localhost:9090
Stopping the Application
-
Stop the frontend
- Press
Ctrl+C
in the terminal where the frontend is running
- Press
-
Stop the backend
- Press
Ctrl+C
in the terminal where the backend is running
- Press
-
Stop Docker services
cd docker docker-compose down
Common Issues and Solutions
Frontend cannot connect to backend
- Ensure the backend is running
- Check that the proxy configuration in
src/proxy.conf.json
is correct - Verify that Docker services are running
Authentication issues
- Ensure Keycloak is running and accessible at http://localhost:9090
- Check that the user exists in the Keycloak realm
- Verify the client configuration in Keycloak
Database connection issues
- Ensure PostgreSQL is running
- Check the database connection settings in
application.properties
- Try resetting the database (see Troubleshooting)
Development Modes
Backend Development with Hot Reload
Spring Boot Development Tools provide hot reload capabilities:
./gradlew bootRun --args="--spring.devtools.restart.enabled=true"
Frontend Development with HMR
Angular CLI provides hot module replacement:
bun run start
This automatically enables HMR for faster development.