New features are checked here before going to production
Project management for courses and beyond.
deployment on cloud: http://35.226.223.57:8080/
- Front end: React TypeScript
- Back end: NodeJs(Express) TypeScript, MySQL(ORM:Sequelize)
-
Clone the repo to your machine
-
Go to the project directory
-
Run
cd server; npm installto install backend dependencies.
This could take a bit of time, you may use it to call you mother, she worries. -
Create a schema in mySQL (Docker/local), call it what you like (defaults to "crm")
-
Create a 2 backend
.envfiles:- one in /server/
- second in /server/src An example file is provided.
Ubuntu users should remove all quotes from
.envfile. -
Edit
.env.
PORT = 8080; // the port the server will run on
MYSQL_USER = "<DB user>"; // defaults to "root"
MYSQL_PASSWORD = "<your password>";
MYSQL_DATABASE = "<you db schema name>"; // defaults to "crm"
MYSQL_HOST = "127.0.0.1"; // default localhost, depends if you run your db on a Docker
NODE_ENV = "development";
ACCESS_TOKEN_SECRET = "<your secret>";
REFRESH_TOKEN_SECRET = "<another secret>"; // strings used in token creation
EMAIL_USER = ""; // mail used to send user confirmation messages
EMAIL_PASSWORD = "";-
Run
npm run migrateto migrate all required tables into your schema. This could take a while, you can try meditation. -
Optional - Run
npm run seed -
Run
npm run devto start the server in dev mode (nodemon hot reload)
-
Run
cd client; npm installto install frontend dependencies -
Create a client
.envfile. An example is provided. -
Edit
.env, add what you need.
REACT_APP_API_KEY = ""; // google api key for location services- If you have changed
PORTin the server.env, you need to change theproxyproperty in the clientpackage.json
-
Run
npm startto start react in development mode -
To log into the service oyu need credentials, contact your local admin to get them
-
Decide on the feature you are working on
-
Start a new branch with a nice descriptive name
- good name:
add-message-system - bad name:
Shahar-cool-branch-23
- good name:
-
Develop the feature. Try to only work on one feature in a branch for ease of merging.
-
Use the following credentials to log in (requires seeders run):
// Student
{
username: "[email protected],
password: "student123!"
}
// Teacher
{
username: "[email protected],
password: "teacher123!"
}
// Admin
{
username: "[email protected],
password: "Admin123!"
}
-
Commit often, and name the commits descriptively
-
When you have finished work on your feature, create a PR to
devbranch and stop working on your branch. -
If you need the new feature to continue, branch out from your branch and continue in that branch. Else - just start a new branch
-
Alert @listguy that you have finished work and expect some questions about it
-
Once the PR is merged, the branch may be deleted.
If you need to create a new table or modify an existing one, always consult @listguy.
You'll need to create a new migration or model, then migrate them to the DB.
To create a new table, first create a new model:
npx sequelize model:create --name <model name> --attributes <attribute>:<type>,<attribute>:<type>,<attribute>:<type> --underscored trueThis generates a new model in the models dir, and a migration in the migrations dir.
- Don`t forget deleted_at.
- Using
--underscored truemakes the timestamp columns (createdAt,updatedAt) to becamelCasedin the model butsnake_casedin the migration and table (created_at,updated_at).
Sadly it does not work for all the column names, so you'll have to go and change them manually to be underscored in the migration. this extension can help with that. - In the model-init add to the object: tableName with the model name + s (for example if the model name is User the tabelName would be Users), paranoid: true.
- more options
To add new columns to an existing table create new migration. a use:
npx sequelize migration:create --name <model name> --underscored truethen edit the new migration to add the columns you need.
once the migrations are ready, use npx sequelize db:migrate to migrate all new changes to the DB.