From 94ada36dfa62195b6414c999a0323eba3e74d0c8 Mon Sep 17 00:00:00 2001
From: Louis Lam <louislam@users.noreply.github.com>
Date: Tue, 26 Apr 2022 02:20:13 +0800
Subject: [PATCH] Update dev guideline

---
 CONTRIBUTING.md | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index cf5cb761..c4510af1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -79,7 +79,7 @@ I personally do not like something need to learn so much and need to config so m
 - 4 spaces indentation
 - Follow `.editorconfig`
 - Follow ESLint
-- Methods and funtions should be documented with JSDoc
+- Methods and functions should be documented with JSDoc
 
 ## Name convention
 
@@ -90,9 +90,10 @@ I personally do not like something need to learn so much and need to config so m
 ## Tools
 
 - Node.js >= 14
+- NPM >= 8.5
 - Git
 - IDE that supports ESLint and EditorConfig (I am using IntelliJ IDEA)
-- A SQLite tool (SQLite Expert Personal is suggested)
+- A SQLite GUI tool (SQLite Expert Personal is suggested)
 
 ## Install dependencies
 
@@ -100,39 +101,42 @@ I personally do not like something need to learn so much and need to config so m
 npm ci
 ```
 
-## How to start the Backend Dev Server
+## Dev Server
 
-(2021-09-23 Update)
+(2022-04-26 Update)
+
+We can start the frontend dev server and the backend dev server in one command.
+
+Port `3000` and port `3001` will be used.
 
 ```bash
-npm run start-server-dev
+npm run dev
 ```
 
-It binds to `0.0.0.0:3001` by default.
+## Backend Server
 
-### Backend Details
+For development, it binds to `0.0.0.0:3001` by default.
+For production, it binds to  `0.0.0.0:3000` by default.
 
 It is mainly a socket.io app + express.js.
 
 express.js is just used for serving the frontend built files (index.html, .js and .css etc.)
 
+
+### Structure in /server/
+
 - model/ (Object model, auto mapping to the database table name)
 - modules/ (Modified 3rd-party modules)
 - notification-providers/ (individual notification logic)
 - routers/ (Express Routers)
 - socket-handler (Socket.io Handlers)
-- server.js (Server main logic)
+- server.js (Server entry point and main logic)
 
-## How to start the Frontend Dev Server
+## Frontend Dev Server
 
-1. Set the env var `NODE_ENV` to "development".
-2. Start the frontend dev server by the following command.
+It binds to `0.0.0.0:3000` by default. Frontend dev server is used for development only. 
 
-   ```bash
-   npm run dev
-   ```
-
-   It binds to `0.0.0.0:3000` by default.
+For production, it is not used. It will be compiled to `dist` directory instead. 
 
 You can use Vue.js devtools Chrome extension for debugging.