Skip to content

ZachMuzzle/Dino_App

Repository files navigation

Contributors

LinkedIn


Logo

Dinosaur Generator App

A CRUD side project that works with APIs, AWS, Databases, Firebase, and more
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

Dino App

I’ve been working on a CRUD web application as part of a learning project to familiarize myself with industry standards and tools. The core features include secure account creation and login functionality. I’ve integrated Firebase for robust security and thorough testing. On the backend, I’m using AWS EC2 to host the server, while an AWS-managed database handles data storage for production, ensuring reliability and scalability.

Building this application and working with these industry-standard tools has given me a deeper understanding of full-stack development. It also equips me to efficiently reuse the tools and code I’ve developed for future projects, streamlining my workflow and enhancing project scalability.

(back to top)

Built With

Javascript NodeJS Express AWS EC2 AWS RDS Firebase Docker

(back to top)

Getting Started

This section will cover how you can get this running locally on your own computer

  1. Have npm installed: run npm install -g npm use npm -v to check which version you are on
  2. In package.json under scripts we add dev: nodemon index.js. This is for running the server automatically after each change.
  3. Install express: run npm install express
  4. Install nodemon: npm install nodemon --save-dev
  5. Next you want to make sure you have Node up-to-date, check using node --version.
  6. You can download nvm as an easy way to switch between different nodes. nvm github
  7. You can also just download to the latest version if you don't want to use nvm:
    1. sudo npm cache clean -f
    2. sudo npm install -g n
    3. sudo n stable
  8. Everything should be up-to-date now. Go ahead in directory of index.js and run npm run dev. You should see something like this: output
  9. You will need to create an .env file and have one line of text with API_KEY= followed by the api-key
  10. Using Rapid API
    1. Pick image search
    2. In the required parameters under q String; type the word dinosaur
  11. Now use the X-RapidAPI-Key and place that in your .env file.
  12. Now you should be able to run npm run dev again and now when the button is clicked images will be displayed.

Prerequisites

Make sure npm is installed

  • npm
    npm install npm@latest -g

Installing MySQL Locally

  • You will need too install MySQL to be able to work with the local database for storing users and dinos.
  • To do this follow the steps below
  1. Install MySQL APT Repo from link
  2. dpkg the file that was downloaded. Find where the file is located and sudo dpkg -i the deb file
  3. sudo apt update
  4. sudo apt install mysql-workbench-community
  5. connect to the mysql using sudo mysql -u root
  6. You will need to alter the user Alter user by ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
  7. FLUSH PRIVILEGES

To connect to the database while using docker you will have to complete a few items

  1. Download vim
  2. Once vim is downloaded run sudo vim /etc/mysql/mysql.conf.d/mysqld.cnfand add bind-address=0.0.0.0
  3. Next you will need to create a new user that can be used on any host.
  4. Open MySQL mysql -h localhost -u root -p
  5. Then run the following commands: CREATE USER 'root'@'%' IDENTIFIED BY 'yourpassword'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES; ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'newpassword'; newpassword is whatever you want. FLUSH PRIVILEGES;
  6. Now when you get to docker compose up --build the database should be setup to run on the virtual machine with the docker ip address.

Using Docker

Downloading Docker/Prerequisites

  • After downloading docker you may run into issues when trying to use docker.
  • I used this issues page to resolve some of my issues link
  • You can run sudo apt install python3-setuptoolsif running into compose up issues
  • Make sure to use compose up and not compose-up (deprecated)
  1. This project has been updated to be able to run in the dev and prod env by creating a docker image and running the container. Below will walk you through on how you can setup the codebase to run on your machine.
    1. The Dockerfile and docker-compose.yml are setup to be used in the dev env
    2. Below in the CLI you will have to build the docker image. Normally we would do the building and then then running manually, but with the help of the docker-compose.yml file it allows this project to be built and run automatically. You can choose either to run on the CLI or run in the background
# Build docker image and run container
docker-compose up --build
# Build and run in the background
docker-compose up --build -d
# Update and run docker container in background
docker-compose up -d
  1. If you have any trouble with docker not allowing you to access use the command below
# Give docker access
sudo chmod 666 /var/run/docker.sock
  1. Here are also a few commands that help with restarting docker and killing containers or delete images/containers
# Kill images/container (Use if nothing is working)
sudo systemctl restart docker.socket docker.service
# Kill specific docker container
sudo docker stop <container-id>
# Delete all unused images and containers
docker system prune
# Removes all images without at least one container associated to them.
docker image prune -a
# Force remove docker images
docker rmi -f $(docker images -q)
# Removes all systems and volumnes
docker system prune --all --volumes

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

Contact

Zachary Muzzleman - zmuzzlem@gmail.com

Project Link: https://github.com/zachmuzzle/Dino_App

(back to top)