This monorepo is setup for NPM workspaces (https://docs.npmjs.com/cli/v7/using-npm/workspaces)
- A docker compose environment is ready to go out of the box
- Create an env file for the db in
./ojb-tooling/mysql/.env
MYSQL_HOST=db
MYSQL_TCP_PORT=3306
MYSQL_DATABASE=ojb_production
MYSQL_ROOT_PASSWORD=root
- Create an env file for the api in
./ojb-tooling/node/.env
- take a look atexample.env
in/api
APP_ENV_LOADED=1
NODE_ENV=production
JOBFINDER_SITE_URL=http://localhost:8887
NODE_PORT=8080
MYSQL_HOST=db
MYSQL_PORT=3306
MYSQL_USER=root
MYSQL_PASS=root
MYSQL_DB=ojb_production
JWT_SECRET=yOuRsUpErSeCuReSeCrEt
[email protected]
SMTP_HOST=smtp.relay
SMTP_PORT=587
[email protected]
SMTP_KEY=key
MAIL_FROM=mail from <email@here>
UPLOADS_DIR=storage/uploads
ASSETS_DIR=public/assets
- Create an env file for the cms and jobfinder site in
./ojb-tooling/web/.env
- take a look at example.env in/cms
andjobfinder site
.
VITE_API_URL=http://localhost:8080/api/v1
NODE_HOST=cms
NODE_PORT=8888
NEXT_PUBLIC_API_URL=http://api:8080/api/v1
SECRET_COOKIE_PASSWORD=yOuRSuPeRsEcUrEsEcReT
- Copy
api/example.setup.sh
toapi/setup.sh
into the root of the project. - Enter your db credentials to pass into the setup script.
MYSQL_DB=ojb_production MYSQL_USER=root MYSQL_PASS=root MYSQL_HOST=db MYSQL_PORT=3306 node ./config/app-setup.js
- Build the containers
cd ./ojb-tooling
docker-compose up --build
- run the setup script from the api container
docker exec -it ojb-api /bin/bash
sh setup.sh
- Register as a user through the api or the register page on the jobfinder-site
POST: http://localhost:8080/api/v1/register
{
"email": "[email protected]",
"password": "password",
"passwordConfirm": "password"
}
- In the phpMyAdmin container - update your user role to
3
and your email verified at to acurrent timestamp
- Explore the cms
- Explore the job finder site
- Node.js 16.16.0
- NPM 7.24.2
- MySQL 5.7
- From the root of the monorepo - run
npm i
- Follow the environment setup instructions for the api
- Follow the environment setup instructions for the cms
- Follow the environment setup instructions for the jobfinder site
- From the root of the monorepo - run
npm run start
- From the root of the monorepo - run
npm i
- Follow the api environment setup instructions below
- From the root of the monorepo - run
npm run dev:api
-
API Environment
- Set your root environment in
./api/config/config.env
to eitherdevelopment
orproduction
orwhateverenvyoulike
- Then create a file for your environment i.e.
development.env
orproduction.env
orwhateverenvyoulike.env
- take a look at theexample.env
- Set your root environment in
-
Custom environments
Out of the box - OJB comes configured to handle
production
anddevelopment
environment. You can create extra environments by following the naming conventions with your new .env files explained above. Be sure to load your env in the switch statement in./api/env.js
before setting it as the app environment in./api/config/config.env
-
Database seeding - An exmaple setup shell script
./api/dev-data/app-setup.js
is provided to create enough data to see the project in action.- copy
example.setup.sh
tosetup.sh
in/api
. - enter your db credentials to pass into the setup script.
- run the setup script.
- Register as a user through the api.
POST: http://localhost:8080/api/v1/register { "email": "[email protected]", "password": "password", "passwordConfirm": "password" }
- In your db client - update your user role to
3
and your email verified at to acurrent timestamp
- copy
- From the root of the monorepo - run
npm i
- From the root of the monorepo - run
npm run dev:cms
- From the root of the monorepo - run
npm i
- From the root of the monorepo - run
npm run dev:jobfinder-site
- api: query jobs route
- jobfinder-site: build advanced search form
- api: setup email templates for
- job application email
- api: upload route for assets