Image for post
Image for post
Totally typical weekend hack!

Hackathon Prep with Laravel

How I prepare for a hackathon before the event so that I am ready to go

Yes- It is a bit off-piste and Yes some may think I am somewhat cheating — but that is not the point of a hackathon (/hack) — making cool shit & meeting people is!

I usually develop with Laravel to get a massive head start and then use VueJS and Bootstrap for the front end stuff. Laravel is fantastic for hacks (nothing is better for a quick start) and I can build API’s, websites, mobile sites, SPA’s with little more than a few composer require’s.

When I go into a hack I want to be prepared and not have to setup stuff and spend an hour or so of my valuable time building, configuring, and waiting for things to work.

“But you can create a new Laravel project in one command and two minutes”

I hear you cry; and yes you can.
And yes you can even use Valet to share it (with ngrok) and it will work. But that to me is the sort of solution for a 2 hour evening hack not something I might spend a full 12 hours / 2–3 days on.

So I wrote a checklist of the things I setup and configure before a hack (an hour total) that not only make it easy to rock up and code till my keys catch fire but also be in with a better shot of winning swag at an event.

Don’t get me wrong - a good idea should and usually will beat out a technological contender — but you can improve your presentation by having a domain name, an online site, and having a repo for people to see your code.

Assumptions: You have Laravel Forge, a running VPS (Digital Ocean, Linode) and can spare a couple of bucks 💰

  • Buy a domain name from Namecheap (fast turn around and can cost $0.88)
  • Setup a new Cloudflare site for this domain and link the DNS (free)
  • Setup a Mailgun site using this domain and verify the domain settings (free) & Mailtrap for local email testing
  • Create a new repo on Github with the domain name and make it public
  • Build a new Laravel project locally and then link it to your new github repo
  • Commit & Push!
  • On Laravel Forge create a new site using the domain name. Change the IP Cloudflare redirects to your VPS server
  • Create a SSL certificate using Lets Encrypt on Laravel Forge and enable it
  • Link your Forge site to your GitHub repo so that it pulls in your blank Laravel site
  • Configure the .env file with Mailgun settings, domain name and a database (You can create a new DB in Forge now)
  • Setup any other services you might want to use. I commonly include Nexmo, Google Analytics, Pusher, Dropbox (for Flysystem)
  • Sit back and relax

You now have a fully working, SSL secured website on the ‘real internet’ running the latest version of Laravel and ready for a hack.

Image for post
Image for post

I do have additional steps such as bringing in my list of 10–20 commonly used composer packages and adding their Service Providers and settings in.

I also like to ignore webpack and any front end compiling as it takes more time than it saves. I use unpkg, cdnjs and jsdelivr as CDN’s for all my external scripts, css and content. Easy to add / remove and no compiling!

When it comes time to code you can use Valet for local testing, push code quickly to Forge (I suggest enabling Auto Deploy) and view on the internet.

I have been hit by bugs & fails before when demonstrating from a local machine — such as doesn’t work on someone else’s machine via ngrok, or your battery dies, or you leave it on your work desk, join the group for demo’s and you laptop goes to sleep. The most common is a API / tool requires a valid HTTPS route (Facebook Messenger :D ) and it doesn’t accent Valet’s / ngrok

You get a cool factor when it comes to demo time as others can see your work, trial it (and break it) when compared to a recorded video of someones local machine emulating an iPhone with url’s like http://localhost:8000/dev/test.php

I will always prefer something like and the hardest part is thinking of the cool domain name!

If you like this heart me up ❤️️ — If you have any questions please ask away!

Happy Hacking

Image for post
Image for post

PS. is up for grabs! 🤓

Father, Husband, Developer & lover of tech

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store