Boutique

sell digital products and send drip emails

Boutique is a Sinatra app for selling digital products and sending drip emails.
See Boutique on GitHub (still in development!)

Install

$ gem install boutique

Install as a rubygem via gem install scron. Then configure cron to run it every 2 hours.

Configure

require 'boutique'

Boutique.configure do |c|
  c.error_email    'dev@mailinator.com'
  c.stripe_api_key 'sk_test_abcdefghijklmnopqrstuvwxyz'
  c.download_dir   '/path/to/download'
  c.download_path  '/download'
  c.db_options(
    adapter: 'postgres',
    host: 'localhost',
    username: 'root',
    password: 'secret',
    database: 'boutique')
  c.email_options(
    via: :smtp,
    via_options: {host: 'smtp.example.org'})
end

Boutique.list('learn-ruby') do |l|
  l.from   'Hugh '
  l.emails '/path/to/emails-dir'
  l.url    'http://example.com'
end

run Boutique::App if !ENV['BOUTIQUE_CMD']

Like other rack apps, setup a config.ru file to use Boutique. Here, you'll configure emails, API keys, and database credentials.

Database & Assets

# in .bashrc or .zshrc
BOUTIQUE_CONFIG='/path/to/config.ru'

$ bin/boutique --migrate
$ boutique --assets
   new -- boutique.js
   new -- boutique.css
$ mv boutique.js boutique.css /path/to/project/assets/.

Boutique comes with a command line tool for migrations and generating static assets. You'll want to serve these assets via a web server like Nginx or Apache.

Drip Emails

---
day: 1
subject: First Email
key: first-email
---

Hi,

This is the first email in the series.

Thanks,
- Hugh

[Click here to unsubscribe.](<%= unsubscribe_url %>)

Emails can be written in any templating format that Tilt accepts. Stick them in /path/to/emails-dir (configured above in config.ru). Emails use front-matter YAML for passing information to Boutique. The required fields are day, subject, and key. The day is how many days should pass until the email is sent. The key is a unique key assigned to each email to guard against sending multiples to the same recipient. You'll also have access to three local variables:

This example email should be stored in the file /path/to/emails-dir/first-email.md.erb.


Boutique is released under the BSD License and developed by Hugh Bien. Follow me via @hughbien.