Manager for panel based questions games.
- Node.js
- MongoDB: Data Storage
- Express.js: API service framework
- React: Frontend framework
- Docker: Provides a way to run applications securely isolated in a container.
quiz-up
├───── app/ # All of the client side code
| | ├── public/ # All public assets
| | ├── src/
| | | ├── config/ # Configuration files
| | | ├── constants/ # Constant files for the forms and components
| | | ├── containers/ # React containers
| | | ├── components/ # React components
| | | └── helpers/ # Helper functions used in the frontend section of the file
├───── pwa/ # All of the mobile app side code - same structure as app/
├───── server/ # All server side code
| | ├── src/ # Source directory for the server
| | | ├── config/ # Configuration files
| | | ├── rest/ # "heart" of the API
| | | | ├── components # Each component takes care of its own routes, controller and model
| | | | └── utils # API's utils
| | | └── services/ # files for external services. E.g: sending mails
| | | └── index.js # Initialize server and handle routes and services
| | | └── serviceAccountKey.json # Keys for the firebase app
└── package.json # All dependencies and script to run the application
└── babel.config.js # Babel configuration file
└── Dockerfile # file that contains the commands needed to assemble an image
└── .docker-compose.yml # file defining services, networks and volumes for docker containers
└── .gitignore # files ignored by git
└── .dockerignore # files ignored by docker
└── .nvmrc # handles the node version
└── README.md # README file- Node.js v10: Strongly recommend to use
nvmto manage different versions ofnodeand take advantage of the.nvmrcfile. Installation guide
You need to have docker and docker-compose installed to run this project. If you don't have it installed you can follow this guide for docker and this one for docker-compose.
-
First clone this repository.
-
git clone git@github.com:ect-pucmm/quiz-up.git
-
-
navigate to the directory you cloned the project.
-
cd quiz-up
-
-
Add the neccessary environment variables for the server in its own
.envfile in/server/.env,/app/.env,/pwa/.env(More info on the this section) -
When you're in the root directory type the command
npm run install-alland then:- To start the server in a local environment:
docker-compose up
- To start the client admin app:
-To start the mobile app:
npm run react
npm run pwa
- To
installthe app you need to runnpm run serve-pwaand after that runngrokon port 5000 and open the app in thehttpsURL.
- To
- To start the server in a local environment:
-
For the admin dashboard
(/app/.env)and the PWA(/pwa/.env):- REACT_APP_QU_BASE_API: URL that will be calling the server/API (e.g:https://myDomain.com)
- REACT_APP_QU_LOCAL_API: URL that will be using the server/API locally (e.g:http://localhost:5000)
-
For the server
(/server/.env):- PORT: Port number to run the API
- MONGO_URI: URI to connect to the mongo database locally
- MONGO_DOCKER_URI: URI to connect to the mongo database in docker
- NODE_ENV: Node environment value
- GOOGLE_APPLICATION_CREDENTIALS: Firebase credentials used for the user management
npm run burn: Stops and removes all containersnpm run install-all: Install dependencies in all directoriesnpm run lint: Check the code based oneslintrulesnpm run prettier: Check the code based onprettierrulesnpm run react: Starts local client appnpm run pwa: Start the mobile app locallynpm run serve-react: Run the local client as if it were on productionnpm run serve-pwa: Run the mobile app as if it were on productionnpm run stop: Stops all containers
npm start: Starts the application in a production environmentnpm run build: Compiles the code from ES6 to ES5.npm run dev: Starts the application in a development environment
npm start: Run the app in development modenpm run build: Builds the app for production to the build folder
npm start: Run the app in development modenpm run build: Builds the app for production to the build folder
Integrating ESLint and Prettier into VSCode
- Add the prettier extension (Extension ID:
esbenp.prettier-vscode) - Add the ESLint extension (Extension ID:
dbaeumer.vscode-eslint) and restart VSCode afterwards. - Create and/or go to your
.vscode/settings.jsonfile at the root of this project. - Copy the following chunk in your
settings.jsonfile:
-
{ "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": true }, "editor.quickSuggestions": { "strings": true } }