Storyplan is a narrative development tool built using Rails to help users plan out stories and connect with others as their projects evolve. It has started out as a CRUD application involving the creation of stories, chapters, and characters, but there is room for greater functionality going forward.
You can see a demo version of the application deployed to Railway here: https://rails-storyplan.up.railway.app/
Users can create an account either manually or via Facebook. They can create stories and associate chapters with them to flesh them out and develop narrative structure. Users can create characters that can be associated with chapters they appear in, but can also exist independently, offering the option to begin story planning with characters first.
In addition to creating models, users can view the stories, chapters, and characters of other writers as well, sortable through different paths (such as audiences or genres).
- Authentication (user registration and login) is handled by the Rails Devise gem. Facebook authentication is enabled via OAuth for Devise.
- The back end uses ActiveRecord as the ORM. It uses PostgreSQL for the database via the pg gem.
- The front end leverages Bootstrap 4 via the Bootstrap gem in conjunction with Rails ERB templates. Styling uses SCSS. The JavaScript assets are built using Webpack.
- Pagination uses the Kaminari gem.
- Image uploading is managed by the Rails Paperclip. For production, it's configured to use AWS S3 to store images.
In order to get the application to work, install dependencies from the Gemfile via Bundler by running bundle install
.
Since the application uses PostgreSQL, you need to have it installed locally on your machine with a user that has table creation privileges. You can get further instructions here. If you'd rather not bother with PostgreSQL, you can use an older version of the application that uses SQLite3 here.
Create the database with bundle exec rails db:create
and run migrations with bundle exec rails db:migrate
, then run bundle exec rails db:seed
to populate the database. You need to seed, or else there will be no genres or audiences. In order to get OAuth to work, you need a .env file with a secret and application key for Facebook.
To run the application in development mode after installation, run rails s
.
Front end dependencies are managed by Yarn with the package.json file. They are built by Webpack via the Webpacker gem. Custom JavaScript code is located in the app/javascript
where front end assets are imported.
For production, the application is configured to use AWS S3 for image uploads. You can read more about setting up S3 here (with Heroku).
The test suite is developed using Rspec via the rspec-rails gem with shoulda-matchers. Capybara is used for integration (feature) testing to mimic user browser interaction, while model factories are set up with FactoryBot.
Tests are located under the /spec
folder. Model and controller level tests are fairly comprehensive, while feature tests only test core CRUD functionality right now. In order to run tests, run bundle exec rspec
followed by an optional folder or file under the /spec
directory (for example, if you only want to test models, run bundle exec rspec spec/models
).
For more, see this post: http://mitulmistry.github.io/ruby/rails/rails-project/
This project began as a Rails assessment for Flatiron School's Learn Verified Full Stack Development program: https://github.com/learn-co-students/rails-assessment-v-000
This project is open source under the terms of the MIT License.