Finished the entire Python backend!

GhostiFi Update #11

I finished writing the entire backend of GhostiFi with only 863 lines of Python.

I’m really pushing to launch by December 9, which will be 1 month since I started development. I’ve been feeling this pressure to keep up with Jon Yongfook who is doing Pieter Levels’ “12 startups in 12 months” challenge. He’s already launched 3 startups since September!

I livestreamed GhostiFi development for about 2 hours last night, and it was a very productive session this time. Here’s what I was able to get working:

  • Refactored the existing script to improve code reusability. I moved the SQLAlchemy classes into “models.py” then imported them into “main.py”, “rebuild_daily.py”, “rebuild_weekly.py”, “rebuild_monthly.py”, and “reset_bandwidth_monthly.py”.
  • Refactored the server.rebuild() function to accommodate different types of rebuilds — “rebuild now” or “rebuild schedule”
  • Wrote the rebuild daily/weekly/monthly scripts which will run on crons, rebuilding servers according to the users’ Rebuild Scheduler preferences.
  • Wrote reset_bandwidth_monthly.py — resets bandwidth tracking back to 0 for each server. Will run on a monthly cron.
  • Wrote some code to handle “Random” VPS location option by selecting a random number between 0 and 14, then inputting that into a list which returns the datacenter code of a real location to use in the Vultr API call.
  • Tested extensively, and was able to get everything working!

With the backend done, I can finally move on to making the user interface. My next post will probably be writing the pseudocode for that.

It’s going to be integrated into WordPress. Will be writing PHP, HTML, CSS, Javascript, and it will include a “mini API” built into the dashboard page to handle backend requests without having to refresh the page.

Closing thoughts

I hope this is helpful for anyone who is an aspiring programmer or entrepreneur to see my thought process and the journey from idea, to sketched interface, pseudocode, and finally actual code.

If you have any feedback on how I could improve this please let me know in the comments section!

I am also looking for feedback on the concept itself, as well as beta testers. Please sign up for the newsletter at https://ghostifi.net if you are interested.

If you want to know when I release another post about building GhostiFi, you can follow me on Twitter: @_rchase_ or Medium: Reilly Chase

User Dashboard (PHP frontend)

Python Scripts (Backend)

models.py

main.py

rebuild_daily.py

rebuild_weekly.py

rebuild_monthly.py

reset_bandwidth_monthly.py