Skip to content

Latest commit

ย 

History

785 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Animal Battle Stats

Interactive Fighting Game-Style Animal Statistics Webapp

Live Demo License Animals API

A web application that presents animal statistics in an engaging fighting game-style interface. Compare stats, view animals in a character select screen, and pit them against each other in VS battles!

๐ŸŽฎ Live Demo

https://animalbattlestats.com

โœจ Features

๐ŸŽฎ Fighting Game Interface

  • Character Select Screen: Stats view with centered character display and flanking stat panels
  • VS Battle Mode: Compare two fighters head-to-head with dramatic VS badge
  • Photographic Animal Cutouts: Animal assets are being standardized on real photos with genuine transparency and traceable sources
  • Responsive Design: Optimized for desktop, tablet, and mobile devices

๐Ÿ“Š Comprehensive Stats

  • 225 Animals: From Megalodon to Red-Eyed Tree Frog
  • Combat Stats: Attack, Defense, Agility, Stamina, Intelligence, Special Attack
  • Detailed Substats: Raw Power, Armor, Speed, Tactics, and more
  • Scientific Data: Weight, speed, lifespan, bite force, and more

๐Ÿ” User System

  • Account Creation: Sign up with email and password
  • User Authentication: Secure JWT-based login
  • Future Features: Voting on stats, comments, fight predictions

๐Ÿš€ Backend API

  • MongoDB Database: Persistent storage with MongoDB Atlas
  • RESTful API: Vercel serverless functions
  • Search & Filter: Advanced querying capabilities

๐Ÿš€ Quick Start

Live Site

Visit animalbattlestats.com directly.

Local Development

# Clone the repository
git clone https://github.com/RamiNoodle733/animal-battle-stats.git
cd animal-battle-stats

# Install dependencies
npm install

# Configure environment
cp .env.example .env.local
# Edit .env.local with your MongoDB URI and JWT secret

# Seed database (optional - if starting fresh)
npm run seed

# Start development server
npm run dev

Animal image quality gate

New or replacement animal artwork must be a real photograph of the correct animal with genuine transparent pixels. Cartoons, illustrations, generated or stylized animals, 3D renders, watermarked previews, opaque backgrounds, and reused files for different species are not accepted.

Use npm run assets:pipeline -- --help for the single supported workflow. Run npm run assets:audit to inspect decoding, transparency, dimensions, byte size, exact duplicates, and verified photo provenance. Add -- --strict for technical validation or -- --strict-provenance for the final all-assets quality gate. The audit can also produce labeled visual-review sheets because photographic authenticity cannot be proven from file metadata alone:

npm run assets:audit -- --report .cache/image-audit/report.json --contact-sheets .cache/image-audit

Candidate photos are sourced into the ignored .cache directory and never replace a live asset automatically. The sourcing command accepts only reusable Commons licenses, records creator/license/source metadata, and generates one review sheet per animal:

npm run assets:source -- --animal "Yak" --animal "Piranha" --limit 6
npm run assets:source -- --animal "Orca" --query "Orca=Orcinus orca underwater full body side" --limit 8
npm run assets:source -- --animal "Gorilla" --source-page "Gorilla=https://commons.wikimedia.org/wiki/File%3AGorilla_gorilla04.jpg" --limit 8

Only visually approved sources are recorded in data/animal-image-sources.json. A registry entry marked source-selected is not yet a live asset; it must still pass transparent-cutout and edge-quality review. Keep reviewed cutouts in the ignored .cache directory, inspect the dry run, and promote them explicitly:

npm run assets:promote -- --input-dir .cache/reviewed-cutouts
npm run assets:promote -- --input-dir .cache/reviewed-cutouts --apply

Promotion verifies PNG transparency, opaque subject pixels, safe edge padding, dimensions, and foreground coverage. It then records the checksum and review state, updates the canonical dataset, and generates transparent AVIF/WebP variants plus images/animals/optimized/manifest.json. Fallback URLs and variant filenames use content fingerprints so immutable browser/CDN caching cannot preserve an older animal. Re-running the same reviewed input is safe and deterministic.

After the new static files are deployed, synchronize only the registered active image paths into MongoDB. The command is a dry run unless --apply is supplied, updates no other animal fields, and verifies every applied value:

npm run assets:sync-images -- --env-file .cache/production.env
npm run assets:sync-images -- --env-file .cache/production.env --apply

๐Ÿ“ Project Structure

