PokemonDB is a web application built with PHP and MySQL that allows users to browse a complete database of Pokémon (up to generation 5). Registered users can create and manage their own personal Pokédex by "catching" and "releasing" Pokémon. This dynamic functionality uses an asynchronous, REST-like API, which users can also query directly using their personal account ID (UUID) found on their account page.
- User Authentication: Users can create new account, log in, log out and delete their account.
- National Pokédex: A full gallery of all Pokémon (up to generation 5), showing their sprites and types.
- Personal Pokédex: Logged-in users have a personal Pokédex page.
- "Caught" Pokémon are shown in full color.
- "Uncaught" Pokémon are shown as silhouettes.
- Catch/Release: Users can add or remove Pokémon from their personal Pokédex using the Pokéball button.
- Pokémon Details: Users can click on a Pokémon to view a more detailed page about it like stats and moves.
- Backend: PHP
- Database: MySQL/MariaDB
- Frontend: HTML, CSS, JavaScript
- API: A simple REST-like API that supports getting, adding and deleting pokemon with GET, POST, DELETE.
- API Authentication: Uses a Bearer Token in the Authorization header to identify users for API requests.
To run this project locally, follow these steps:
- Clone this repo: Place the contents of this repo into your web server's root.
- Database Setup:
- Create a new MySQL database. The application is configured to use the name
pokemon. - Import the
pokemon.sqlfile into your database. This file contains the complete schema for all tables (nationaldex,moves,users,user_pokedex, etc.) and pre-populates them with the necessary data.
- Create a new MySQL database. The application is configured to use the name
- Configure Credentials:
- Open the
config.phpfile. - Update the
DB_HOST,DB_NAME,DB_USERNAME, andDB_PASSWORDconstants to match your local database environment.
- Open the
- Run: Start your web server.
This application was originally hosted on Amazon Web Services (AWS).
- The main PHP application was served from an Amazon EC2 instance running an Apache web server.
- The MySQL database was hosted using Amazon RDS, providing a scalable and managed database solution.
The deployment used a Virtual Private Cloud (VPC) with two subnets to securely separate the web server from the database.
- Public Subnet: The EC2 Instance was placed in a public subnet.
- Private Subnet: The RDS Instance was placed in a private subnet.
- EC2 Security Group (
web-server-sg):- Inbound Rules:
- Allow HTTP (port 80) from
0.0.0.0/0(Anywhere) to let users access the website. - Allow SSH (port 22) from my IP that let me manage the server.
- Allow HTTP (port 80) from
- Outbound Rules:
- (Default) Allow
0.0.0.0/0(Anywhere).
- (Default) Allow
- Inbound Rules:
- RDS Security Group (
database-sg):- Inbound Rules:
- Allow MySQL (port 3306) from the
web-server-sg.
- Allow MySQL (port 3306) from the
- Outbound Rules:
- (Default) Allow
0.0.0.0/0(Anywhere).
- (Default) Allow
- Inbound Rules: