Giter Site home page Giter Site logo

haimkastner / backend Goto Github PK

View Code? Open in Web Editor NEW

This project forked from botim/backend

0.0 1.0 0.0 1.21 MB

The Big Bots project is a social experiment aimed at identifying bots and sock puppets in the social platforms feeds. https://botim.online

License: GNU General Public License v3.0

JavaScript 1.49% TypeScript 98.51%

backend's Introduction

Bots backend

Based on https://github.com/vmasto/express-babel: Express.js with Babel Boilerplate.

Using TSOA Routing https://github.com/lukeautry/tsoa.

Deployment

Deployed on Heroku

DB

You could install Postgres directrly on your computer, or install Docker and then use the docker-compose to run the container:

docker-compose up

# shutdown the container
docker-compose down

Copy .env.example into .env and update the variables to match your environment, or define local variable named DATABASE_URL of the form postgres://user:pass@localhost:5432/bots_db

Install locally:

  1. Create Database and User:

    $ psql postgres
    CREATE ROLE bots WITH LOGIN PASSWORD 'yourpass';
    ALTER ROLE bots CREATEDB;
    
    $ psql postgres -U bots
    CREATE DATABASE bots_db;
    GRANT ALL PRIVILEGES ON DATABASE bots_db TO bots;
  2. Run migrations to create tables:

    npm run migrate
    
    # to revert the last migration
    npm run migrate:revert

Run Example

enter in command line:

  • npm i
  • DATABASE_URL='postgres://user:pass@localhost:5432/bots_db'
  • npm run start

API

read swagger.yaml file.

Updating suspected to confirmed bots

The reports go to user_statuses table.

And the reporters API key checks against reporters table.

Configuration

environment variables:

  • DATABASE_URL DB URI.
  • PORT HTTP Port. (default 8080).
  • REQUESTS_LIMIT Maximum requests in 10 minutes window per IP. (default 1000).
  • USERS_CACHE_TTL Liveness of a user status cache, in seconds. (default 1 second).
  • USERS_CACHE_CHECK_PERIOD Interval of cache liveness check. (default 0).
  • JWT_SECRET JWT private stamp key. (default random).
  • JWT_EXPIRES_IN The JWT token liveness time duration. (default 2 days).

backend's People

Contributors

dafnarosenblum avatar eranshmil avatar haimkastner avatar ylarom avatar

Watchers

 avatar

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.