If you want to develop FullStack locally you must follow the following instructions:
- Clone fullstack-pro locally
git clone https://github.com/cdmbase/fullstack-pro
cd fullstack-pro
-
Install dependencies and build packages.
a. make sure
python
version2.7.16
or higher in^2
version installed.b. install
node-gyp
globally. For installation check this document.c. install
watchman
for macOS usersd. Node version supported is
>=12.18.4
andyarn
version is1.22
. You can Download Node from heree. Insall and build packages using following command. Run from the root folder of this project.
yarn global add lerna@6
yarn bootstrap
- Setup environment file
You need to have environemnt file before you start the project. There is a sample file exist at config/development/dev.env.sample
which you can copy as config/development/dev.env
.
cp ./config/development/dev.env.sample ./config/development/dev.env
You may need to set personalized values in the dev.env
file.
- Start server MongoDB and Redis (look for Installation Section)
redis-server
mongod
- Start both client and server together
yarn start
Alternatively, if you need to run backend
and frontend
on its respective terminal instead of one terminal then follow How to Start Backend and Frontend seperately
The graphql server endpoints are
The browser server endopoint is
To run build with watch for dependent packages, for auto reloading changes into the server to be productive during development.
yarn watch-packages
If you also need to watch along with it, you can use as many scopes as required like below.
yarn watch-packages -- --scope=@sample-stack/counter-module* --scope=@packageb
To run build with watch for all the packages. Note: This will run watch on all packages under packages-modules
and may saturate the resources in your laptop instead run above watch-packages
command.
yarn watch
Sometimes if we have to run build
or watch
you can use the lerna
command for the targeted packages
lerna exec --scope=<package name> yarn watch
- here
<package name>
will be the package you working on currently. If you have multiple packages, then you need to run it multiple times for each package in its respective terminal.
Most of the changes at code level can be taken using git
command.
But in some cases when lerna's packages
are added or versions in packages.json
are updated, to avoid getting installed duplicate pacakges due to monrepo architecture you need to first clean existing node_modules
and reinstall again. This can be done with following command.
yarn clean:force && git pull <branch_name> && yarn install && yarn build
- here <branch_name> should be replaced with the branch you getting updates.
Install redis and mongo and setup an instance with default settings on default port, Please check the installation documentation of each one.
MongoDB install : https://www.mongodb.com/docs/manual/administration/install-community/ Redis install: https://redis.io/docs/getting-started/
You need to run Frontend and Backend in two seperate servers.
to start frontend server
lerna exec --scope=*frontend-server yarn build
lerna exec --scope=*frontend-server yarn start:dev
to start backend server
lerna exec --scope=*backend-server yarn build
lerna exec --scope=*backend-server yarn start:dev
Note: you can pass :<env>
next to start
to use env config.
- dev: to use
/config/development/dev.env
- stage: to use
/config/staging/staging.env
Build three docker images by following the steps:
- Frontend Server
lerna exec --scope=*frontend-server yarn docker:build
lerna exec --scope=*frontend-server yarn docker:run
- Backend Server
lerna exec --scope=*backend-server yarn docker:build
lerna exec --scope=*backend-server yarn docker:run
- moleculer-server
lerna exec --scope=*moleculer-server yarn docker:build
lerna exec --scope=*moleculer-server yarn docker:run
Note: It uses /config/staging/staging.env
for environment variables.
GRAPHQL_URL
CLIENT_URL
NATS_URL
NATS_USER
NATS_PW
To troubleshoot webpack configuration run
yarn zen:watch:debug