This repo hosts the source code for schemester. Jump to
Following are the steps to begin local development.
git clone https://github.com/ranjanistic/schemester-web.git
Or, recently
gh repo clone ranjanistic/schemester-web
npm install
The session is only created on https (secured) protocol, therefore, before you proceed to steps to run server (for first time setup only), go through the following steps.
First, refer to & follow the mkcert installation steps to enable mkcert
command on your system.
After that,
mkcert -install
This will create local CA certificate on your system trust store. Then in the project root path,
mkcert localhost
This will create localhost.pem
& localhost-key.pem
files locally in project root. Now the local server will automatically use these files to run over https.
Create a .env file at root of the project. Use .sample.env for environment variable keys. Set the SSH value of your choice. Other values will be discussed in next steps.
A .env file with keys is required for the application to run, and the following command will help you set that up automatically.
npm run newconfig
The CLI interface will ask you for your raw keys (unmasked), and will mask some of them in config/config.json using the SSH key provided by you in .env file as an environment variable (set that up in previous step first before doing this).
After finishing, you'll find a config.json file here, and from that file, copy and paste the values of keys into your local .env file, and/or elsewhere as environment variables, with keys from .sample.env & values from config/config.json.
IMPORTANT: After config.json is generated, follow .sample.env to create environment variables by copying their values from the config.json (except SSH, which is your own project secret), in the project root in .env file, or for production environment, or wherever you'll need them.
You can run this command anytime to update any of your configuration keys, but it will only update in config/config.json. You'll still have to manually update your keys in environment variables elsewhere (including the .env file you created locally).
Make sure you've MongoDB server running at localhost:27017.
npm run devserver
Alternatively,
nodemon server
Otherwise conventionally, node server
would also start the server, but changes won't reload automatically.
Above commands must log -
Connected to <YOUR_DATABASE_NAME>
listening on 3000 (https)
here <YOUR_DATABASE_NAME> should be the database name you've set in configuration setup.
If you're seeing -
Connected to <YOUR_DATABASE_NAME>
listening on 3000
Warning:Server hosted via non-https protocol.
Session will fail.
(without https), then you must haven't followed these steps.
If some other error has occurred, follow the checklist to make sure every prerequisite is set up.
-
Create .env at root of project, with SSH = <YOUR_PROJECT_SUPER_SECRET> in it.
-
Run
npm run newconfig
to enable CLI to generate a config file at config/config.json. -
Copy keys from config.json to your .env file, and set them according to .sample.env.
-
Start MongoDB community server at localhost:27107.
If error still persists even after following the above steps, create an issue in the repository with error logs and details.
After ensuring that listening on 3000 (https)
is being logged on node console, you can proceed towards contribution.
See detailed contribution guide here.
The master branch is the production branch linked to the cloud hosting server, therefore it shouldn't be used to push non-crucial-to-the-moment commits, as cloud server re-builds the application on each commit, which can potentially disrupt the live webapplication for users. See CONTRIBUTING.md for details.
npm run commit
git push -u origin branch-name
-
To sign a value using your SSH from environment variable
npm run gentoken
-
To decode a jwt signed using your SSH from environment variable
npm run decode
-
To send an email using mail configuration from config/config.js (mail environment variables)
npm run sendmail
-
(*) Steps with asterisk are the steps to be followed only for first time development setup.
-
See contribution guidelines for detailed explanation including local DB, link, and server environment setup.
-
See application documentation for step by step developement guide, definitions & explanations with snippets of use cases.
-
Apart from documentation, in-code documentation is also provided wherever possible or required.