Skip to content

Instantly share code, notes, and snippets.

@stillsheryl
Last active February 13, 2021 21:02
Show Gist options
  • Save stillsheryl/6d40459c701aab533b4cb614053af2ea to your computer and use it in GitHub Desktop.
Save stillsheryl/6d40459c701aab533b4cb614053af2ea to your computer and use it in GitHub Desktop.
Notes for Crate README

Crate

Setup and Running

  • Prerequisites

    • Node
    • MySQL (or Postgres / Sqlite / MSSQL)
  • Clone repo git clone git@github.com:demaceo/crate-1.git

  • CD into crate and then code directory: cd crate, cd code

  • Configurations

    • Modify /api/src/config/database.json for database credentials

      1. Check your available postgres users by running \du in the postgres CLI. Choose one of the names (“postgres” should be fine) to put as your username in the database.json.
      2. If you followed the default installation instructions when install postgres, then you do not need a password. If you have a password created, add that to the database.json file.
      3. Change the "dialect": "mysql" to "dialect": "postgres"
    • Modify /api/.env for PORT (optional)

    • Modify /web/.env for PORT / API URL (optional)

    • API: Install packages and database setup (migrations and seed) cd api and npm run setup

    • Webapp: Install packages cd web and npm install

  • Development

    • Run API cd api and npm start, browse GraphiQL at http://localhost:8000/
    • Run Webapp cd web and npm start, browse webapp at http://localhost:3000/
    • Run Mobile cd mobile and npx react-native run-ios for iOS and npx react-native run-android for Android
  • Production

    • Run API cd api and npm run start:prod, creates an optimized build in build directory and runs the server
    • Run Webapp cd web and npm run start:prod, creates an optimized build in build directory and runs the server

Multi-package automation

  • New developers are advised to run through the above 'setup and running' process before reading further.
  • Optional multi-package automation for faster setup and easier dev environment initiation.
  • No need to cd to sub-folders unless working with mobile or running a production build.
  • Once Node, MySQL, repo clone and configuration are setup correctly

Things we did:

npm i pg

npm install --save-dev sequelize-cli

npm i --save sequelize

npm i -g sequelize-cli

sequelize db:migrate

@stillsheryl
Copy link
Author

Screen Shot 2021-02-13 at 11 46 41 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment