A starter for React applications. Based on CRA + Node (Express REST APIs) backend.
- Run
npm i
oryarn install
in root folder cd
inserver
folder and runnpm i
oryarn install
cd
inclient
folder and runnpm i
oryarn install
- Start the app by running
npm start
oryarn install
in root folder - You can run only the server with
npm run start:server
(oryarn run start:client
) in root folder ornpm start
(oryarn start
) inserver
folder - You can run only the the client with
npm run start:client
(oryarn run start:client
) in root folder ornpm start
(oryarn start
) inclient
folder
Important info: make sure you create a .env
file in the root of the server
folder by using the .env_template
file. This will act as the centralised list for all ENV variables.
You can choose to install sequelize-cli
globally or keep the local instalation provided by package.json
. If you install sequelize-cli
globally (e.g.: npm i -g sequelize-cli
), you will be able to run all Sequelize related commands (e.g.: migrations) like so:
sequelize db:migrate
If you prefer local installation (does not pollute the system), use the following command:
npm run sequelize db:migrate
If you need to pass arguments to the local instalation of sequelize-cli
(e.g.: creating a new model), make sure to prefix all commands with '--'. E.g.:
npm run sequelize -- model:create --name User --attributes "first_name:string last_name:string"
Postgres
- Make sure you have
postgres
installed. OSX users can simply do that viabrew install postgres
. - Fill in the database related ENV variables with the right info.
- Start Postgres server:
postgres -D /usr/local/var/postgres
(you can alias this) - Cd in
server
folder and runnpm run sequelize db:migrate
orsequelize db:migrate
if you havesequelize-cli
installed globally (check Working with Sequelize CLI section above). - Seed your DB by running
npm run sequelize db:seed:all
orsequelize db:seed:all
if you havesequelize-cli
installed globally
- Make sure you install
watchman
(can fail on OSX) -brew install watchman
(see more details here).
The starter has been built and tested on OS Sierra (10.12.6) using Node (9.3.0) and PostgreSQL (10.1). All instructions are OS X compatible. This software has not been tested on Linux/Windows yet, so please consider finding alternative instructions on your own if you do wish to use nott
on these platforms.
- GraphQL backend
- Discuss the need of linking MongoDB?
- To discuss on client side: