/rails-prelaunch-signup

An example Rails 3.2 app for a web startup prelaunch site.

Primary LanguageRuby

Rails App for a Startup Prelaunch Signup Site Rails App for a Startup Prelaunch Signup Site

Rails 3.2 “beta launching soon” example application that shows how to create a Rails application for a startup prelaunch signup site.

You can clone this app or generate a new Rails application from this app’s template.

Best of all, there’s a detailed tutorial to show how it is built.

Rails Application for a Startup Prelaunch Signup Site

Read an interview with Michael Gajda of XPlaygrounds.com about how he used the rails-prelaunch-signup example to launch his startup site. If you launch a site using this example, add your link to the list of Rails Applications Built from the Examples.

Follow on Twitter Follow on Twitter

Follow the project on Twitter: @rails_apps. Please tweet some praise if you like what you’ve found.

Introduction

The initial app for a typical web startup announces the founders’ plans and encourages visitors to enter an email address for future notification of the site’s launch. It’s not difficult to build such an app in Rails.

But why build it yourself if others have already done so? This project aims to:

  • eliminate effort spent building an application that meets a common need;
  • offer code that is already implemented and tested by a large community;
  • provide a well-thought-out app containing most of the features you’ll need.

By using code from this project, you’ll be able to:

  • direct your attention to the design and product offer for your prelaunch site;
  • get started faster building the ultimate application for your business.

The tutorial can help founders who are new to Ruby on Rails to learn how to build a real-world Rails web application.

Why We Use Devise

We’ve chosen to use the Devise gem for our authentication and user management. We use Devise because it offers a full set of features used in more complex applications, such as recovering a user’s forgotten password or allowing users to invite friends. By using Devise for the prelaunch signup application, you can use the same user database for your post-launch product. You’ll also have the benefit of receiving help from a large community of developers using Devise, should you need help in troubleshooting or customizing the implementation.

How We Configure Devise

Devise offers many features and configuration choices; in fact, exploring its options can take more time than actually implementing authentication from scratch. This app will save you time; we’ve selected the configuration that best accommodates a typical web startup signup site.

Devise handles signing up users through a registration feature. We use the Devise registration process to collect email addresses and create user accounts. Instead of confirming an email address immediately, we email a “thank you for your request” acknowledgment and postpone the email confirmation step. When you are ready to invite users to the site, the app provides an administrative interface so you can select users to receive an invitation that instructs them to confirm their email address and set a password.

The Devise wiki and answers on Stack Overflow can help you alter this implementation if you need different functionality.

RailsApps Examples and Tutorials

This is one in a series of Rails example apps and tutorials from the RailsApps Project.

This application is based on two of the RailsApps example apps:

The rails3-devise-rspec-cucumber app shows how to set up Devise for user authentication, explaining how to integrate RSpec and Cucumber for testing. The rails3-bootstrap-devise-cancan app shows how to set up Devise and add CanCan to manage access to administrative pages. You can use this example without studying these example applications; if you find you are lost, it may be helpful to look at the two simpler examples.

Look at rails3-mongoid-devise example if you want to use the MongoDB datastore instead of ActiveRecord and a SQL database.

Any issues? Please create a GitHub issue.

Tutorial

A complete walkthrough tutorial is available on the GitHub wiki:

The tutorial documents each step to follow to create the application. Every step is documented concisely, so a complete beginner can create this application without any additional knowledge. However, no explanation is offered for any of the steps, so if you are a beginner, you’re advised to look for an introduction to Rails elsewhere. See a list of recommended resources for Rails.

If you simply wish to modify the application for your own project, you can download the application and set it up as described below, without following the tutorial.

What Is Implemented — and What Is Not

Currently, the application only serves to display a landing page with a form for visitors to request invitations. Visitors’ email addresses are collected in the application’s database. An administrator can view the collected email addresses.

If there is interest, the author and contributors will implement additional features. See below for a list of implemented and proposed user stories.

User Stories (Implemented)

Here are some user stories that have been implemented:

*Request Invitation*
As a visitor to the website
I want to request an invitation 
so I can be notified when the site is launched

*See Invitation Requests*
As the owner of the site
I want to view a list of visitors who have requested invitations
so I can know if my offer is popular

*Send Invitations*
As the owner of the site
I want to send invitations to visitors who have requested invitations
so users can try the site

*Collect Email Addresses*
As the owner of the site
I want to collect email addresses for a mailing list
so I can send announcements before I launch the site

User Stories (Not Implemented)

If you have ideas for additional features for this application, edit the file and submit a pull request. Or simply create a GitHub issue.

Here are some user stories that have not been implemented. If you implement any of these, please contribute your code to the project with a pull request.

*Post to Twitter After Sign Up*
As a user
I want an option to post to Twitter after I sign up
so my followers will learn about the site

*Post to Facebook After Sign Up*
As a user
I want an option to post to Facebook after I sign up
so my Facebook friends will learn about the site

*View "About" Page*
As a visitor to the website
I want to view the "About" page
so I can learn more about what the site will offer

*View "Contact" Page*
As a visitor to the website
I want to view the "Contact" page
so I can contact the owner of the site

Articles and Discussion

Here are some articles that describe the purpose and options for a startup prelaunch page:

Have other suggestions? Please create an issue with your suggestion or email the author.

Similar Projects

You can find other projects on GitHub that offer similar functionality.

