GithubHelp home page GithubHelp logo

ryanckulp / speedrail Goto Github PK

View Code? Open in Web Editor NEW
184.0 12.0 26.0 774 KB

Rails 7 app template: Devise auth, Stripe billing, Tailwind CSS, admin panel, SEO helpers, etc

Home Page: https://founderhacker.com/24-hour-mvp

License: MIT License

Ruby 44.34% JavaScript 2.19% CSS 10.64% HTML 42.70% Shell 0.09% Procfile 0.04%
mvp-template rails-template rails7 ruby-on-rails-template

speedrail's Introduction

Speedrail

a Rails 7 template by @ryanckulp, created to ship SaaS apps quickly. Learn how to use this at 24 Hour MVP.

features:

  • user authentication via Devise
  • design via Tailwind UI
  • user billing management via Stripe Checkout portal
  • safely manage ENV variables with Figaro
  • responsive toggle navbar w/ logic for login, signup, settings
  • SEO toolbelt via metamagic
  • rename your app in 1 command with Rename
  • increased debugging power with Better Errors
  • seed your DB in seconds via Seed Dump
  • production-ready DB via Postgres
  • easy API requests with HTTParty
  • Postmark for transactional emails, letter_opener for local dev mailers
  • script tag component (Google Analytics, etc)
  • testing suite via RSpec
  • cron job task scheduler (lib/tasks/scheduler.rake)
  • random data generation with Faker
  • Heroku <> Cloudflare HTTPS via lib/cloudflare_proxy.rb
  • background job queue via Delayed
  • paid subscriptions CRUD via Stripe Checkout
  • interactive charts via Chartkick
  • automated testing via GitHub actions + PR status check
  • Rubocop for code style enforcement and linting auto-fixes

Installation

  1. clone the repo
  2. bin/speedrail new_app_name
  3. cp config/application-sample.yml config/application.yml (then add/update ENV vars here)

Development

bin/dev # uses foreman to boot server, frontend, and bg job queue

To keep your project up-to-date with the latest Speedrail changes over time:

# one time only
git remote add speedrail https://github.com/ryanckulp/speedrail.git

# when you notice Speedrail updates on GitHub
git pull
git fetch speedrail
git merge speedrail/master --allow-unrelated-histories
git checkout -b speedrail_updates
git add .
git push speedrail_updates
# use GitHub UI to handle conflicts

troubleshooting

ActionCable - to support WebSockets, run rails g channel channel_name --assets then add mount ActionCable.server => '/cable' to config/routes.rb. update cable.yml -> production: to include the following for Heroku to connect w/ Redis for ActionCable.broadcast:

ssl_params:
    verify_mode: <%= OpenSSL::SSL::VERIFY_NONE %>

Turbo Drive lazy-loads pages following form submission, causing script tags at the bottom of following views to not always load.

<!-- add data-turbo=false to form submission buttons if the following view needs a full render -->
<button data-turbo="false" type="submit" ...>Submit</button>

Testing

# headless
bundle exec rspec # run all tests inside spec/
bundle exec rspec spec/dir_name # run all tests inside given directory

# headed (in a real browser)
HEADED=TRUE bundle exec rspec

Code Quality

clean code helps keep projects manageable as they grow in complexity.

rubocop # checks your code against Ruby styling standards and calls out issues
rubocop -A # automatically fixes issues, can lead to false negatives
rubocop -a # automatically fixes "safe" issues, less aggressive than -A (uppercase)

Rubocop is an optional feature, however it runs automatically during GitHub CI checks. if you don't want to enforce the Rubocop styleguide, simply disable the Rubocop Check step inside ci.yml.

Deploying

bundle exec figaro heroku:set -e production # you only need to do this once
heroku git:remote -a heroku_app_name_here # you only need to do this once
git push heroku master # deploys master branch
git push heroku some_branch_name:master # deploys non-master branch

If you get error: src refspec master does not match any the probable cause is that you're using a new Github repo which defaults to master being called "main." You can deploy to Heroku using the branch deployment strategy pushing main over master:

git push heroku main:master

or update your Heroku account to also default to main and then deploy with:

git push heroku main

note: Heroku must have 2 'dynos' enabled, web + worker, to process background jobs. if you don't need a queue, simply remove the worker task from Procfile and don't invoke .delayed functions.

Mailers

Speedrail is configured for transactional mailers by Postmark, which costs $10 /month for 10k emails. to activate this, set postmark_api_token inside application.yml and then verify your sending domain.

if you prefer a free email service for low volume applications, consider Resend. before installing it, first uninstall Postmark from Speedrail by 1) removing gem 'postmark-rails' from the Gemfile, 2) running bundle, then 3) deleting the following lines from application.rb:

config.action_mailer.delivery_method = :postmark
config.action_mailer.postmark_settings = { api_token: ENV['POSTMARK_API_TOKEN'] }

Contributing

anyone is welcome to submit a pull request with improvements of any kind.

speedrail's People

Contributors

5andu avatar bsierakowski avatar dependabot[bot] avatar digitalwestie avatar matevzgolavsek avatar niklasbabel avatar preswick avatar ryanckulp avatar stets avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

speedrail's Issues

planning Speedrail v2.0

fixes / improvements

new stuff

  • A/B testing
  • blog newsletter signup (BlogSubscriber table) as a widget (partial) for mobility
  • impersonation via Pretender
  • admin panel with Tailwind
  • Webmock + VCR or similar mock library
  • referral program via Rewardful
  • A/B testing via Split
  • Mail logs (+ editor?) with HTML support
  • custom generators / Rails scaffold overrides for better views + tests

User Who Hasn't Finished Onboarding Cannot Subscribe

I found a bug for users who haven't started a trial or where user.finished_onboarding? == false who try to subscribe from the My Account page

Steps to Replicate

  • Sign Up, get redirected to /subscribe route
  • Do not start the trial, instead click Account or navigate to /account route
  • Click Manage

The browser hangs on this screen:

image

Notes:

I believe this has something to do with unsafe URLs, but billing_portal_controller.rb has allow_other_host: true set, so it should work.

However, after clicking Manage, the stripe checkout URL is cut off after the # "hashtag character". Grabbing the real session URL from console and navigating directly to it works fine and loads the checkout.

Session URL has a format like:

https://checkout.stripe.com/c/pay/cs_test_<long_string_of_characters>#<another_long_string>

I tried using gsub on the session.url to substitute the # hash sign with %23 URL encoding, but that didn't work either.

Happy to open a PR if I know what the cause of this is

Suggestion: Add confirm_token logic

hey @ryanckulp, I'm starting a new project with this template and I think it'd be nice if speedrail had the confirm token logic to confirm users' emails from the founder hacker course.

What do you think?

happy to open a PR for it

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.