-
Python 3.5 or higher
-
Node 6.x or higher
-
PostgreSQL 9.4 or higher (on Mac, follow these instructions instead)
-
Clone the repository and change directory to it.
-
Set up Python virtual environment. Also make sure that your working directory has no spaces in it.
python3 -m pip install virtualenv
python3 -m virtualenv env
At all times, make sure you are in Python virtual environment: (Linux/Mac) source env/bin/activate
(Windows) env\Scripts\activate
Do the following only once:
-
Install back-end dependencies:
python3 -m pip install -r base-requirements.txt
-
Set up front-end dependencies:
npm run global-install && npm install
-
Set up database: (Mac/Linux: do
createdb -h localhost && ./init-user-db.sh
, Windows: do the steps ininit-user-db.sh
manually)
To run, you need two terminals.
-
npm run dev
-
(Make sure this one is in the virtual environment)
./run-django.sh
Server will be visible, by default, on port 8000 on localhost. It will auto-refresh whenever you change a relevant file.
The database can be accessed @localhost:5433
psql -h localhost -p 5433 -U crypto crypto_dev
To make sure the code respects all coding guidelines you should run the static analysis before pushing any code.
Frontend (javascript analysis): npm run lint
Backend (django/python analysis): npm run analyze
You must add to base-requirements.txt
whenever adding a new Python package.
You must run npm i --save <package>
whenever you add a new NPM package.
(Note: These are necessary due to quirks of contribution graphs)
-
Always work in your own fork of the repository.
-
Create a different branch for the issue you are working on off your master branch like
git checkout -b feature-name
. -
Whenever you begin work, be sure to
git pull --rebase upstream master
. -
When you have completed, squash your commits into a max of 3-5 commits and
git push origin feature-name
. -
Issue a PR to the
master
branch on the central repository. (If you issue a PR to another branch, your contributions may not be counted!) -
In case you have a PR pending on this branch,
checkout
to your localmaster
branch,checkout
anotherfeature
branch and work there.
.
├── package.json <- Package info for NPM. Contains front-end libraries (JS/JSX) and convenient scripts.
├── .babelrc, .bootstraprc, .eslintrc, .gitignore <- Configuration settings for Babel (JS/ES6 transpiler), Bootstrap (front-end library), ESLint (JS code analyzer) and Git respectively
├── .prospector.yml, .sass-lint.yml, .travis.yml <- Configuration settings for Prospector (Python code analyzer), SASS Lint (CSS/SASS analyzer) and Travis CI (automated test runner) respectively
├── Procfile, runtime.txt <- Configuration settings for Heroku (hosting platform)
├── base-requirements.txt <- Base environment packages for Python (Django back-end).
├── requirements.txt <- Production environment packages for Python (Django back-end).
├── init-user-db.sh <- Initialization script for PostgreSQL.
├── run-django.sh <- Shell script to run Django back-end.
├── webpack
│ ├── dev.config.js <- Development configuration for Webpack (bundles and pre-processes front-end files).
│ └── prod.config.js <- Production configuration for Webpack.
└── src
├── manage.py <- Runs important Django commands such as setting up database and running server.
├── crypto <- Main project folder for back-end.
│ ├── urls.py <- **All routes performed from the back-end**
│ ├── wsgi.py <- Initialization script.
│ ├── utils.py <- Helpful classes and methods.
│ └── settings <- **Settings and libraries used by the back-end**
├── base <- Example of how to extend the back-end API.
├── accounts <- An example of how to implement a feature. This organizes all code in the back-end related to accounts and authentication.
│ ├── models.py <- Models for accounts. All the fields here will be inserted as-is into the database. Methods for models can also be defined.
│ ├── serializers.py <- Connects the view to the model by serializing or formatting any data.
│ ├── urls.py <- Routes related to accounts API.
│ └── views.py <- Viewset for the accounts. Note that actually these don't need to be graphic templates per se, but rather just what happens when you navigate to a route.
└── static <- **Front-end files**
- React
- React Router Declarative routing for React
- Babel for ES6 and ES7 magic
- Webpack for bundling
- Webpack Dev Middleware
- Clean Webpack Plugin
- Redux Predictable state container for JavaScript apps
- Redux Dev Tools DevTools for Redux with hot reloading, action replay, and customizable UI. Watch Dan Abramov's talk
- Redux Thunk Thunk middleware for Redux - used in async actions
- React Router Redux Ruthlessly simple bindings to keep react-router and redux in sync
- tcomb form Forms library for react
- style-loader, sass-loader and less-loader to allow import of stylesheets in plain css, sass and less,
- font-awesome-webpack to customize FontAwesome
- bootstrap-loader to customize Bootstrap
- ESLint, Airbnb Javascript/React Styleguide, Airbnb CSS / Sass Styleguide to maintain a consistent code style and eslint-plugin-import to make sure all imports are correct
- Django
- Django REST framework Django REST framework is a powerful and flexible toolkit for building Web APIs
- Django REST Knox Token based authentication for API endpoints
- WhiteNoise to serve files efficiently from Django
- Prospector a complete Python static analysis tool
- Bandit a security linter from OpenStack Security