Author Project Description
johngrimes t-minus Instant prelaunch page for your Rails 3 app
renderedtext coming-soon Sinatra app to show a pre-launch page and collect emails
hashrocket coming-soon Sinatra app to register email addresses
jbeyers django-prelaunch Django app to gather email addresses with a referral mechanism

Found others? Please create an issue with your suggestion or email the author.

Hosted Services

Here are hosted services that offer similar functionality and more features.

LaunchRock – set up a social launching-soon page in minutes

KickoffLabs – viral landing pages you’ll love in 60 seconds

Prefinery – complete beta management platform that encourages social sharing

Unbounce – create, publish & A/B test landing pages

WordPress Themes

WordPress themes are a popular way to stage a startup prelaunch page.

Launch Effect – a WordPress theme for viral launches

Dependencies

Before generating your application, you will need:

  • The Ruby language (version 1.9.3)
  • Rails 3.2

See Installing Rails 3.2 for detailed instructions and advice.

Getting the Application

You have several options for getting the code.

Fork, Clone, or Generate?

Fork: If you’d like to add features (or bug fixes) to improve the app for others to use as a prelaunch signup site, you can fork the GitHub repo and make pull requests. Your code contributions are welcome!

Clone: If you want to copy and customize the app with changes that are only useful for your own project, you can clone the GitHub repo. You’ll need to search-and-replace the project name throughout the application. You probably should generate the app instead (see below).

Generate: If you want to use the project as a starter app for your customized application, use the application template to generate a new version of the example app. You’ll be able to give it your project name when you generate the app. Note: Unfortunately, the application template isn’t available yet. In the meantime, follow the steps in the Tutorial to create your own version of the project.

Clone the Repository

If you simply wish to examine the example code, you can download the code (“clone the repository”) with the command

$ git clone git://github.com/RailsApps/rails-prelaunch-signup.git

The source code is managed with Git (a version control system). You’ll need Git on your machine (install it from http://git-scm.com/).

Please Remember: Edit the README

If you’re open sourcing the app on GitHub, please edit the README file to add a description of the app and your contact info. Changing the README is important if you’re using a clone of the example app. I’ve been mistaken (and contacted) as the author of apps that are copied from my example.

Getting Started

About Required Gems

The application uses the following gems:

Install the Required Gems

Install the required gems on your computer:

$ bundle install

You can check which gems are installed on your computer with:

$ gem list --local

Keep in mind that you have installed these gems locally. When you deploy the app to another server, the same gems (and versions) must be available.

Set Up Configuration for Devise

This app uses Devise for user management and authentication.

You can modify the configuration file for Devise if you want to use something other than the defaults:

config/initializers/devise.rb

Configure Email for Devise

Configure email by modifying

config/initializers/devise.rb

and setting the return email address for emails sent from the application.

You may need to set values for your mailhost in

config/environments/development.rb
config/environments/production.rb

Create a Default User

Set Up a Database Seed File

You’ll want to set up a default user so you can easily log in to test the app. You can modify the file db/seeds.rb for your own name, email and password:

puts 'SETTING UP DEFAULT USER LOGIN'
user = User.create! :name => 'First User', :email => 'user@example.com', :password => 'please', :password_confirmation => 'please'
puts 'New user created: ' << user.name

Use the defaults or change the values for name, email, and password as you wish.

Seed the Database

Add the default user to the database by running the command:

$ rake db:migrate
$ rake db:seed

Test the App

You can check that your app runs properly by entering the command

$ rails server

To see your application in action, open a browser window and navigate to http://localhost:3000/. You should see the default user listed on the home page. When you click on the user’s name, you should be required to log in before seeing the user’s detail page.

To sign in as the default user, (unless you’ve changed it) use

  • email: user@example.com
  • password: please

You should delete or change the pre-configured logins before you deploy your application.

Deploy to Heroku

For your convenience, here are instructions for deploying your app to Heroku. Heroku provides low cost, easily configured Rails application hosting.

Testing

The application contains RSpec unit tests and Cucumber scenarios and steps. The tests are minimal and can be improved.

Please send the author a message, create an issue, or submit a pull request if you can contribute improved RSpec or Cucumber files.

After installing the application, run rake -T to check that rake tasks for RSpec and Cucumber are available.

Run rake spec to run all RSpec tests.

Run rake cucumber (or more simply, cucumber) to run all Cucumber scenarios and steps.

Documentation and Support

This and the tutorial are the only documentation.

For a Devise introduction, Ryan Bates offers a Railscast on Devise. You can find documentation for Devise at http://github.com/plataformatec/devise. There is an active Devise mailing list and you can submit Devise issues at GitHub.

Issues

Please create a GitHub issue if you identify any problems or have suggestions for improvements.

Where to Get Help

Your best source for help with problems is Stack Overflow. Your issue may have been encountered and addressed by others.

You can also try Rails Hotline, a free telephone hotline for Rails help staffed by volunteers.

Contributing

If you make improvements to this application, please share with others.

Send the author a message, create an issue, or fork the project and submit a pull request.

If you add functionality to this application, create an alternative implementation, or build an application that is similar, please contact me and I’ll add a note to the README so that others can find your work.

Credits

Daniel Kehoe (http://danielkehoe.com/) implemented the application and wrote the tutorial.

Is the app useful to you? Follow the project on Twitter: @rails_apps
and tweet some praise. I’d love to know you were helped out by what I’ve put together.

License

Contact the author for license terms.