Twitter-inspired web platform written in TypeScript, NodeJS, Pug, MongoDB and socket.io.
To run the app locally:
- Set up the global dependencies on your machine
- Create an environment variable file with the necessary information.
Read on for detailed instructions.
Global dependencies are listed as follows. See sections below for installation instructions for each dependency.
- Node.js v16.x
- MongoDB 4.4
There are 2 methods of downloading the NodeJS runtime environment, as follows:
A. Using nvm (Recommended)
B. From NodeJS website
See guide for installation instruction. Before running the app, run
nvm install && nvm use
See guide for installation instruction.
To verify if NodeJS has been setup and running properly, run
node -v
npm install
Set up a MongoDB database instance by hosting an instance on MongoDB Atlas. See this guide on setting up.
NB: Take note of your MongoDB instance credentials. It will be added to the environment variable file in the next step.
- Create a new file in the repo
config/.env
- Add the following variables and values to the new file in the following format:
Variable1=Value1
Variable2=Value2
....
Variable | Value |
---|---|
NODE_ENV | production |
PORT | 5000 |
MONGO_URI | Copy your MongoDB instance credentials here (eg. mongodb+srv://user:password[email protected]/db_name?retryWrites=true&w=majority) |
SESSION_SECRET | Add any random characters here |
Once all global dependencies are set up and the config/.env
file is populated, the app can be run in the following ways:
# Run in development
npm run dev
# Build and run in production
npm run build && npm start
License: MIT