Skip to content

Latest commit

 

History

History
123 lines (87 loc) · 2.99 KB

README.md

File metadata and controls

123 lines (87 loc) · 2.99 KB

Welcome to the Watermelon Club!

            _                           _             
           | |                         | |            
__      ____ _| |_ ___ _ __ _ __ ___   ___| | ___  _ __  
\ \ /\ / / _` | __/ _ \ '__| '_ ` _ \ / _ \ |/ _ \| '_ \ 
\ V  V / (_| | ||  __/ |  | | | | | |  __/ | (_) | | | |
\_/\_/ \__,_|\__\___|_|  |_| |_| |_|\___|_|\___/|_| |_|

Structure

This repo contains two applications:

  • A frontend React App
  • A backend api server

These two applications will communicate through HTTP requests, and need to be run separately.

Documentation

More documentation of the codebase and its architecture can be found here.

Watermelon Club Trello board

https://trello.com/b/U5ezh6qc/watermelon-club

Quickstart

Install Node.js

If you haven't already, make sure you have node and NVM installed.

  1. Install Node Version Manager (NVM)
    brew install nvm
    
    Then follow the instructions to update your ~/.bash_profile.
  2. Open a new terminal
  3. Install the latest version of Node.js.
    nvm install 20
    

Set up your project

  1. Clone the repo to your local machine

  2. Install dependencies for both the frontend and api applications:

    cd frontend
    npm install
    cd ../api
    npm install
    
  3. Install an ESLint plugin for your editor, for example ESLint for VSCode

  4. Install MongoDB

    brew tap mongodb/brew
    brew install [email protected]
    

    Note: If you see a message that says If you need to have [email protected] first in your PATH, run:, follow the instruction. Restart your terminal after this.

  5. Start MongoDB

    brew services start [email protected]
    

Setting up environment variables.

We need to create two .env files, one in the frontend and one in the api.

Frontend

Create a file frontend/.env with the following contents:

VITE_BACKEND_URL="http://localhost:3000"

Backend

Create a file api/.env with the following contents:

MONGODB_URL="mongodb://0.0.0.0/acebook"
NODE_ENV="development"
JWT_SECRET="secret"

For an explanation of these environment variables, see the documentation.

How to run the server and use the app

  1. Start the server application (in the api directory) in dev mode:
; cd api
; npm run dev
  1. Start the front end application (in the frontend directory)

In a new terminal session...

; cd frontend
; npm run dev

You should now be able to open your browser and go to http://localhost:5173/signup to create a new user.

Then, after signing up, you should be able to log in by going to http://localhost:5173/login.

After logging in, you will be able to create/delete/like/unlike a post, add/remove a friend, approve/decline a friend request and send a direct message to one of your friends.