The Rivalry is a fun and lighthearted web app where users can vote for their favorite: cats or dogs.
It showcases basic full-stack functionality including API use, POST requests, a PostgreSQL database, and simple login authentication.
- Vote for your favorite pet (cat or dog)
- View vote results from all users
- Register and log in using Passport.js for local authentication
- Secure password storage with bcrypt
- Simple session handling with
express-session - Fetch random pet images via external APIs from That API Company
- Uses Axios for HTTP requests
- PostgreSQL database to manage users, pets, and votes
- Templated views using EJS
- Node.js + Express
- EJS (templating)
- PostgreSQL
- Passport.js (authentication)
- bcrypt (password hashing)
- express-session (login sessions)
- Axios (API requests)
- dotenv (environment configuration)
git clone https://github.com/anastasia-lobareva/the-rivalry.gitMake sure you're in the project root directory, then run:
npm installYou can either:
- Copy the queries from the
queries.sqlfile and run them manually in pgAdmin 4,
or - Use the terminal command below to run the SQL file directly via the command line:
psql -U your_user_name -d your_database_name -f queries.sqlMake sure pgAdmin 4 or PostgreSQL is installed and running, and that psql is available in your terminal.
Create a .env file in the root directory and add the following variables:
SESSION_SECRET="your_secret_word"
PG_USER="your_postgres_username"
PG_HOST="localhost"
PG_DATABASE="your_database_name"
PG_PASSWORD="your_postgres_password"
PG_PORT="5432"Run the following command to start the server:
npm startThen open your browser and visit:
- This project is for learning and demo purposes only.
- Votes are tied to user accounts — users must be logged in to vote.
- Pet images are powered by That API Company.
This project is open-source and available under the MIT License.
Pull requests, suggestions, and improvements are welcome!
Feel free to fork this repo and use it in your own projects or portfolio.