You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40-14Lines changed: 40 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ This is a boilerplate to build your next SaaS product. It's a RubyOnRails 6 back
10
10
- Postgresql Server as db connector
11
11
12
12
## Dependencies
13
-
This boilerplate works like a charm with the following gems:
13
+
This boilerplate works like a charm with the following gemset:
14
14
- pg
15
15
- devise
16
16
- graphql
@@ -60,7 +60,7 @@ rake db:seed
60
60
61
61
Run the development server:
62
62
63
-
```
63
+
```sh
64
64
rails s
65
65
```
66
66
@@ -78,6 +78,8 @@ The app uses a postgresql database. It implements the connector with the gem `pg
78
78
### 2. Authentication
79
79
The app uses [devise](https://github.com/plataformatec/devise)'s logic for authentication. For graphQL API we use the JWT token, but to access the rails_admin backend we use standard devise views, but registration is excluded.
80
80
81
+
Change devise settins under `config/initializers/devise.rb` and `config/initializers/graphql_auth.rb`.
82
+
81
83
### 3. JSON Web Token
82
84
[graphql-auth](https://github.com/o2web/graphql-auth) is a graphql/devise extension which uses JWT tokens for user authentication. It follows [secure by default](https://en.wikipedia.org/wiki/Secure_by_default) principle.
83
85
@@ -102,11 +104,37 @@ Annotates Rails/ActiveRecord Models, routes, fixtures, and others based on the d
102
104
Start defining your abilities under `app/models/aility.rb`.
103
105
104
106
### 10. Rails Admin
105
-
To access the data of your application you can access the [rails_admin](https://github.com/sferik/rails_admin) dashboard under route `/admin`. It's currently only allowed for users with role superadmin.
107
+
To access the data of your application you can access the [rails_admin](https://github.com/sferik/rails_admin) dashboard under route `http://0.0.0.0:3000/admin`. Access is currently only allowed for users with superadmin role.
106
108
107
109
If you want to give your admin interface a custom branding you can override sass variables or write your own css under `app/assets/stylesheets/rails_admin/custom`.
108
110
109
-
### 11. Testing
111
+
Change rails_admin settins under `config/initializers/rails_admin.rb`.
112
+
113
+
### 11. I18n
114
+
This app has the default language `en` and already set a secondary language `de`. We included the [rails-i18n](https://github.com/svenfuchs/rails-i18n) to support other languages out of the box. Add more languages under `config/initializers/locale.rb`.
115
+
116
+
#### Setting locale
117
+
To switch locale just append `?locale=de` at the end of your url.
118
+
119
+
#### Devise
120
+
For devise we use [devise-i18n](https://github.com/tigrish/devise-i18n) to support other languages.
121
+
122
+
Change translations under `config/locales/devise`.If you want to support more languages install them with `rails g devise:i18n:locale fr`. (<-- installs French)
123
+
124
+
#### Rails Admin
125
+
To get translations for rails admin out of the box we use [rails_admin-i18n](https://github.com/starchow/rails_admin-i18n).
126
+
127
+
#### Testing Locales
128
+
How to test your locale files and how to find missing one read [this](https://github.com/svenfuchs/rails-i18n#testing-your-locale-file).
129
+
130
+
### 12. HTTP Authentication
131
+
For your staging environment we recommend to use a HTTP Auth protection. To enable it set env var `IS_HTTP_AUTH_PROTECTED` to `true`.
132
+
133
+
Set user with `HTTP_AUTH_USER` and password with `HTTP_AUTH_PASSWORD`.
134
+
135
+
We enable HTTP auth currently for all controllers. The `ApplicationController` class includes the concern `HttpAuth`. Feel free to change it.
136
+
137
+
### 13. Testing
110
138
111
139
We are using the wonderful framework [rspec](https://github.com/rspec/rspec). The testsuit also uses [factory_bot_rails](https://github.com/thoughtbot/factory_bot_rails) for fixtures.
112
140
@@ -124,15 +152,18 @@ Create fake data easily with [faker gem](https://github.com/faker-ruby/faker). C
124
152
#### Simplecov
125
153
[SimpleCov](https://github.com/simplecov-ruby/simplecov) is a code coverage analysis tool for Ruby. It uses Ruby's built-in Coverage library to gather code coverage data, but makes processing its results much easier by providing a clean API to filter, group, merge, format, and display those results, giving you a complete code coverage suite that can be set up with just a couple lines of code.
126
154
127
-
Access results with `$ open /coverage/index.html`.
155
+
Open test coverage results with
128
156
157
+
```sh
158
+
$ open /coverage/index.html
159
+
```
129
160
130
-
### 12. Linter with Rubocop
161
+
### 14. Linter with Rubocop
131
162
132
163
We are using the wonderful [rubocop](https://github.com/rubocop-hq/rubocop-rails) to lint and autofix the code. Install the rubocop VSCode extension to get best experience during development.
133
164
134
165
135
-
### 13. Deployment
166
+
### 15. Deployment
136
167
The project runs on every webhoster with ruby installed. The only dependency is a PostgreSQL database. Create a block `production:` in the`config/database.yml` for your connection.
137
168
138
169
#### Heroku
@@ -141,7 +172,6 @@ The project runs on every webhoster with ruby installed. The only dependency is
141
172
142
173
Choose the one click installer or push a clone of this repo to heroku by yourself. We added a `Profile` to the project and heroku run the `release:` statement after deploying a new version. Heroku will automatically set the db settings for your project, so there is nothing to do in `config/database.yml`.
143
174
144
-
145
175
**Make sure all ENV vars are set and the database settings are valid.**
146
176
147
177
#### Bitbucket Pipelines
@@ -151,14 +181,10 @@ Make sure to set ENV vars `$HEROKU_API_KEY` and `$HEROKU_APP_NAME` in bitbuckets
151
181
152
182
The pipeline has 2 environments: staging and production. Staging pipline is getting triggered in `develop` branch. Production deploy triggered by `master` branch.
153
183
154
-
It also triggers pipeline when opening a PR.
184
+
It also triggers pipeline while opening a PR.
155
185
156
186
## What's missing?
157
-
158
-
* We want to move to https://github.com/o2web/graphql-auth
159
-
160
-
161
-
Feel free to join development!
187
+
Feel free to make feature requrest or join development!
0 commit comments