Getting started
===
## Tools needed:
* VSCode
* GIT
* Postman
* Robo3t / MongoDb Compass
* Node@14.15.1
## Code repositories:
Clone the backend repository from github
https://github.com/SPARKLEWINNER/sandbox-backend.git
Clone the frontend repository from gitlab
https://gitlab.com/sparklewinner/sandbox-pwa.git
## Local environment setup:
Note: Admin client frontend is located on the same folder of the backend app inside the ./client folder
#### BACKEND
Create a .env file and copy-paste the following values
```
ADMIN_APP_URL="https://sandbox-admin-client.pages.dev"
AWS_ACCESS_KEY=""
AWS_BUCKET_NAME=""
AWS_BUCKET_REGION=""
AWS_SECRET_KEY=""
BRAINTREE_MERCHANT_ID=v392w7zt62t6fz53
BRAINTREE_PRIVATE_KEY=c24ca3b6a026f87e09227b1076ff2d66
BRAINTREE_PUBLIC_KEY=nvcp5s844hdhzwd2
EXPRESS_API=https://spark-express.herokuapp.com/api
FIXIE_URL=http://fixie:Ha8vv28eslcOc8R@velodrome.usefixie.com:80
IMGIX_SUBDOMAIN=""
JWT_SECRET=secret
LIBRATO_PASSWORD=305d0e80b0c800fd
LIBRATO_TOKEN=ffd2e34e18dc5a4d15aa3a36dec1225f16609aba4a4a9bc171c1f305d509fa0a
LIBRATO_USER=app186125603@heroku.com
MONGO_KEY=mongodb://localhost:27017/sandbox-stage-local?readPreference=primary&directConnection=true&ssl=false
NEW_RELIC_LICENSE_KEY=4fad120c5fc937da02ff499a6276c7ac61a4NRAL
NEW_RELIC_LOG=stdout
PAPERTRAIL_API_TOKEN=gJMK6wTBBwszzCKZOLAk
REACT_APP_API_SOCKET_URL=https://com-sparkle-sparkle.herokuapp.com
REACT_APP_API_URL=https://com-sparkle-sparkle.herokuapp.com/api
REACT_APP_VPS_ENV_KEY=live
REACT_APP_VPS_TOKEN_KEY=CODEX@123
REACT_APP_VPS_URL=https://cdn.sparkles.com.ph
SEND_GRID_KEY=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
SENDINBLUE_KEY=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
SG_ACCOUNT_RESET_NOTIFICATION=d-cea7c946e0674912973ce2cf976e15ab
SG_ENDPOINT=https://api.sendgrid.com/v3/mail/send
SG_ORDER_NOTIFICATION=d-293e67df04ad45799053988e6d11d10b
TZ=Asia/Singapore
VORTEX_CLIENT_KEY="Tw9K28BRxBrDGGg0pRgPiKT8rVYa"
VORTEX_CLIENT_SECRET_KEY="1Yp7ftinlsiFuY_1vSCBOJl4zrYa"
VORTEX_TOKEN_BASE_URL="https://stg-wso2.pldtglobal.com:8243"
VORTEX_URL="https://stg-wso2.pldtglobal.com:8243"
VORTEX_DISCORD_REFUND_WEBHOOK=https://discord.com/api/webhooks/971946136019537961/4TYbkHryGhMuZh5DIpJp_bXysDCij572KBn5BbutB9IRn3b9GPjl-jYuOGy8ZpsB-eJ8
```
#### FRONTEND (Admin website)
On the ./client folder create a .env file and copy-paste the following values
```
REACT_APP_API_SOCKET_URL=http://localhost:8001
REACT_APP_API_URL=http://localhost:8001/api
```
Run the following commands
```
npm run client-install
```
```
npm install
```
You should be able to run the backend application using the following command
```
npm run dev
```
#### FRONTEND (Cashier app)
Create a .env.development file and copy-paste the following values
```
GATSBY_APP_API_URL=http://localhost:8001
GATSBY_APP_STORYBLOK_KEY=fSge8K7a0TyLrF2nZW72uAtt
GATSBY_APP_TAWKTO_KEY=af2453a9ecc5fe58c525e1f39d244635c8520fe3
GATSBY_APP_TEMP_USERID=5ff4481563135b0017a60a82
GATSBY_APP_VORTEX_CLIENTREQID=SANDBOXPWA
GATSBY_SENTRY_DSN=https://31a4dbecebfb42188c95a673ed72a14e@o506895.ingest.sentry.io/6253887
GATSBY_SENTRY_ENV=PRODUCTION
GATSBY_DISCORD_URL=https://discord.com/api/webhooks/993745196040851467/zhWQ4NL4c6YZ237uKAqjUIH9KQ1wu1Of48LV6j_oM9IQQNQZQupq_jmbwU78CEYxQmkT
```
Run the following commands
```
npm install
```
You should be able to run the frontend application using the following command
```
npm run start
```
#### Add the default admin account
Create a collection called "all-users" and insert this document
```
{
"_id": {
"$oid": "5f728c8ffc645c0017a903f9"
},
"role": 99,
"history": [],
"photo": "https://com-sparkle-s3-prod.imgix.net/16507282315098110cf89-7cdc-40e0-8754-2ac9049ce249",
"name": "Sandbox Admin",
"phone": "1234567891",
"address": "fern building, P. Paredes Street, Sampaloc, Manila, Metro Manila, Philippines",
"email": "sandbox@admin.com",
"salt": "60822f30-01f2-11eb-a440-0f11879cbad1",
"hashed_password": "5c2682df84ce5eb7a811e8e415632ac877d3ed26",
"createdAt": {
"$date": {
"$numberLong": "1601342607781"
}
},
"updatedAt": {
"$date": {
"$numberLong": "1658304651148"
}
},
"__v": 0,
"status": 1
}
```
After the steps above go to http://localhost:3000/
then try to sign in the default admin account using this credentials
Username: sandbox@admin.com
Password: 123456
now you can start adding and expirementing new features safely!! 🎉🎉