Skip to content

Instantly share code, notes, and snippets.

@hashg
Forked from shiningnicholson95/SetupGuide.md
Last active November 20, 2019 22:38
Show Gist options
  • Save hashg/230dcd2537cbbfbc11a74e36b5042b64 to your computer and use it in GitHub Desktop.
Save hashg/230dcd2537cbbfbc11a74e36b5042b64 to your computer and use it in GitHub Desktop.
Smarthub setup

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. 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.
  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 'password';
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password');
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'curbhunger'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
GRANT RELOAD,PROCESS ON *.* TO 'root'@'localhost';
GRANT USAGE ON *.* TO 'root'@'localhost';
FLUSH PRIVILEGES;

mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
  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, go to ./config/config.js file.
  2. Under the development section, change the username, password. Define the database ‘curbhunger’ in the "database" key, thus establishing the connection.
  development: {
    username: 'root', // required params for establishing connection with database.
    password: 'password', // 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] npm install
  2. After successful installation of the packages, run nodemon command from the same folder to create the initial schema and tables. 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
  4. 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.
  5. Open your browser and head to http://localhost:3000
  6. If everything went well, you should see the login screen.
  7. 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