-
Prerequisites
- Node
- MySQL (or Postgres / Sqlite / MSSQL)
-
Clone repo
git clone git@github.com:demaceo/crate-1.git
-
CD into
crate
and thencode
directory:cd crate
,cd code
-
Configurations
-
Modify
/api/src/config/database.json
for database credentials- 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.
- 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.
- 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
andnpm run setup
-
Webapp: Install packages
cd web
andnpm install
-
-
Development
- Run API
cd api
andnpm start
, browse GraphiQL at http://localhost:8000/ - Run Webapp
cd web
andnpm start
, browse webapp at http://localhost:3000/ - Run Mobile
cd mobile
andnpx react-native run-ios
for iOS andnpx react-native run-android
for Android
- Run API
-
Production
- Run API
cd api
andnpm run start:prod
, creates an optimized build inbuild
directory and runs the server - Run Webapp
cd web
andnpm run start:prod
, creates an optimized build inbuild
directory and runs the server
- Run API
- 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
- Switch to
code
directorycd code
- Setup
- Setup API, Webapp and Mobile with a single command
npm run setup
- Setup API, Webapp and Mobile with a single command
- Development
- Run API and Webapp
npm start
, browse GraphiQL at http://localhost:8000/ and Webapp at http://localhost:8000/ - Run API alone
npm start:api
, browse GraphiQL at http://localhost:8000/ - Run Webapp alone
npm start:web
, browse webapp at http://localhost:3000/
- Run API and Webapp
- Switch to
Things we did:
npm i pg
npm install --save-dev sequelize-cli
npm i --save sequelize
npm i -g sequelize-cli
sequelize db:migrate