animal-battle-stats/
โ”œโ”€โ”€ index.html              # Main HTML (single-page app)
โ”œโ”€โ”€ manifest.json           # PWA manifest
โ”œโ”€โ”€ vercel.json             # Vercel deployment config
โ”‚
โ”œโ”€โ”€ css/                    # Stylesheets (modular architecture)
โ”‚   โ”œโ”€โ”€ main.css            # Import manifest
โ”‚   โ”œโ”€โ”€ legacy.css          # Original styles (being migrated)
โ”‚   โ”œโ”€โ”€ variables.css       # Design tokens
โ”‚   โ”œโ”€โ”€ base.css            # Reset & utilities
โ”‚   โ”œโ”€โ”€ components/         # Reusable UI components
โ”‚   โ”‚   โ”œโ”€โ”€ buttons.css
โ”‚   โ”‚   โ”œโ”€โ”€ cards.css
โ”‚   โ”‚   โ”œโ”€โ”€ modals.css
โ”‚   โ”‚   โ””โ”€โ”€ stat-bars.css
โ”‚   โ”œโ”€โ”€ layout/             # Layout components
โ”‚   โ”‚   โ”œโ”€โ”€ header.css
โ”‚   โ”‚   โ””โ”€โ”€ grid.css
โ”‚   โ””โ”€โ”€ pages/              # Page-specific styles
โ”‚       โ”œโ”€โ”€ compare.css
โ”‚       โ”œโ”€โ”€ community.css
โ”‚       โ”œโ”€โ”€ rankings.css
โ”‚       โ”œโ”€โ”€ stats.css
โ”‚       โ””โ”€โ”€ tournament.css
โ”‚
โ”œโ”€โ”€ js/                     # Client-side JavaScript
โ”‚   โ”œโ”€โ”€ core.js             # Shared utilities & config
โ”‚   โ”œโ”€โ”€ main.js             # Core app + Stats page (~2,500 lines)
โ”‚   โ”œโ”€โ”€ rankings.js         # Rankings page (~1,850 lines)
โ”‚   โ”œโ”€โ”€ tournament.js       # Tournament system (~1,900 lines)
โ”‚   โ”œโ”€โ”€ community-manager.js # Community page (~1,300 lines)
โ”‚   โ”œโ”€โ”€ router.js           # Client-side routing
โ”‚   โ”œโ”€โ”€ auth.js             # Authentication UI
โ”‚   โ”œโ”€โ”€ compare.js          # Compare page enhancements
โ”‚   โ””โ”€โ”€ community.js        # Community page enhancements
โ”‚
โ”œโ”€โ”€ api/                    # Serverless API functions (Vercel)
โ”‚   โ”œโ”€โ”€ animals.js          # Animals CRUD
โ”‚   โ”œโ”€โ”€ animals/[id].js     # Single animal operations
โ”‚   โ”œโ”€โ”€ auth.js             # Authentication
โ”‚   โ”œโ”€โ”€ battles.js          # Battle results
โ”‚   โ”œโ”€โ”€ chat.js             # Community chat
โ”‚   โ”œโ”€โ”€ comments.js         # Animal comments
โ”‚   โ”œโ”€โ”€ community.js        # Community features
โ”‚   โ”œโ”€โ”€ rankings.js         # Power rankings
โ”‚   โ”œโ”€โ”€ search.js           # Search API
โ”‚   โ”œโ”€โ”€ stats.js            # Site statistics
โ”‚   โ””โ”€โ”€ votes.js            # Voting system
โ”‚
โ”œโ”€โ”€ lib/                    # Shared backend utilities
โ”‚   โ”œโ”€โ”€ mongodb.js          # Database connection
โ”‚   โ”œโ”€โ”€ auth.js             # JWT utilities
โ”‚   โ”œโ”€โ”€ discord.js          # Discord integration
โ”‚   โ”œโ”€โ”€ xpSystem.js         # XP/leveling system
โ”‚   โ””โ”€โ”€ models/             # Mongoose models
โ”‚       โ”œโ”€โ”€ Animal.js
โ”‚       โ”œโ”€โ”€ BattleStats.js
โ”‚       โ”œโ”€โ”€ ChatMessage.js
โ”‚       โ”œโ”€โ”€ Comment.js
โ”‚       โ”œโ”€โ”€ RankHistory.js
โ”‚       โ”œโ”€โ”€ SiteStats.js
โ”‚       โ”œโ”€โ”€ User.js
โ”‚       โ”œโ”€โ”€ Vote.js
โ”‚       โ””โ”€โ”€ XpClaim.js
โ”‚
โ”œโ”€โ”€ scripts/                # Admin/development scripts
โ”‚   โ”œโ”€โ”€ migrations/         # Database migrations
โ”‚   โ”œโ”€โ”€ data-tools/         # Data manipulation tools
โ”‚   โ””โ”€โ”€ assets/             # Audited, dry-run-first animal image pipeline
โ”‚
โ”œโ”€โ”€ images/                 # Static images
โ””โ”€โ”€ animal_stats.json       # Backup animal data

๐Ÿ“ก API Endpoints

Endpoint Method Description
/api/animals GET Get all animals
/api/animals POST Create new animal
/api/animals/[id] GET/PUT/DELETE Single animal operations
/api/search GET/POST Search animals
/api/random GET Random animal(s)
/api/stats GET Database statistics
/api/health GET Health check
/api/auth/signup POST Create account
/api/auth/login POST Login
/api/auth/me GET Get current user

๐Ÿ› ๏ธ Technologies

Frontend: HTML5, CSS3, JavaScript, Chart.js, Font Awesome
Backend: Vercel Serverless Functions, MongoDB Atlas, Mongoose
Auth: JWT, bcryptjs

๏ฟฝ Documentation

๏ฟฝ๐Ÿ“ License

MIT License - see LICENSE for details.

About

Animal Battle Stats: The animal powerscaling database. Compare matchups, rank the roster, and run tournaments to see who comes out on top.

Topics

Resources

Contributing

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages