README.md file with complete details:
# Pokemon Tournament App
## Overview
The Pokemon Tournament App is a Java Spring Boot application designed to simulate Pokemon tournaments with customizable configurations. It includes both frontend and backend components, with a PostgreSQL database for data persistence. This project is containerized using Docker, allowing easy setup and execution.
## Features
- Manage Pokemon and tournament data.
- CRUD operations for Pokemon and tournaments.
- Secure data with encryption using secret keys.
- RESTful API for interacting with the application.
- Pre-configured database using PostgreSQL.
## Prerequisites
To run this application, you need:
- **Docker**: Make sure Docker is installed on your system. You can download Docker [here](https://www.docker.com/get-started).
- **Docker Compose**: This is usually included with Docker installations, but confirm it's available by running `docker-compose --version` in your terminal.
- Java JDK 21 and Node.js for local environment development.
## Project Structure
- **Dockerfile**: Defines the Docker image for the Spring Boot application.
- **docker-compose.yml**: Manages multi-container deployment, including the app and PostgreSQL database.
- **.env**: Stores environment variables required for database configuration and secret keys. **Ensure this file is in the project root directory**.To launch the Pokémon Tournament application, simply run the following command in the root directory of this repository.
./start_pokemon_tournament.shHere are some key API endpoints available for testing:
- Get Pokemon by Name:
GET /api/pokemon/name/{name}- Example:
http://localhost:8081/api/pokemon/name/Pikachu
- Example:
- Get All Pokemon:
GET /api/pokemon - Create a New Pokemon:
POST /api/pokemonwith JSON payload.
- Create Tournament:
POST /api/tournamentwith JSON payload.
Use Postman or curl to test the API endpoints. For example, to fetch a Pokemon by name:
curl -X GET http://localhost:8081/api/pokemon/name/PikachuPOST /api/pokemon
Content-Type: application/json
{
"name": "Charmander",
"attack": 52,
"defense": 43,
"speed": 65,
"max_hp": 100
}POST /api/tournament
Content-Type: application/json
{
"tournamentName": "Kanto Championship",
"pokemonIds": [1, 2, 3, 4]
}To access the database within the Docker container:
- Run the following command to access the PostgreSQL database:
docker-compose exec db psql -U $POSTGRES_USER -d $POSTGRES_DB
- You can then run SQL queries directly, e.g.,
SELECT * FROM pokemon;
If Docker isn’t running, start the Docker Desktop or Docker Daemon.
Ensure the SECRET_KEY environment variable is properly set in the .env file.
If the app fails to connect to the database, check if the environment variables in .env match those in docker-compose.yml.
To stop the application and remove all containers, networks, and volumes created by docker-compose up:
docker-compose downIf you would like to contribute, please fork the repository and make changes as needed. Pull requests are welcome.
This project is licensed under the MIT License.
### Notes for Customization
1. **Environment Variables**: Ensure sensitive values are well-documented, especially for the `.env` file.
2. **API Documentation**: If you have more endpoints, you could consider adding Swagger for automatic documentation.
3. **Sample Data**: Add SQL scripts or instructions for adding initial data if required for testing.
---
This README provides a comprehensive guide for users to set up, run, and test the application with Docker.



