Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/peterberkenbosch/rails-starter-template
Opinionated Rails 7 starter template using esbuild, tailwindcss, postgresql and hotwired tested with RSpec
https://github.com/peterberkenbosch/rails-starter-template
docker hacktoberfest hacktoberfest-2022 hacktoberfest2021 hacktoberfest2022 rails ruby tailwindcss template-repository
Last synced: 3 months ago
JSON representation
Opinionated Rails 7 starter template using esbuild, tailwindcss, postgresql and hotwired tested with RSpec
- Host: GitHub
- URL: https://github.com/peterberkenbosch/rails-starter-template
- Owner: peterberkenbosch
- License: mit
- Created: 2021-07-08T15:12:24.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-08T07:55:27.000Z (5 months ago)
- Last Synced: 2024-06-08T08:50:03.816Z (5 months ago)
- Topics: docker, hacktoberfest, hacktoberfest-2022, hacktoberfest2021, hacktoberfest2022, rails, ruby, tailwindcss, template-repository
- Language: Ruby
- Homepage:
- Size: 1.56 MB
- Stars: 51
- Watchers: 3
- Forks: 4
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Rails starter template
## IN MAINTENANCE MODE
### In the last couple of months the Rails landscape changed, and so did my opinionated Rails setup. I will keep this one as maintained as possible, but currently running on edge Rails with just minor changes. Those specifics will be open sourced in the future as well.
Opinionated Rails setup using Rails 7, PostgreSQL, TailwindCSS, Stimulus, Hotwire and RSpec.
We are bundling JavaScript and CSS through a Node-based setup with [`jsbundling-rails`](https://github.com/rails/jsbundling-rails) and [`cssbundling-rails`](https://github.com/rails/cssbundling-rails).
If you want to run [`propshaft`](https://github.com/rails/propshaft) as the asset pipeline you can use this branch: https://github.com/peterberkenbosch/rails-starter-template/tree/propshaft. The main branch will be using Sprockets for the time being.
You need the following installed:
* Ruby >= 3 (`asdf install`)
* Node 19 (`asdf install`)
* Bundler (`gem install bundler`)
* Yarn (`brew install yarn`)
* Overmind (`brew install tmux overmind`)
* Postgresql (`brew install postgresql` start with: `brew services start postgresql`)
* Redis (`brew install redis` start with: `brew services start redis`)If you are using [asdf](https://asdf-vm.com/) (I recommend that you do :) ) you can install the required Ruby and NodeJS versions with `asdf install`
The Homebrew dependencies can be installed with running:
```bash
brew bundle install --no-upgrade
```Additional Homebrew dependencies can be added to the `Brewfile`
Optional: [Docker](https://docs.docker.com/engine/installation/mac/) to use with the preconfigured `dip.yml` to setup a dockerized dev environment using [dip](https://github.com/bibendi/dip)
## Getting started
### Initial application setup
Run the setup script that will run the needed setup steps for the application, installing all gems and packages, database preparing etc.
```sh
$ bin/setup
```#### Provisioning and interacting with Docker and dip
You need `docker` and `docker-compose` installed (for MacOS just use [official app](https://docs.docker.com/engine/installation/mac/)).
This app uses the [dip](https://github.com/bibendi/dip) CLI, a utility CLI tool for straightforward provisioning and interactions with applications configured by docker-compose.
```sh
$ gem install dip
$ dip provision
```Take a look at the `dip.yml` file for the available commands
### Development
Will run Overmind (or Foreman if Overmind is not installed), builds all assets automaticly and will start the rails server and sidekiq
```sh
$ bin/dev
```When using dip:
```
$ dip up web
```## Code Guidelines
It uses [StandardRB](https://github.com/testdouble/standard) for Ruby to automatically fix code style offenses.
```sh
$ bundle exec standardrb
```to automatically format Ruby with StandardRB you can run:
```sh
$ bundle exec standardrb --fix
```For Javascript we use [StandardJS](https://standardjs.com/).
```sh
$ yarn standard
```to automatically format the javascript with StandardJS you can run:
```sh
$ yarn standard --fix
```## Running the specs
Inspired by [Evil Martians - System of a Test article](https://evilmartians.com/chronicles/system-of-a-test-setting-up-end-to-end-rails-testing)
To run all the specs you can run:
```sh
$ rake
```or use RSpec directly with
```sh
$ bundle exec rspec
```Inside the docker container we have 2 different commands. To just run the unit tests:
```sh
$ dip rspec
```and to just run the system specs:
```sh
$ dip rspec system
```