Giter VIP home page Giter VIP logo

rails-template's Introduction

Rails 7 application template

DFE-Digital/rails-template is a Rails application template that makes starting a new GOV.UK Rails project fast and fun.

What's included

What's improved from the old boilerplate

Requirements

How to setup a new project

To create a new application called apply-for-a-juggling-licence:

rails new \
  --force \
  --database=postgresql \
  --skip-bundle \
  --skip-git \
  --skip-jbuilder \
  --skip-hotwire \
  --skip-action-mailbox \
  --skip-action-mailer \
  --skip-action-text \
  --asset-pipeline=propshaft \
  --javascript=esbuild \
  --css=sass \
  -m https://raw.githubusercontent.com/DFE-Digital/rails-template/main/template.rb \
  apply-for-a-juggling-licence

The installer will ask you to confirm y/N if you want any optional features.

Once the project is set up, tidy up the README, it should already contain some references to helpful things like ADRs/linting if you opted into them.

Working with the project

# Make sure Postgres is running
cd apply-for-a-juggling-licence
asdf install           # Install Ruby/Node/other tools, see README
bin/setup              # Install gems, create databases, remove old logs
bin/dev                # Run the application in development mode using foreman
open http://localhost:3000

# Production
bin/rails db:create RAILS_ENV=production # Prepare database
docker build .                           # Build docker container
docker run --net=host \
  -e RAILS_ENV=production \
  -e RAILS_SERVE_STATIC_FILES=true \
  -e SECRET_KEY_BASE=local \
  <DOCKER_IMAGE_ID_FROM_BUILD_COMMAND>
open http://localhost:3000

Importing improvements from the template

We might make changes to the template to improve how things work, or add new features. We've tried to make it easy to benefit from these changes.

To apply the template to an existing project, run this from inside your project:

bin/rails app:template LOCATION=https://raw.githubusercontent.com/DFE-Digital/rails-template/main/template.rb

The script will ask to overwrite diverging files; press the d key to see the diffs for each file, and choose accordingly. You might have to make some changes yourself if you've overriden certain files, like the layout.

rails-template's People

Contributors

tvararu avatar peteryates avatar steventux avatar

Watchers

James Cloos avatar

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.