Hear about how folks are running their web apps in production. We'll cover tech choices, why they chose them, lessons learned and more.
A Cryptocurrency Powered E-commerce Store Called Strmline
In this episode of Running in Production, Ty Cooper goes over building a cryptocurrency powered e-commerce store with Flask and Python. It’s hosted on Firebase along with PythonAnywhere and has been up and running since October 2019.
Ty talks about the challenges of accepting cryptocurrency (specifically Ethereum), how he hosts the site using Firebase and PythonAnywhere, why he chose those services, the value of end to end tests using Selenium, the benefits of working with someone else instead of trying to do everything alone and more.
Topics Include
- 1:02 – Switching gears and making a different site after running into a road block
- 2:36 – Motivation for using Flask over Django and other frameworks
- 4:27 – Flask makes it easy to get into without needing to open multiple cans of worms
- 4:54 – Would you use Flask again today if you had to re-write the site from scratch?
- 6:42 – Flask manipulates data but the database and storage is hosted on Firebase
- 8:00 – Flask-JWT-Extended helps deal with token based auth for his Flask API back-end
- 8:41 – The app is API based with a VueJS back-end because Ty likes JavaScript and VueJS
- 10:21 – Challenges for trying to sell products with cryptocurrency
- 11:25 – The web3.py library helps interact with the Ethereum blockchain
- 11:51 – Building an email newsletter sender with Flask-Mail
- 14:23 – PythonAnywhere is used to host the Flask app and comes with logging
- 15:07 – Twilio’s API is used to send Ty text messages if errors occur
- 15:46 – What Firebase is and how it helps run a few things in development and production
- 17:28 – Why use Firebase and PythonAnywhere vs using Heroku or hosting your own server?
- 18:21 – About $12 / month to host 3 different apps on PythonAnywhere
- 19:02 – You configure your CNAME DNS records to point to PythonAnywhere
- 19:29 – Firebase directly hosts all of the front-end files such as JavaScript and CSS
- 20:22 – PythonAnywhere gives you free SSL certificates
- 20:28 – Ty hosts 50+ sites through PythonAnywhere and gets 10k+ monthly visitors
- 22:15 – Learning to deploy your own apps is rewarding but there’s a lot to learn
- 23:38 – What it looks like to deploy code from development to production
- 25:14 – Automated end to end testing with Selenium
- 26:50 – Getting banned on Tinder for using Selenium to make too many automated requests
- 27:04 – Mozzarella cheese
- 28:16 – Dealing with secret keys through environment variables using PythonAnywhere
- 29:18 – Database backups are done once a month
- 30:59 – Product images are uploaded directly from the front-end to Firebase
- 32:48 – Placeholders are used to help show graceful errors if something goes down
- 34:54 – Firebase and PythonAnywhere will notify Ty automatically if the site goes down
- 35:40 – Best tips? Learn by doing and don’t worry about making mistakes
- 37:30 – One mistake Ty made was developing the project alone, a 2nd set of eyes is helpful
- 39:28 – Having someone else around really helps with keeping you on track
- 41:01 – Find Ty on Instagram along with Twitter, Reddit and Youtube
Links
📄 References- https://en.wikipedia.org/wiki/Cryptocurrency
- https://www.youtube.com/channel/UC-QDfvrRIDB6F0bIO4I4HkQ (Pretty Printed)
- https://ethereum.org/
- https://www.twilio.com/
- https://github.com/SeleniumHQ/selenium
- https://en.wikipedia.org/wiki/WebP
- https://flask-jwt-extended.readthedocs.io/en/stable/
- https://github.com/axios/axios
- https://github.com/ethereum/web3.py
- https://github.com/mattupstate/flask-mail
Support the Show
This episode does not have a sponsor and this podcast is a labor of love. If you want to support the show, the best way to do it is to purchase one of my courses or suggest one to a friend.
- Dive into Docker is a video course that takes you from not knowing what Docker is to being able to confidently use Docker and Docker Compose for your own apps. Long gone are the days of "but it works on my machine!". A bunch of follow along labs are included.
- Build a SAAS App with Flask is a video course where we build a real world SAAS app that accepts payments, has a custom admin, includes high test coverage and goes over how to implement and apply 50+ common web app features. There's over 20+ hours of video.