Skip to content

mohamadkhalaj/Boostan

Repository files navigation

Boostan

Boostan (IKIU food reserve), fluent and responsive client.

Black code style .github/workflows/prod.yml

Features✨

Users

  • Beautiful and responsive design
  • Get foods and reserved list
  • Get credit amount
  • Reserve food
  • Get forgotten code
  • Change theme based on user telegram theme settings
  • Support Multi-sessions, and the user is always logged in
  • Manage sessions and device infos

Admins

  • Enable/Disable requests logging
  • Set rate limit
  • Different operating modes including: Block, Whitelist, and normal mode
  • Telegram alert settings
  • Change any alerts and error messages from the admin panel
  • Multi language support see locale
  • Statistics

Tech

We used several frameworks and services for doing our job perfect:

Github workflows (CI/CD)

If you want to pass CI/CD and auto deploy after each commit, you should add the below secrets to your GitHub repo secret lists. Instructions on how to use them in your application are linked below.

Github secret instructions

KEY VALUE
BOOSTAN_USERNAME Boostan username (for testing) (optional)
BOOSTAN_PASSWORD Boostan password (for testing) (optional)
HEROKU_API_KEY Your heroku API_KEY
HEROKU_APP_NAME Your heroku app name
HEROKU_EMAIL Your heroku account email

Basic Commands

Installation (normal)

Install the dependencies, migrate and start the server.

$ pip install -r requirements/local.txt
$ python manage.py migrate
$ python manage.py loaddefaults
$ python manage.py runserver

Setting Up Super User

  • To create a superuser account, use this command:

    $ python manage.py createsuperuser
    

Debug your app with telegram desktop

You should install telegram beta and enable inspect element in experimental settings more detail Telegram doc.

We should use HTTPS for debugging our app with the telegram, so we have to make and install our certificates. So we should install MkCert (See detail Mkcert repo).

Now create the certificates with this command:

$ mkcert -cert-file cert.pem -key-file key.pem 0.0.0.0 localhost 127.0.0.1 ::1

Replace 0.0.0.0, localhost, 127.0.0.1 with the domains you’ll be running locally.

cert.pem and key.pem files will be created in your current working directory. you can replace them whichever names you wish.

but since we shall be running them in Django, copy them to the same folder as manage.py

Run below command to add certificates to browser trusted certificates list.

$ mkcert -install

Then you can run project with this command:

$ python manage.py runsslserver --certificate cert.pem --key key.pem

Type checks

Running type checks with mypy:

$ mypy boostan

Test coverage

To run the tests, check your test coverage, and generate an HTML coverage report:

$ coverage run -m pytest
$ coverage html
$ open htmlcov/index.html

Running tests

(optional) If you want to test with credentials and cover more code testing, you can set your username and password in env variables.

$ export BOOSTAN_USERNAME="YOUR_USERNAME"
$ export BOOSTAN_PASSWORD="YOUR_PASSWORD"
$ python manage.py test api

Deployment

The following section details how to deploy this application:

Environment variables (Production only)

Instructions on how to use them in your application are linked below.

See detailed django Heroku.

KEY VALUE
DJANGO_SECRET_KEY $(openssl rand -base64 64)
WEB_CONCURRENCY 4
DJANGO_DEBUG False
DJANGO_SETTINGS_MODULE config.settings.production
PYTHONHASHSEED random
DJANGO_ADMIN_URL RANDOM_STRING/
DJANGO_ALLOWED_HOSTS YOUR_DOMAIN
DJANGO_ACCOUNT_ALLOW_REGISTRATION False
REDIS_URL Your redis url (for memcache) (free redis sever redis cloud)
REDIS_SASL_PASSWORD Redis SASL password
REDIS_SASL_USERNAME Redis SASL username
SENTRY_DSN Your sentry error tracker DSN code (See detail sentry django doc)
$ pip install -r requirements.txt
$ python manage.py migrate
$ python manage.py loaddefaults
$ python manage.py runserver

Heroku

Click below button for easy deploy to heroku!

Deploy

Screenshots

Dynamic theme (Telegram)

menu reserve

Desktop version

1 8 2 4 5 7

License

GPL-3.0 license

Free Software, Hell Yeah!