K-App application repository
This repo contains the application used to manage the association.
It is written in javascript (back) and typescript (front). It uses these frameworks:
- Express for the web server.
- Sequelize as ORM.
- Angular 8 for the front app.
- Eslint, TSlint, StyleLint as linters.
And we use MySQL and MongoDB as databases.
For a production environment, please check this document which explain everything :).
To contribute to the project you will need:
- NodeJS version 10.0.x or higher.
- Yarn version 1.9.0 or higher.
- MySQL version 5.7 or higher. Please note that your MYSQL server must be configured as
case insensitivein order to perform migration scripts (how to) - MongoDB version 4.0 or higher.
- Python 3 latest version.
- Git. For windows, for linux :
sudo apt-get install git
After installing NodeJS,
you have to install node-gyp as recommended
here.
Optional:
- Text editor: Visual code https://code.visualstudio.com/
- Or a full IDE: Webstorm (student licence available)
Clone the repo with git clone https://github.com/K-Fet/K-App.git.
Then, run yarn.
The application comes with a small cli which provide multiple actions. Some of them are used only in production, others are used only in development.
To configure your environment, copy /tools/config-samples/.env.example to /.env.
Then you just have to edit field as you want (cp tools/config-samples/.env.example .env).
P.S.: The file .env is already ignored by git.
As the project could be used in two different dev env, we need two different configurations for the proxy of the front.
Here, we want to use the docker configuration. So just copy the local.proxy.conf.json file using: cp local.proxy.conf.json proxy.conf.json
P.S.: The file proxy.conf.json is already ignored by git.
Environment variables are parsed with nconf.
The separator used is __ and words are transformed into camelCase.
E.g.: WEB__JWT_SECRET will be access with conf.get('web:jwtSecret').
To launch the app, run: yarn run dev:back and yarn run dev:front in two terminal instances.
The front will be available at http://localhost:4200 and the back at http://localhost:3000.
All API calls made to the front will be transferred to the back.
As you have to follow eslint and tslint configured guidelines, you can install these plugins to watch linter errors.
The app uses nodemon to watch for code change. The app will restart or reload when you edit the code.
To contribute to the project you will need:
- docker: version 19.0.x or higher
- docker-compose: version 1.24.0 or higher
Use cd to the root directory of the project.
To configure your environment, copy /tools/config-samples/.env.docker.example to /.env.
Then you just have to edit field as you want (cp tools/config-samples/.env.docker.example .env).
P.S.: The file .env is already ignored by git.
As the project could be used in two different dev env, we need two different configurations for the proxy of the front.
Here, we want to use the docker configuration. So just copy the docker.proxy.conf.json file using: cp docker.proxy.conf.json proxy.conf.json
P.S.: The file proxy.conf.json is already ignored by git.
Then: docker-compose up
docker-compose will create 4 different containers:
k-app-mongo: a mongodb serverk-app-mysql: a mysql serverk-app-back: which run the node process of the backendk-app-front: which run the process of the frontend
Launch the tests: yarn test
Create coverage report: yarn run coverage