Skip to content

ZuydUniversity/pokepy-3tier-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PokePy - 3-Tier Pokemon Application

A full-stack application for browsing and managing Pokemon data. Built with Python/FastAPI backend, Next.js frontend, and MariaDB database.

πŸ“‹ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Frontend (Next.js/React)           β”‚
β”‚  - Port: 3000                       β”‚
β”‚  - Docker image: pokepy-frontend    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Backend (FastAPI/Python)           β”‚
β”‚  - Port: 8000                       β”‚
β”‚  - Docker image: pokepy-backend     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Database (MariaDB)                 β”‚
β”‚  - Port: 3306                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Prerequisites

  • Docker & Docker Compose
  • Git
  • Node.js 20.x (for frontend local dev)
  • Python 3.x (for backend local dev)

Option 1: Docker (Recommended)

# Start entire stack
docker compose up -d

# View logs
docker compose logs -f

# Stop services
docker compose down

Services will be available at:

Option 2: Vagrant VM

Don't have Docker installed? Use Vagrant to run everything in a virtual machine:

# Start VM and provision Docker
vagrant up

# SSH into the VM
vagrant ssh

# Inside the VM, run:
cd /vagrant
docker compose up -d

See VAGRANT.md for detailed instructions.

Option 3: Local Development (No Docker)

Backend Setup

cd backend
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt
python -m uvicorn src.main:app --reload

Frontend Setup

cd frontend
npm install
npm run dev

πŸ“ Project Structure

pokemon-3-tier/
β”œβ”€β”€ backend/                    # FastAPI application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ main.py            # Entry point
β”‚   β”‚   β”œβ”€β”€ config_reader.py   # Configuration
β”‚   β”‚   └── pokemon/           # Pokemon domain
β”‚   β”œβ”€β”€ requirements.txt        # Python dependencies
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── openapi.yaml           # API specification
β”‚
β”œβ”€β”€ frontend/                   # Next.js application
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ layout.tsx
β”‚   β”‚   β”œβ”€β”€ page.tsx
β”‚   β”‚   └── lib/
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ tsconfig.json
β”‚   └── Dockerfile
β”‚
β”œβ”€β”€ db/                         # Database
β”‚   β”œβ”€β”€ init.sql               # Schema initialization
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── data/
β”‚
β”œβ”€β”€ .github/
β”‚   └── workflows/             # CI/CD pipelines
β”‚       β”œβ”€β”€ backend-build.yml  # Backend build & push
β”‚       └── frontend-build.yml # Frontend build & push
β”‚
β”œβ”€β”€ docker-compose.yml
└── README.md

πŸ”„ CI/CD Pipeline

This repo uses GitHub Actions for automated builds and deployments.

Workflows

  • Backend: Triggers on changes to /backend β†’ Builds and pushes Docker image
  • Frontend: Triggers on changes to /frontend β†’ Builds and pushes Docker image
  • Deploy: Triggers on release β†’ Deploys to Azure VM

Each workflow only runs when its respective folder changes (path-based filtering).

πŸ“¦ Docker Images

Published to Docker Hub:

  • donovicv/pokepy-backend:latest
  • donovicv/pokepy-frontend:latest

πŸ” Environment Variables

Backend (backend/config.ini)

[database]
host = db
port = 3306
user = root
password = your_password
database = pokemon

Frontend (.env.development)

NEXT_PUBLIC_API_URL=http://localhost:8000

πŸ§ͺ Testing

Backend

cd backend
pytest ./src/tests/

Frontend

cd frontend
npm test

πŸ“ API Documentation

Interactive API docs available at: http://localhost:8000/docs

API Collection: See /backend/postman/PokePy.postman_collection.json

πŸ“š Documentation

  • CONTRIBUTING.md - Development setup, code standards, and PR process
  • VAGRANT.md - Running the app in a virtual machine with Vagrant
  • Makefile - Build and run commands - make help to see all options
  • docker-compose.yml - Service configuration and networking

🀝 Contributing

Please read CONTRIBUTING.md for development setup and guidelines.

πŸ“„ License

See LICENSE

πŸ‘€ Authors

  • Your Name - Initial work

Questions? Open an issue or check the individual service READMEs in backend/ and frontend/ folders.

About

No description or website provided.

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors