h-alekyan / cowrite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cowrite: Collaborative book writing

Cowrite is a collaborative book writing platform that handles important co-authoring tasks such as authorship credit calculation and distribution based on the level of contribution the author had. The Cowrite API along with the React UI allow the users to write books in a user-friendly markdown interface, submit contribution requests and even parse previously completed projects from github while sustaining the contribution metadata.

Currently the demo is disabled, see demo video here: https://www.loom.com/share/cd8e0ff0d572426c985d5ddc5d54cff2

Quick-start in Docker


Start the Flask API

$ cd flask-api
$ docker-compose pull   # download dependencies 
$ docker-compose build  # local set up
$ docker-compose up     # start the app 

At this point, the API should be up & running at http://localhost:5000, and we can test the interface using POSTMAN or curl.


Start the React UI (use another terminal)

$ cd react-ui
$ docker-compose pull   # download dependencies 
$ docker-compose build  # local set up
$ docker-compose up     # start the app 

Once all the above commands are executed, the React UI should be visible in the browser. By default, the app redirects the guest users to authenticate. After we register a new user and signIN, all the private pages become accessible.


General Information

The product is built using a two-tier pattern where the React frontend is decoupled logically and physically from the API backend. In order to use the product in a local environment, a few simple steps are required:

  • Compile and start the Flask API Backend
    • be default the server starts on port 5000
  • Compile and start the React UI
    • UI will start on port 3000 and expects a running backend on port 5000
  • Configuration (Optional)
    • Change the API port
    • Configure the API port used by the React UI to communicate with the backend

Manual build

Start the Flask API

$ cd flask-api
$ 
$ # Create a virtual environment
$ virtualenv env
$ source env/bin/activate
$
$ # Install modules
$ pip install -r requirements.txt
$
$ # Set Up the Environment
$ export FLASK_APP=run.py
$ export FLASK_ENV=development
$ 
$ # Start the API
$ flask run 

Compile & start the React UI

$ cd react-ui
$
$ # Install Modules
$ yarn
$
$ # Start for development (LIVE Reload)
$ yarn start 

Configuration (Optional)

Change the port exposed by the Flask API

$ flask run --port 5001

Now, the API can be accessed on port 5001


Update the API port used by the React Frontend

API Server URL - src/config/constant.js

const config = {
    ...
    API_SERVER: 'http://localhost:5000/api/'  // <-- The magic line
};

Credits


React Flask Authentication - Open-source full-stack seed project provided by AppSeed App Generator

About

License:Other


Languages

Language:Python 79.1%Language:HTML 9.6%Language:SCSS 9.0%Language:Dockerfile 1.3%Language:Mako 1.0%Language:Procfile 0.0%