Giter Club home page Giter Club logo

switchspace-backend's Introduction

Switch Space Node.js CI

Project template based on sebamaster-movie-backend

SwitchSpace-Frontend application can be found here

There might be some minor changes between the API documentation and the latest version of the project.

The API documentation can be found here.

Prerequisites

Both for the back end and front end application check

Just for the backend application:

Setup (before first run)

Go to your project root folder via command line

cd path/to/workspace/SwitchSpace-Backend

Install node dependencies

npm install

Set up your database

  • Create a new directory where your database will be stored (it's a good idea to separate data and business logic - the data directory should be on a different place than your app)
  • Start the database server
mongod --dbpath relative/path/to/database

Start the project

Development environment

-Start DB server

sudo systemctl start mongod

-Add seed data from seeds folder

Install mongo seeds globally

npm install -g node-mongo-seeds

Run seed

seed

Create index on the seeded items in the db (optional: it should be created automatically)

use switch_space
db.posts.createIndex({exchangeLocation:"2dsphere"})

-Start dev server

npm run devstart

Production environment

npm start

Enviroment specifications

you will need the following variables in your env file

  • for server tokens and the specific port to run the server on

    • PORT=
    • JWT_SECRET
  • Your DB URL

    • MONGODB_URI=
  • media server (S3 object storage)

    • AWS_ACCESS_KEY_ID=
    • AWS_SECRET_KEY=
  • Payment

    • STRIPE_PAYMENT

Deployment on GCP

If you intend to use Kubernetes in GCP

  • create GKE cluster and open cloud shell

  • copy your .env file to the server

  • create a secret from your env file (myenv is the name of the secret)

    kubectl create secret generic myenv --from-env-file=.env

  • copy deployment.yml and service.yml to the cluster and run the following:

    kubectl apply -f deployment.yml

    kubectl apply -f service.yml

  • apply variables from your secret to the deployment:

    kubectl set env --from=secret/myenv deployment/switchspace-server

you're done! :)

other helpful commands:

  • Kubernetes cluster operate on the below mentioned ports,
    • 30000-32767 (node port range)
    • 8001, 443, 6443 (for Kubernetes communication )
  • kubectl set env -h
  • kubectl set env pods --all --list
  • kubectl get pods --all-namespaces
  • kubectl get deployments --all-namespaces
  • kubectl get services --all-namespaces
  • kubectl scale deployment <deployment_name> --replicas=<replicaNumber>

Helpful References:

switchspace-backend's People

Contributors

mohamedazab avatar abdelrahmankhaledamer avatar mohamedalmorsi avatar shorim avatar

Stargazers

 avatar

Watchers

Ingo Glaser avatar  avatar  avatar

Forkers

shorim

switchspace-backend's Issues

Add post counter in user schema

We need to add a counter in the schema to store the number of allowed posts to create. Relying only on the date is not sufficient since we don't have the date the user subscribed or renewed their subscription on.

Log errors

Logger should log any error on catch.

Initial Code Structure

  1. Backend server working and sending and receiving requests.
  2. Main file structure and code format defined.

Review User

Users can rate their interaction with other users on a five star scale for the following three fields:

  • Communication
  • Description
  • Item Condition

They can also optionally add a text review.

User Registration

  1. User will be able to sign up and create and account
  2. User will be able to login when he has an activated account

Fix user delete

User is currently soft-deleted.

  • Change to hard delete
  • Cascade posts deletion
  • Do not delete chat

Populate seed with posts

Add some dummy posts that follow the post, category, and subcategory structures in the seed for testing.

Search and Filter Posts

Users can search posts and filter based on:

  • ItemOffered
  • ItemDesired
  • Location and radius
  • Category and SubCategory

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.