Skip to content

Instantly share code, notes, and snippets.

@shiningnicholson95
Last active September 11, 2019 08:53
Show Gist options
  • Save shiningnicholson95/5ddb4801feb10c70fe2d9a23597ab7e3 to your computer and use it in GitHub Desktop.
Save shiningnicholson95/5ddb4801feb10c70fe2d9a23597ab7e3 to your computer and use it in GitHub Desktop.

Initial Setup Guides

SmartHub

Installing Node.js

  1. Node.js is essential for the project. Download it here: https://nodejs.org/en/. Download the LTS version.
  2. Install ‘n’. It maintains the version of node.js from time to time.
  3. In your terminal install “Nodemon”. Nodemon is an npm package.
  4. Run the command: npm install nodemon –g

Above command installs the nodemon globally.

Installing VS Code plus essential extensions:

  1. VS Code is the preferred code editor. Download it here: https://code.visualstudio.com/
  2. Install Prettier extension in VS code: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
  3. Install ESLint extension in VS code: https://github.com/Microsoft/vscode-eslint
  4. Install the optional extensions 'Visual Studio Intellicode', 'Path IntelliSense', 'Formatting toggle' for the ease of development. These extensions are really useful for the project.

Get the SmartHub Code

  1. Request access to bitbucket by sending mail to: pk@ivendsmart.com. The client will provide you access via your mail id that you had sent to them with required credentials for bitbucket.
  2. Once the access is granted(client will send an email for you to join their bitbucket repo), login to your bitbucket account. you will see your account with the details of cloning the project, it would start with git clone https://<your_bitbucket_username>@bitbucket.org/curbhunger/ch_smarthub.git
  3. Open VS Code Editor and Run the following command on your terminal: git clone https://<your_bitbucket_username>@bitbucket.org/curbhunger/ch_smarthub.git

The above command will clone the project repo in your local machine.

Creating a Database:

  1. Install mySQL database locally. The version to be installed is mySQL 8.0. Pick the installer from here based on your operating system and architecture - https://dev.mysql.com/downloads/mysql/
  2. Optionally install mySQL workbench or some sort of database access tool. https://dev.mysql.com/downloads/workbench/
  3. Remember the password you set to the DB server while installing the database.
  4. Log in to the database using mySQL workbench, create a database called “curbhunger”.
CREATE DATABASE curbhunger;
USE curbhunger;
CREATE USER 'root'@'localhost' IDENTIFIED BY 'curbhunger';
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('curbhunger');
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'curbhunger' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'curbhunger'@'%' IDENTIFIED BY 'curbhunger' WITH GRANT OPTION;
GRANT RELOAD,PROCESS ON *.* TO 'root'@'localhost';
GRANT USAGE ON *.* TO 'root'@'localhost';
FLUSH PRIVILEGES;

  1. The Database would be empty. To create tables within the database we will have to configure few files with some parameters in the project in VS Code(discussed ahead).

Setting up connection with the Database:

Once the database is created in your local machine, configuration within the project is required.

  1. Open your smarthub project in VS code, under config folder, go to config.js file.
  2. Under the development section, change the username, password to the ones that your mysql root@localhost has. Define the database ‘curbhunger’ in the "database" key, thus establishing the connection.
  development: {
    username: 'root', // required params for establishing connection with database.
    password: 'root', // required params for establishing connection with database.
    database: 'curbhunger', // required params for establishing connection with database.
    host: '127.0.0.1',
    dialect: 'mysql',
    enableHooks: process.env.HOOKS_ENABLED || false,
  }

Start the server:

  1. Run "npm install" in the root folder of the codebase [i.e., ch_smarthub folder] ch_smarthub> npm install
  2. After successful installation of the packages, run "nodemon" command from the same folder to create the initial schema and the tables \ch_smarthub> nodemon. Check your database "curbhunger". If the nodemon command went smoothly, you will be able to see new tables created under your database.
  3. Open a new terminal window/command prompt and go to smarthub root folder, Run following command to seed all the data:npm run seed If the above command gets executed successfully, head back to your database "curbhunger". You will see that all the data has been seeded into their respective tables.
  4. Open your browser and head to http://localhost:3000
  5. If everything went well, you should see the login screen.
  6. Login into the smarthub dashboard with the following credentials:

Email: pk@ivendsmart.com
Password: DummyPassword

  1. If the above step is successful, you would be able to access the dashboard of SmartHub Application. You can start your work accordingly then.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment