Welcome to Cascarita! This file provides instructions on how to run important commands and navigate through the project.
Before you begin, make sure you have the following installed:
- brew - Make sure brew is installed
- Install Node
brew install node
- Setup the MySQL database
# install and activate mysql service
brew install mysql
brew services start mysql
# This will log you into SQL CLI (ie. mysql>)
mysql -u root
# Lastly create the following database
CREATE DATABASE test_db;
- Setup the MongoDB database
# Download the official Homebrew formula for MongoDB
brew tap mongodb/brew
# Install MongoDB
brew install mongodb-community@7.0
# Start the MongoDB service
brew services start mongodb-community@7.0
- Clone the repository to your local machine
git clone git@github.com:cascaritaco/cascarita.git
- Change into the project directory:
cd cascarita
- Install project dependencies:
npm install
-
Create a free MongoDB Atlas cluster here.
-
Once your cluster is created, get your connection string to extract the username, password, url, and app name.
mongodb+srv://USERNAME:PASSWORD@$URL/?retryWrites=true&w=majority&appName=$APPNAME
- Copy
.env.example
into a new file named.env
. Populate theMONGO_*
environment variables from.env
with the data extracted from the connection string.
# MongoDB cluster configuration
MONGO_CLUSTER_USERNAME=
MONGO_CLUSTER_PASSWORD=
MONGO_CLUSTER_DB_NAME=
MONGO_CLUSTER_URL=
MONGO_CLUSTER_APP_NAME=
- If your MySQL database requires a password, make sure you set that password in the
.env
as well.
DB_NAME=test_db
DB_PASSWORD=your-password
If you haven't done so, please download Docker Desktop, and start the Docker daemon, then run:
# load the environment variables
cp .env.example .env
# build the images
docker-compose build
# start the client and server container
docker-compose up
NOTE: It's important to ensure that for local connections to database from the server container, specify within the .env
DB_HOST=host.docker.internal
. This will be the way we are planning on deploying our applicaton to the cloud!
To run the project locally, use the following command:
# load the environment variables
cp .env.example .env
# runs react frontend on port 3000 and backend node server on port 3001
npm run dev
NOTE: In order for this to work you will need to ensure that .env
DB_HOST=127.0.0.1
.
To run the project as in production:
# load the environment variables
cp .env.example .env
# builds the `dist` directory used to serve frontend
npm run build
# starts the node server
npm run start
To run the Jest tests:
npm run test
To see total testing coverage:
npm run coverage
To identify and fixing problems in our code:
npm run eslint
To run any Sequalize migrations:
npm run sequelize:migrate