Skip to content

don-tay/tweeter

Repository files navigation

Tweeter

Twitter-inspired web platform written in TypeScript, NodeJS, Pug, MongoDB and socket.io.

Build Passing Total alerts Language grade: JavaScript

Getting started

To run the app locally:

  1. Set up the global dependencies on your machine
  2. Create an environment variable file with the necessary information.

Read on for detailed instructions.

Global dependencies list

Global dependencies are listed as follows. See sections below for installation instructions for each dependency.

  • Node.js v16.x
  • MongoDB 4.4

NodeJS Runtime Environment

There are 2 methods of downloading the NodeJS runtime environment, as follows:

A. Using nvm (Recommended)

B. From NodeJS website

A. Using nvm (Recommended)

See guide for installation instruction. Before running the app, run

nvm install && nvm use

B. From NodeJS website

See guide for installation instruction.

To verify if NodeJS has been setup and running properly, run

node -v

Install dependencies

npm install

Setting up MongoDB database

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.

Environment variable file

  1. Create a new file in the repo config/.env
  2. 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

Running the app

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

License: MIT