Skip to content

anastasia-lobareva/the-rivalry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐱 The Rivalry 🐶

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.


🚀 Features

  • 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

🧰 Technologies Used

  • Node.js + Express
  • EJS (templating)
  • PostgreSQL
  • Passport.js (authentication)
  • bcrypt (password hashing)
  • express-session (login sessions)
  • Axios (API requests)
  • dotenv (environment configuration)

⚙️ Getting Started

1. Clone the repository

git clone https://github.com/anastasia-lobareva/the-rivalry.git

2. Install dependencies

Make sure you're in the project root directory, then run:

npm install

3. Set up the database

You can either:

  • Copy the queries from the queries.sql file 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.sql

Make sure pgAdmin 4 or PostgreSQL is installed and running, and that psql is available in your terminal.

4. Configure environment variables

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"

5. Start the server

Run the following command to start the server:

npm start

Then open your browser and visit:

http://localhost:3000

📌 Notes

  • This project is for learning and demo purposes only.
  • Votes are tied to user accounts — users must be logged in to vote.

🙏 Acknowledgments


📄 License

This project is open-source and available under the MIT License.


🤝 Contributions

Pull requests, suggestions, and improvements are welcome!
Feel free to fork this repo and use it in your own projects or portfolio.


🐾 Let the ultimate battle begin!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors