This repository is a starter template for a service oriented architecture web application built with a Ruby on Rails API and an Angular frontend.
It includes user authentication, bootstrap, live-reload, heroku buildpacks and more for easy development, testing and deployment.
This is a work in progress so please help contribute and share your thoughts.
- devise_token_auth - For Rails user authentication
- API Pie - Easy API documentation
- Compass - For frontend SASS use
- Grunt - For lunching local environment and remote building
- Angular - Frontend Framework
- ui-router - Easier / better Angular routing
- ng-token-auth - Angular wrapper for calls to devise_token_auth API
- Restangular - Angular helper for calls to custom Rails API
- angulartics - Angular analytics integration
- angular-bootstrap - Bootstrap w/ Angular integration
Set up your environment for this project.
- Install Ruby on Rails
- Install Bundler
- Install PostgreSQL
- Launch PostgreSQL App to start a PostgreSQL server
Once the environment is set up, now install and configure this application.
- Clone this repo then
cd
into the new repo folder - Install bundle:
gem install bundle
- Install the gems with bundle:
bundle install
- Go into the frontend folder:
cd client
- Install NPM dependencies:
npm install
- Intall bower dependencies:
bower install
- Migrate the database:
rake db:create db:migrate
- Make sure you have a PostgreSQL server running locally
- Make sure you are in the client directory:
cd client
- Launch application:
grunt serve
(make sure you are in /client folder)
Read more about how to create and deploy to Heroku.
To configure it for use follow this section.
Ensure :confirmable is set on the Rails User model.
To not use email authentication, you may remove this attribute from the user and adjust the UI flow accordingly.
Gmail is the main method this has been configured. It is much easier to setup.
Within /config/environment/development.rb at the bottom there are comments about authenticating for GMAIL. Uncomment the section and replace the :user_name and :password with the gmail email address and password you wish to use.
To set up email on heroku a few environment variables must be set.
- URL -
heroku config:set URL=https://[app name].herokuapp.com
(Replace [app name] with your application's name.) - GMAIL_ACCOUNT -
heroku config:set GMAIL_ACCOUNT=<my account>@gmail.com
- GMAIL_PASSWORD -
heroku config:set GMAIL_PASSWORD=<my account password>
As you develop your custom application API, it is very useful to keep the endpoints documented. API Pie is a simple plug in that lets you document your code directly using the code.
For an example, while the application is running, visit: http://localhost:9000/apipie
See API Pie for more details.