Scholastica, like most new web apps, needs a splashpage. You’ve seen it a zillion times – a logo, some text, maybe a video, and a simple form to collect email addresses for beta users. The pattern is so well-worn that you should not need to work too hard (or pay too much) to get this functionality setup. In this post, I’ll show you how we setup our Scholastica splash page in under an hour using Heroku and Sinatra. Also, it’s free.
Before we get started, I’m assuming you have a minimal knowledge of Ruby, Git, and have at least heard of Sinatra and Heroku. If that’s not the case, I’d suggest looking into third party services which can provide splashpage functionality – like Wufoo. Yes, using a service will cost a little but it’s a small price to pay to avoid a steep learning curve.
Customize the styles and markup.
Now that you have the basic functionality working locally, you’re ready to customize the layout for your startup. I won’t go into too much detail but you’ll probably want to delete all the images, stylesheets, and PSDs. Leave the javascript (i.e. notify-me.js) unless you know what you’re doing.
With all the junk gone, you’re ready to start customizing the template file. You’ll find all necessary code in notify-me.rb. Near the bottom, you’ll see @@layout, @@index, and @@success each followed by a chunk of HTML. This is the markup you’ll wanna customize. If you’re not totally comfortable poking around, I’d suggest taking small steps and refreshing the page often to confirm you haven’t broken anything.
Deploying your splashpage to Heroku.
If you’re already familiar with how Heroku works, this step is a cinch. Obviously, you’ll need to have installed Git and have setup an account with Heroku. With that in place, type:
heroku create my-splashpage-name
git push heroku master
Then ensure that everything deployed correctly by visiting:
http://my-splashpage-name.heroku.com/
Fetching your emails from the database
Open terminal, navigation to your project’s root directory, and login to your console:
heroku console
Then fetch the subscriber emails using ActiveRecord:
Subscription.all.map(&:email).join(", ")
Helpful Links
- Official Sinatra documentation
- Github repository for Notify Me
- Deploying Sinatra application to Heroku
I know this is a really technical post, but I hope it’s helpful to any of you other startups.
- Cory Schires
Lead Developer.