- Os: Windows or Linux
- Docker
- Docker-compose
- Copy .env.example => .env
- Edit mapping port, or environment if need
- Run
docker-compose up
- Open http://localhost:{APP_PORT}/api . Enjoy!
- Copy .env.example => .env
- Edit mapping port, or environment if need
- Copy docker-compose.override.sample.yml => docker-compose.override.yml
- Run
docker-compose up
- Create new migration:
docker-compose exec app flask db migrate -m "add_user"
- Upgrade:
docker-compose exec app flask db upgrade
- Downgrade:
docker-compose exec app flask db downgrade
- To run application:
flask run
- Initiate a migration folder (once only)
flask db init
- Create migration script from detected changes in the model
flask db migrate --message 'initial database migration'
- Apply the migration script to the database
flask db upgrade
Open the following url on your browser to view swagger documentation http://127.0.0.1:5000/
Using https://sentry.io for error report. Error report is disabled by default.
To enable
- Go to https://sentry.io register new account, create new flask project, get new dsn
- Replace SENTRY_DSN by new dsn
- Set SEND_REPORT variable in .env to true
Separate components of our app into a group of inter-connected modules
📁 /docs: external documentation
📁 /etc: app configurations, gunicorn config, logging, nginx
📁 /migrations: db migration scripts
📁 /module 1: sources of module 1
📁 /module 2: sources of module 2
Each module is spitted by repository pattern
📁 /api: define api url, request body, params
📁 /commands: define flask command
📁 /extensions: setup base configuration
📁 /helpers: define helper function
📁 /models: define orm model
📁 /repositories: define repository to access data
📁 /services: handle business logic
📁 /tests: app test script
- Flask http://flask.pocoo.org/
- Flask restplus: document api https://flask-restplus.readthedocs.io/en/stable/
- Pytest: testing framework https://docs.pytest.org/en/latest/
- SqlAlchemy: orm http://flask-sqlalchemy.pocoo.org/2.3/
- Faker: data faker for test https://faker.readthedocs.io/en/master/
- Sentry: error report https://sentry.io
If you want to contribute to this boilerplate, clone the repository and just start making pull requests.