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

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.

User Dashboard (PHP frontend)

Python Scripts (Backend)

models.py

https://gist.githubusercontent.com/reillychase/b2270cb00b21665790167e02bdb799a7/raw/b365864454ee44f8759c472779c0fe102c8afbcb/models.py

main.py

https://gist.githubusercontent.com/reillychase/b9d856b0ee1e766549b629cf51cc6708/raw/03eb89ac8e5ba2665434dbc83238ce6a4261398e/main.py

rebuild_daily.py

https://gist.githubusercontent.com/reillychase/8873452fb3ce7eb5cc87f617ed8c9e30/raw/d0ac76cfac917cf4f095834ca399e262f165e311/rebuild_daily.py

rebuild_weekly.py

https://gist.githubusercontent.com/reillychase/96ef9b1a94fa91b53989368c8736df14/raw/0df6b237c0ab321bc0d8a4f2db75fe85e528416e/rebuild_weekly.py

rebuild_monthly.py

https://gist.githubusercontent.com/reillychase/ba6f497628532952f84885dba363b5e2/raw/8dbf66352f02d0f2acf99205445ee929997a2825/rebuild_monthly.py

reset_bandwidth_monthly.py

https://gist.githubusercontent.com/reillychase/79837ec9b078e502ee6ddcc1c6dc66ed/raw/e97efcc018a3219360d73e34a28197dc5a4ebc85/reset_bandwidth_monthly.py