Skip to content

Latest commit

History

History
104 lines (69 loc) 路 3.73 KB

File metadata and controls

104 lines (69 loc) 路 3.73 KB

Chinese-BBB-Web

Hello and welcome to the GitHub repo for Huxin! This houses all of the backend source code at huxingongxin.com. Huxin's mission is to rebuild the impartial commercial rating system and allow customers safeguard rights by a technical approach. All the latest tech details will be published. The backend infrastructure is hosted in AWS. This github site welcomes contributions from the community in a variety of ways! Feel free to suggest changes!

Get Started

Python3 is the only accepted python version for now.

Preparation Step:

  • Create Environment variables like QICHACHA_APPKEY or TENCENT_APPKEY(or define them in .env file)

NOTE: we use secure cookies, so we must generate self-signed certs for ca and server, and run with server cert and key.

For Linux or MAC:

Mysql clinet is required to install in development environment. Please checkout this link how to install Mysql and configure in Mac.

pip install --user virtualenv
virtualenv -p python3 env
source env/bin/activate
pip install -r requirements.txt
chmod +x ./tools/setup.sh
./tools/setup.sh

cp .env_template .env

python -m flask run --cert certs/server.crt --key certs/server.key --host localhost #(use -p to specify binding port)

For Windows:

cd ./certs
# generate the certs, then add rootca.crt and server.crt to the system certificate manager
./gen.sh
pip install --user virtualenv
virtualenv env
./env/Scripts/activate
pip install -r requirements.txt
pre-commit install -f --install-hooks

$env:FLASK_APP="application.py" # or set the var in `.env`
python -m flask run --cert certs/server.crt --key certs/server.key --host localhost #(use -p to specify binding port)

NOTE: the swagger docs is at http://localhost:5000/docs/swagger

Todo List

  • build the fundamental backends based on flask rest api and test out its functionality
  • Adding flask documentation generation support
  • Initialize the work of sqlAlchemy framework using flask migration
  • Adding all API routing rules required from API doc
  • Adding flask unit test module
  • Encrypt the app.db. Today the DB is plain and doesn't require credentials.
  • After MVP stage, move the file storage to S3.
  • Use the standard Marshmallow lib instead of flask-marshmallow.
  • dynamic secret_ley on deploy
  • use argon2 for password hashing
  • normalize response envelop format
  • normalize response status code and business status
  • normalize models validation
  • improve logging for each resources
  • use https://github.com/dtan4/terraforming or https://github.com/GoogleCloudPlatform/terraformer to convert existing resources config to terraform style.
  • more secure register flow and reset password flow

Development

see development.md

Deployment

see deployment.md

Mysql Management

see deployment.md

Testing

see unit-test.md

Contributing

To get started...

  1. 馃嵈 Fork this repository
  2. 馃帀 Open a new pull request and get it approved!

You can even report a bug or request a feature - any little bit of help counts! 馃槉

License

This software is licensed under MIT license, a copy of which can be found in LICENSE.md