This is a full-stack web application that allows users to select a Pokémon, view its stats, initiate battles with a randomly selected opponent, and review recent results. The project integrates a backend API and a web frontend, working together to provide functionality for listing and battling Pokémon.
- Database migrations to populate Pokémon data.
- Endpoints to list Pokémon, initiate battles, and retrieve past results.
- Stores battle results.
- Battle algorithm:
- Higher speed Pokémon attacks first, or higher attack if speeds are equal.
- Damage is
attack - defense
, with a minimum of 1. - Battles continue in turns until a Pokémon's HP reaches zero.
- Swagger documentation for all endpoints.
- UI to list and select Pokémon for battle.
- Random opponent selection and battle result display.
- History of the last 10 battle results.
- Mobile responsive design.
- Backend: NestJS, TypeScript, TypeORM, SQLite, Swagger.
- Frontend: React, TypeScript, Material UI, React Query.
- Containerization: Docker.
-
Ensure that Docker is installed and running on your system. You can download Docker from the official Docker website.
-
Clone the repository and navigate to the root directory:
git clone https://github.com/delucajuan/pokemon-battle.git cd pokemon-battle
-
Create a
.env
file in the project root and specify the ports for the frontend and backend (you can reference the providedenv.example
file):# Backend port API_PORT=5001 # Frontend port WEB_PORT=3000
-
Build and run the containers:
docker-compose up
-
The application will be accessible at http://localhost:3000 and the backend API documentation at http://localhost:5001/docs/. If you have chosen different ports in the .env file, make sure to replace 3000 and 5001 with the corresponding values.
-
Ensure Node.js version 18+ is installed on your system:
node -v
If needed, you can download Node.js from the official Node website.
-
Clone the repository and navigate to the root directory:
git clone https://github.com/delucajuan/pokemon-battle.git cd pokemon-battle
-
Create a
.env
file in both the/api
and/web
directories and specify the required environment variables (you can reference the providedenv.example
files):Create a
.env
file and specify the port for the backend:PORT=5001
Create a
.env
file and set the API URL:REACT_APP_API_URL=http://localhost:5001/api
-
From the root directory, install dependencies for both the frontend and backend:
npm run install:all
-
From the root directory, start both the web and API servers (migrations will be executed automatically when the API server starts):
npm start
-
The application will be accessible at http://localhost:3000 and the backend API documentation at http://localhost:5001/docs/. If you have chosen different ports, make sure to replace 3000 and 5001 with the corresponding values.
Developed by Juan De Luca.