Skip to content

jonas-wedemeyer/envolution-server

Repository files navigation

envolution-server

Envolution is a platform that connects environmental organizations with volunteers striving to make an impact on climate change. Based on their geolocation, this PWA matches volunteers with projects that reflect their specific ecological interests.

Screenshots

Getting started

This is the back-end repository. The front-end can be found at GitHub

Installation

Pre-requisites

To use the Envolution server consider the following:

  1. Begin by forking this repository, and cloning it to your computer with the following command:
  git clone https://github.com/jonas-wedemeyer/envolution-server.git
  1. For macOS users, use Homebrew to install PostgreSQL. Install and start PostgreSQL on your machine by entering the two commands below in your terminal:
  brew install postgres
  brew services start postgres

For Windows users please refer to the following site to install PostgreSQL: https://www.postgresql.org/download/windows/

  1. Set the environment variables in the example.env file. You can leave the NODE_ENV and DB_NAME set toproduction and envolution correspondingly. Create a password and set it to JWT_SECRET. The DB_USR and DB_PASS variables correspond to your PostgreSQL account username and password. Create a Cloudinary account at the following site: https://cloudinary.com/users/register/free
  NODE_ENV=production
  SERVER_PORT=
  JWT_SECRET=

  DB_USR=
  DB_PASS=
  DB_NAME=envolution
  DB_HOST=db

  CLOUDINARY_URL=
  1. After cloning the repo you'll have to decide whether or not to use Docker to run the server. Below you’ll find the steps for running the server with or without Docker.

###With Docker

  1. Start running Docker on your machine

  2. In the example.env file set the variable DB_HOST to db

  3. Rename the example.env file to .env and save the file

  4. Open your terminal and enter the command

  docker-compose up --build
  1. Once Docker is running open a new terminal window and enter the command below to start PostgreSQL, replacing username with your PostgreSQL username
  psql -h localhost -p 5432 -U username envolution
  1. To seed the database, open a new terminal window and enter the following script
  bash scripts/seed-db.sh

###Solving potential errors when running Docker:

  • If you get an error regarding Sequelize that indicates port 5432 is already in use, change the host port within the docker-compose.yml file from 5432 to a number above 3000, for instance 4000. The final result will be the following:
  ports: 
    - 4000:5432
  docker system prune 

###Without Docker

  1. In the example.env file set the variable DB_HOST to db

  2. Rename the example.env file to .env and save the file

  3. Start PostgreSQL, create a new database, and connect to it with the following commands:

  psql postgres
  postgres=# CREATE DATABASE envolution;
  postgres=# \c envolution;

Your bash should now look like this:

  envolution=# 
  1. Set a password for the current PostgreSQL user with the following command:
  envolution=# ALTER USER <user_name> WITH PASSWORD 'new_password';
  1. Run the server with the following:
  npm run dev
  1. To seed the database, open a new terminal window and enter the following:
  npm run seed:all

Tech Stack

  • Koa
  • Sequelize
  • PostgreSQL
  • JWT
  • Docker

##Developers

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages