plutonium 0.15.5 → 0.15.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/plutonium.css +1 -1
  3. data/app/assets/plutonium.ico +0 -0
  4. data/app/assets/plutonium.js +25 -11
  5. data/app/assets/plutonium.js.map +2 -2
  6. data/app/assets/plutonium.min.js +4 -4
  7. data/app/assets/plutonium.min.js.map +3 -3
  8. data/app/assets/plutonium.png +0 -0
  9. data/app/views/layouts/rodauth.html.erb +2 -2
  10. data/docs/.vitepress/config.ts +61 -0
  11. data/docs/.vitepress/theme/custom.css +61 -0
  12. data/docs/.vitepress/theme/index.ts +4 -0
  13. data/docs/api-examples.md +49 -0
  14. data/docs/guide/getting-started/authorization.md +296 -0
  15. data/docs/guide/getting-started/core-concepts.md +432 -0
  16. data/docs/guide/getting-started/index.md +18 -0
  17. data/docs/guide/getting-started/installation.md +270 -0
  18. data/docs/guide/getting-started/resources.md +250 -0
  19. data/docs/guide/what-is-plutonium.md +211 -0
  20. data/docs/index.md +43 -0
  21. data/docs/markdown-examples.md +85 -0
  22. data/docs/public/android-chrome-192x192.png +0 -0
  23. data/docs/public/android-chrome-512x512.png +0 -0
  24. data/docs/public/apple-touch-icon.png +0 -0
  25. data/docs/public/favicon-16x16.png +0 -0
  26. data/docs/public/favicon-32x32.png +0 -0
  27. data/docs/public/favicon.ico +0 -0
  28. data/docs/public/plutonium.png +0 -0
  29. data/docs/public/site.webmanifest +1 -0
  30. data/docs/public/templates/plutonium.rb +29 -0
  31. data/lib/generators/pu/core/assets/assets_generator.rb +2 -3
  32. data/lib/generators/pu/core/assets/templates/tailwind.config.js +2 -2
  33. data/lib/generators/pu/core/install/install_generator.rb +9 -1
  34. data/lib/generators/pu/core/install/templates/config/initializers/plutonium.rb +0 -1
  35. data/lib/generators/pu/eject/layout/layout_generator.rb +3 -3
  36. data/lib/generators/pu/eject/shell/shell_generator.rb +3 -3
  37. data/lib/generators/pu/gem/dotenv/dotenv_generator.rb +1 -1
  38. data/lib/generators/pu/gem/letter_opener/letter_opener_generator.rb +21 -0
  39. data/lib/generators/pu/gem/redis/redis_generator.rb +0 -2
  40. data/lib/generators/pu/gem/standard/standard_generator.rb +19 -0
  41. data/lib/generators/pu/lib/plutonium_generators/generator.rb +1 -1
  42. data/lib/generators/pu/res/conn/conn_generator.rb +1 -1
  43. data/lib/plutonium/core/controllers/authorizable.rb +1 -1
  44. data/lib/plutonium/definition/actions.rb +6 -2
  45. data/lib/plutonium/definition/base.rb +1 -0
  46. data/lib/plutonium/definition/nested_inputs.rb +19 -0
  47. data/lib/plutonium/railtie.rb +0 -10
  48. data/lib/plutonium/resource/controller.rb +1 -1
  49. data/lib/plutonium/resource/controllers/crud_actions.rb +1 -1
  50. data/lib/plutonium/resource/controllers/interactive_actions.rb +1 -1
  51. data/lib/plutonium/resource/controllers/presentable.rb +1 -5
  52. data/lib/plutonium/resource/policy.rb +4 -5
  53. data/lib/plutonium/resource/register.rb +3 -0
  54. data/lib/plutonium/ui/action_button.rb +34 -19
  55. data/lib/plutonium/ui/block.rb +13 -0
  56. data/lib/plutonium/ui/component/kit.rb +10 -0
  57. data/lib/plutonium/ui/display/resource.rb +29 -11
  58. data/lib/plutonium/ui/display/theme.rb +1 -1
  59. data/lib/plutonium/ui/dyna_frame/content.rb +2 -2
  60. data/lib/plutonium/ui/dyna_frame/host.rb +20 -0
  61. data/lib/plutonium/ui/form/concerns/renders_nested_resource_fields.rb +282 -0
  62. data/lib/plutonium/ui/form/resource.rb +40 -29
  63. data/lib/plutonium/ui/form/theme.rb +1 -1
  64. data/lib/plutonium/ui/frame_navigator_panel.rb +53 -0
  65. data/lib/plutonium/ui/panel.rb +63 -0
  66. data/lib/plutonium/ui/skeleton_table.rb +29 -0
  67. data/lib/plutonium/ui/table/components/search_bar.rb +1 -1
  68. data/lib/plutonium/ui/table/resource.rb +1 -1
  69. data/lib/plutonium/version.rb +1 -1
  70. data/package-lock.json +5767 -1851
  71. data/package.json +10 -4
  72. data/src/js/controllers/frame_navigator_controller.js +25 -8
  73. data/src/js/controllers/nested_resource_form_fields_controller.js +2 -2
  74. data/src/js/core.js +0 -1
  75. data/tailwind.options.js +89 -11
  76. metadata +36 -12
  77. data/app/assets/plutonium-original.png +0 -0
  78. data/app/assets/plutonium-white.png +0 -0
  79. data/lib/generators/pu/gem/redis/templates/.keep +0 -0
  80. data/public/plutonium-assets/fonts/bootstrap-icons.woff +0 -0
  81. data/public/plutonium-assets/fonts/bootstrap-icons.woff2 +0 -0
  82. /data/{templates → docs/public/templates}/base.rb +0 -0
@@ -0,0 +1,432 @@
1
+ # Core Concepts
2
+
3
+ ::: tip What you'll learn
4
+ - Understanding Plutonium's architecture and core abstractions
5
+ - How resources and packages work together
6
+ - How to organize your application effectively
7
+ - Best practices for building maintainable applications
8
+ :::
9
+
10
+ ## Resources
11
+
12
+ Resources are the fundamental building blocks of a Plutonium application. They represent your business domain objects and their associated behavior.
13
+
14
+ ### Anatomy of a Resource
15
+
16
+ A resource consists of several interconnected components:
17
+
18
+ ```mermaid
19
+ graph TD
20
+ A[Resource] --> B[Model]
21
+ A --> C[Definition]
22
+ A --> D[Policy]
23
+ A --> G[Actions]
24
+
25
+ B --> H[Database Schema]
26
+ C --> I[Fields & UI Logic]
27
+ C --> F[QueryObject]
28
+ D --> J[Authorization]
29
+ F --> L[Querying & Filtering]
30
+ G --> M[User Operations]
31
+ ```
32
+
33
+ ::: details Complete Resource Example
34
+
35
+ ::: code-group
36
+ ```ruby [Model]
37
+ # app/models/user.rb
38
+ class User < ApplicationRecord
39
+ include Plutonium::Resource::Record
40
+
41
+ # Associations
42
+ has_many :posts
43
+ has_many :comments
44
+ belongs_to :organization
45
+
46
+ # Scopes
47
+ scope :active, -> { where(status: :active) }
48
+
49
+ # Validations
50
+ validates :name, presence: true
51
+ validates :email, presence: true, uniqueness: true
52
+ validates :role, presence: true, inclusion: {in: %w[admin user]}
53
+
54
+ def admin? = role == "admin"
55
+ end
56
+ ```
57
+
58
+ ```ruby [Definition]
59
+ # app/definitions/user_definition.rb
60
+ class UserDefinition < Plutonium::Resource::Definition
61
+ # Display configuration
62
+ field :name, as: :string
63
+ field :email, as: :email
64
+
65
+ # Search configuration
66
+ search do |scope, query|
67
+ scope.where("name LIKE :q OR email LIKE :q", q: "%#{query}%")
68
+ end
69
+
70
+ # Filters
71
+ filter :role, with: SelectFilter, choices: %w[admin user guest]
72
+ filter :status, with: SelectFilter, choices: %w[active inactive]
73
+
74
+ # Scopes
75
+ scope :active
76
+
77
+ scope :admins do
78
+ where(role: :admin)
79
+ end
80
+
81
+ # Actions
82
+ action :deactivate,
83
+ interaction: DeactivateUser,
84
+ color: :warning,
85
+ icon: Phlex::TablerIcons::UserOff
86
+
87
+ # UI Customization
88
+ show_page_title "User Details"
89
+ show_page_description "View and manage user information"
90
+ end
91
+ ```
92
+
93
+ ```ruby [Policy]
94
+ # app/policies/user_policy.rb
95
+ class UserPolicy < Plutonium::Resource::Policy
96
+ # Basic permissions
97
+ def read?
98
+ true
99
+ end
100
+
101
+ def create?
102
+ user.admin?
103
+ end
104
+
105
+ def update?
106
+ user.admin? || record.id == user.id
107
+ end
108
+
109
+ def destroy?
110
+ user.admin? && record.id != user.id
111
+ end
112
+
113
+ # Action permissions
114
+ def deactivate?
115
+ user.admin? && record.status == :active && record.id != user.id
116
+ end
117
+
118
+ # Attribute permissions
119
+ def permitted_attributes_for_read
120
+ if user.admin?
121
+ %i[name email role status created_at updated_at]
122
+ else
123
+ %i[name email status]
124
+ end
125
+ end
126
+
127
+ def permitted_attributes_for_create
128
+ if user.admin?
129
+ %i[name email role status password]
130
+ else
131
+ %i[name email password]
132
+ end
133
+ end
134
+
135
+ def permitted_attributes_for_update
136
+ if user.admin?
137
+ %i[name email role]
138
+ else
139
+ %i[name email]
140
+ end
141
+ end
142
+
143
+ # Association permissions
144
+ def permitted_associations
145
+ %i[posts comments]
146
+ end
147
+ end
148
+ ```
149
+
150
+
151
+ ```ruby [Deactivate Interaction]
152
+ # app/interactions/user_interactions/deactivate.rb
153
+ module UserInteractions
154
+ class Deactivate < Plutonium::Resource::Interaction
155
+ # Define presentable metadata
156
+ presents label: "Deactivate User",
157
+ icon: Phlex::TablerIcons::UserOff,
158
+ description: "Deactivate user account"
159
+
160
+ # Define attributes
161
+ attribute :resource, class: User
162
+ attribute :reason, :string
163
+
164
+ # Validations
165
+ validates :resource, presence: true
166
+ validates :reason, presence: true
167
+
168
+ # Business logic
169
+ def execute
170
+ resource.transaction do
171
+ resource.status = :inactive
172
+ resource.deactivated_at = Time.current
173
+ resource.deactivation_reason = reason
174
+
175
+ if resource.save
176
+ succeed(resource)
177
+ .with_message("User was successfully deactivated")
178
+ .with_redirect_response(resource)
179
+ else
180
+ failed(resource.errors)
181
+ end
182
+ end
183
+ end
184
+ end
185
+ end
186
+ ```
187
+ :::
188
+
189
+ ## Packages
190
+
191
+ Packages are the way Plutonium helps you modularize your application. They're built on top of Rails Engines but provide additional structure and conventions.
192
+
193
+ There are two main types:
194
+
195
+ ### Feature Packages
196
+
197
+
198
+ Feature packages help you organize your application into logical, reusable modules.
199
+ They contain your business domain logic and resources. They're self-contained and independent.
200
+
201
+ ::: tip Key Characteristics
202
+ - Domain Models
203
+ - Business Logic
204
+ - No Web Interface
205
+ - Reusable Components
206
+ :::
207
+
208
+ ::: code-group
209
+ ```ruby [Directory Structure]
210
+ packages/
211
+ └── blogging/
212
+ ├── app/
213
+ │ ├── models/
214
+ │ │ └── blogging/
215
+ │ │ ├── post.rb
216
+ │ │ └── comment.rb
217
+ │ ├── definitions/
218
+ │ │ └── blogging/
219
+ │ │ ├── post_definition.rb
220
+ │ │ └── comment_definition.rb
221
+ │ ├── policies/
222
+ │ │ └── blogging/
223
+ │ │ ├── post_policy.rb
224
+ │ │ └── comment_policy.rb
225
+ │ └── interactions/
226
+ │ └── blogging/
227
+ │ └── post_interactions/
228
+ │ ├── publish.rb
229
+ │ └── archive.rb
230
+ ├── config/
231
+ │ └── routes.rb
232
+ └── lib/
233
+ └── engine.rb
234
+ ```
235
+
236
+ ```ruby [Engine Configuration]
237
+ # packages/blogging/lib/engine.rb
238
+ module Blogging
239
+ class Engine < ::Rails::Engine
240
+ include Plutonium::Package::Engine
241
+
242
+ # Package configuration goes here
243
+ isolate_namespace Blogging
244
+ end
245
+ end
246
+ ```
247
+ :::
248
+
249
+ ### Portal Packages
250
+
251
+ Portal packages provide web interfaces and control how users interact with features.
252
+
253
+ ::: tip Key Characteristics
254
+ - Web Interface
255
+ - Authentication
256
+ - Resource Access Control
257
+ - Feature Composition
258
+ :::
259
+
260
+ ::: code-group
261
+ ```ruby [Directory Structure]
262
+ packages/
263
+ └── admin_portal/
264
+ ├── app/
265
+ │ ├── controllers/
266
+ │ │ └── admin_portal/
267
+ │ │ ├── concerns/
268
+ │ │ │ └── controller.rb
269
+ │ │ ├── plutonium_controller.rb
270
+ │ │ └── resource_controller.rb
271
+ │ └── views/
272
+ │ └── layouts/
273
+ │ └── admin_portal.html.erb
274
+ ├── config/
275
+ │ └── routes.rb
276
+ └── lib/
277
+ └── engine.rb
278
+ ```
279
+
280
+ ```ruby [Engine Configuration]
281
+ # packages/admin_portal/lib/engine.rb
282
+ module AdminPortal
283
+ class Engine < ::Rails::Engine
284
+ include Plutonium::Portal::Engine
285
+
286
+ # Scope all resources to organization
287
+ scope_to_entity Organization, strategy: :path
288
+ end
289
+ end
290
+ ```
291
+
292
+ ```ruby [Routes Configuration]
293
+ # packages/admin_portal/config/routes.rb
294
+ AdminPortal::Engine.routes.draw do
295
+ root to: "dashboard#index"
296
+
297
+ # Register resources from feature packages
298
+ register_resource Blogging::Post
299
+ register_resource Blogging::Comment
300
+ end
301
+ ```
302
+
303
+ ```ruby [Controller Configuration]
304
+ # packages/admin_portal/app/controllers/admin_portal/concerns/controller.rb
305
+ module AdminPortal
306
+ module Concerns
307
+ class Controller < ::Rails::Engine
308
+ extend ActiveSupport::Concern
309
+ include Plutonium::Portal::Controller
310
+ # Integrate authentication
311
+ include Plutonium::Auth::Rodauth(:admin)
312
+ end
313
+ end
314
+ end
315
+ ```
316
+ :::
317
+
318
+ ## Entity Scoping
319
+
320
+ Entity scoping is a powerful feature that allows you to partition resources based on a parent entity (like Organization or Account).
321
+ It's how Plutonium achieve's multitenancy.
322
+
323
+ By properly defining associations to an entity, row-level multitenancy comes for free, out of the box.
324
+
325
+ ```ruby
326
+ # Scope definition in engine
327
+ module AdminPortal
328
+ class Engine < ::Rails::Engine
329
+ include Plutonium::Portal::Engine
330
+
331
+ # Path-based scoping (/org_123/posts)
332
+ scope_to_entity Organization, strategy: :path
333
+
334
+ # Or custom scoping
335
+ scope_to_entity Organization, strategy: :current_organization
336
+ end
337
+ end
338
+
339
+ # Model implementation
340
+ class Post < ApplicationRecord
341
+ include Plutonium::Resource::Record
342
+
343
+ # Define a direct relationship to the entity
344
+ belongs_to :user
345
+ belongs_to :organization, through: :user
346
+
347
+ # Alternatively, if there's no direct relationship
348
+ scope :associated_with_organization, ->(organization) do
349
+ # custom scoping logic goes here
350
+ joins(:user).where(users: { organization_id: organization.id })
351
+ end
352
+ end
353
+
354
+ # Controller config
355
+ class ResourceController < PlutoniumController
356
+ include Plutonium::Resource::Controller
357
+
358
+ private
359
+
360
+ def current_organization
361
+ # Get tenant from the current subdomain
362
+ @current_organization ||= Organization.where(subdomain: request.subdomain).first!
363
+ end
364
+ end
365
+ ```
366
+
367
+ ## Best Practices
368
+
369
+ ### Package Organization
370
+
371
+ ::: tip Feature Packages
372
+ 1. Keep domain logic isolated
373
+ 2. Clear boundaries between features
374
+ 3. Minimal dependencies between packages
375
+ 4. Well-defined interfaces
376
+ :::
377
+
378
+ ::: tip Portal Packages
379
+ 1. Single responsibility (admin, customer)
380
+ 2. Consistent authentication strategy
381
+ 3. Clear resource scoping rules
382
+ 4. Feature composition over duplication
383
+ :::
384
+
385
+ ### Resource Design
386
+
387
+ ::: tip Model Layer
388
+ 1. Clear validations and constraints
389
+ 2. Proper association setup
390
+ 3. Meaningful scopes
391
+ :::
392
+
393
+ ::: tip Definition Layer
394
+ 1. Appropriate field types
395
+ 2. Clear action definitions
396
+ 3. Efficient search implementation
397
+ :::
398
+
399
+ ::: tip Policy Layer
400
+ 1. Granular permissions
401
+ 2. Attribute-level access control
402
+ 3. Action-specific rules
403
+ 4. Association permissions
404
+ :::
405
+
406
+ ### Security Considerations
407
+
408
+ ::: warning Important
409
+ 1. Always implement proper policies
410
+ 2. Use entity scoping consistently
411
+ 3. Validate all inputs
412
+ 4. Control association access
413
+ 5. Audit sensitive actions
414
+ :::
415
+
416
+ ## Generator Support
417
+
418
+ Plutonium provides generators to quickly scaffold components:
419
+
420
+ ```bash
421
+ # Create a new feature package
422
+ rails generate pu:pkg:package blogging
423
+
424
+ # Create a new portal package
425
+ rails generate pu:pkg:portal admin
426
+
427
+ # Create a new resource
428
+ rails generate pu:res:scaffold post title:string content:text
429
+
430
+ # Connect a resource to a portal
431
+ rails generate pu:res:conn
432
+ ```
@@ -0,0 +1,18 @@
1
+ # Getting Started with Plutonium
2
+
3
+ <!--
4
+ This guide covers getting up and running with Plutonium.
5
+
6
+ After reading this guide, you will know:
7
+
8
+ - How to install Plutonium.
9
+ - The general layout of a Plutonium application.
10
+ - The basic principles of Resource design.
11
+ - How to quickly generate the starting pieces of a Plutonium application.
12
+ -->
13
+
14
+ ## Prerequisites
15
+
16
+ Before using Plutonium, you should be familiar with Rails.
17
+ Plutonium builds upon many core Rails concepts and conventions.
18
+ If you're new to Rails or need a refresher, we highly recommend reading the [Rails' guide](https://guides.rubyonrails.org/getting_started.html).
@@ -0,0 +1,270 @@
1
+ # Installation and Setup
2
+
3
+ ::: tip VERSION REQUIREMENTS
4
+ - Ruby 3.2.2 or higher
5
+ - Rails 7.1 or higher
6
+ - Node.js and Yarn
7
+ :::
8
+
9
+ ## Quick Start
10
+
11
+ Get up and running with Plutonium in seconds:
12
+
13
+ ::: code-group
14
+ ```bash [New App]
15
+ rails new plutonium_app -a propshaft -j esbuild -c tailwind \
16
+ -m https://radioactive-labs.github.io/plutonium-core/templates/plutonium.rb
17
+ ```
18
+
19
+ ```bash [Existing App]
20
+ bin/rails app:template \
21
+ LOCATION=https://radioactive-labs.github.io/plutonium-core/templates/base.rb
22
+ ```
23
+ :::
24
+
25
+ ## Detailed Installation Guide
26
+
27
+ 1. Add Plutonium to your Gemfile:
28
+
29
+ ::: code-group
30
+ ```ruby [Gemfile]
31
+ gem "plutonium"
32
+ ```
33
+
34
+ ```bash [Terminal]
35
+ bundle install
36
+ ```
37
+ :::
38
+
39
+ 2. Run the installation generator:
40
+
41
+ ```bash
42
+ rails generate pu:core:install
43
+ ```
44
+
45
+ This will:
46
+ - Set up the basic Plutonium structure
47
+ - Create necessary configuration files
48
+ - Configure your application for Plutonium
49
+
50
+ ### Project Structure
51
+
52
+ After installation, your project will have the following new directories and files:
53
+
54
+ ```
55
+ my_rails_app/
56
+ ├── app/
57
+ │ ├── controllers/
58
+ │ │ ├── plutonium_controller.rb # Base controller for Plutonium
59
+ │ │ └── resource_controller.rb # Base controller for resources
60
+ │ ├── definitions/
61
+ │ │ └── resource_definition.rb # Base class for resource definitions
62
+ │ ├── interactions/
63
+ │ │ └── resource_interaction.rb # Base class for resource interactions
64
+ │ ├── models/
65
+ │ │ └── resource_record.rb # Base module for resource models
66
+ │ ├── policies/
67
+ │ │ └── resource_policy.rb # Base class for resource policies
68
+ │ └── views/
69
+ │ └── layouts/
70
+ │ └── resource.html.erb # Base layout for resources
71
+ ├── config/
72
+ │ ├── initializers/
73
+ │ │ └── plutonium.rb # Main configuration
74
+ │ └── packages.rb # Package registration
75
+ └── packages/ # Directory for modular features
76
+ └── .keep
77
+ ```
78
+
79
+ ## Configuration
80
+
81
+ ### Basic Configuration
82
+
83
+ Configure Plutonium in `config/initializers/plutonium.rb`:
84
+
85
+ ```ruby
86
+ Plutonium.configure do |config|
87
+ # Load default configuration for version 1.0
88
+ config.load_defaults 1.0
89
+
90
+ # Asset configuration
91
+ config.assets.stylesheet = "plutonium.css" # Default stylesheet
92
+ config.assets.script = "plutonium.js" # Default JavaScript
93
+ config.assets.logo = "plutonium.png" # Default logo
94
+ end
95
+ ```
96
+
97
+ ### Authentication Setup
98
+
99
+ Plutonium supports multiple authentication strategies. Here's how to set up the recommended Rodauth integration:
100
+
101
+ 1. Install Rodauth:
102
+
103
+ ```bash
104
+ rails generate pu:rodauth:install
105
+ ```
106
+
107
+ 2. Create an authentication account:
108
+
109
+ ::: code-group
110
+ ```bash [Basic Setup]
111
+ rails generate pu:rodauth:account user
112
+ ```
113
+
114
+ ```bash [Custom Setup]
115
+ # Include selected authentication features
116
+ rails generate pu:rodauth:account admin --no-defaults \
117
+ --login --logout --remember --lockout \
118
+ --create-account --verify-account --close-account \
119
+ --change-password --reset-password --reset-password-notify \
120
+ --active-sessions --password-grace-period --otp \
121
+ --recovery-codes --audit-logging --internal-request
122
+ ```
123
+ :::
124
+
125
+ 3. Configure the authentication controller:
126
+
127
+ ```ruby
128
+ # app/controllers/resource_controller.rb
129
+ class ResourceController < PlutoniumController
130
+ include Plutonium::Resource::Controller
131
+ include Plutonium::Auth::Rodauth(:user)
132
+ end
133
+ ```
134
+
135
+ ::: tip
136
+ You can use your existing authentication system by implementing the `current_user` method in `ResourceController`.
137
+ :::
138
+
139
+ <!--
140
+ ## Asset Pipeline Setup
141
+
142
+ ### JavaScript Setup
143
+
144
+
145
+ Plutonium uses modern JavaScript features. Here's how to set it up:
146
+
147
+ 1. Install required npm packages:
148
+
149
+ ::: code-group
150
+ ```bash [importmap]
151
+ bin/importmap pin @radioactive-labs/plutonium
152
+ ```
153
+
154
+ ```bash [esbuild]
155
+ yarn add @radioactive-labs/plutonium
156
+ ```
157
+ :::
158
+
159
+
160
+ 2. Configure JavaScript:
161
+
162
+ ::: code-group
163
+ ```js [app/javascript/controllers/index.js]
164
+ import { application } from "controllers/application"
165
+ import { registerControllers } from "@radioactive-labs/plutonium" // [!code ++]
166
+ registerControllers(application) // [!code ++]
167
+ ```
168
+
169
+ ```js [app/javascript/application.js]
170
+ import "@hotwired/turbo-rails"
171
+ import "controllers"
172
+ ```
173
+ :::
174
+
175
+ ### CSS Setup
176
+
177
+ Plutonium uses Tailwind CSS. Configure it in your `tailwind.config.js`:
178
+
179
+ ```js
180
+ const defaultTheme = require('tailwindcss/defaultTheme')
181
+
182
+ module.exports = {
183
+ content: [
184
+ './app/views/**/*.erb',
185
+ './app/helpers/**/*.rb',
186
+ './app/javascript/**/*.js',
187
+ './app/components/**/*.{erb,rb}',
188
+ './node_modules/@radioactive-labs/plutonium/**/*.{js,ts}'
189
+ ],
190
+ theme: {
191
+ extend: {
192
+ fontFamily: {
193
+ sans: ['Inter var', ...defaultTheme.fontFamily.sans],
194
+ },
195
+ },
196
+ },
197
+ plugins: [
198
+ require('@tailwindcss/forms'),
199
+ require('flowbite/plugin')
200
+ ],
201
+ }
202
+ ```
203
+ -->
204
+
205
+ ## Optional Enhancements
206
+
207
+ ### Database Performance
208
+
209
+ For PostgreSQL/MySQL users, add these recommended gems:
210
+
211
+ ```ruby
212
+ group :development, :test do
213
+ # N+1 query detection
214
+ gem "prosopite"
215
+ end
216
+
217
+ # Automatic eager loading
218
+ gem "goldiloader"
219
+ ```
220
+
221
+ ### Development Tools
222
+
223
+ Add helpful development gems:
224
+
225
+ ```ruby
226
+ # Generate model annotations
227
+ rails generate pu:gem:annotate
228
+
229
+ # Set up environment variables
230
+ rails generate pu:gem:dotenv
231
+ ```
232
+
233
+ <!--
234
+ ## Verification
235
+
236
+ Verify your installation:
237
+
238
+ ```bash
239
+ # Start your Rails server
240
+ rails server
241
+
242
+ # Check your logs for any warnings or errors
243
+ tail -f log/development.log
244
+
245
+ # Generate and test a sample resource
246
+ rails generate pu:res:scaffold Post title:string content:text
247
+ ```
248
+
249
+ Visit `http://localhost:3000/posts` to verify everything is working.
250
+ -->
251
+
252
+ <!--
253
+ ::: tip Next Steps
254
+ Now that you have Plutonium installed and configured, you're ready to:
255
+ 1. [Create your first resource](/guide/resources/creating-resources)
256
+ 2. [Set up your first package](/guide/packages/creating-packages)
257
+ 3. [Configure authorization](/guide/authorization/basic-setup)
258
+ :::
259
+ -->
260
+
261
+ <!--
262
+ ### Getting Help
263
+
264
+ If you run into issues:
265
+
266
+ 1. Check the [FAQ](/guide/faq)
267
+ 2. Search [GitHub Issues](https://github.com/radioactive-labs/plutonium-core/issues)
268
+ 3. Join our [Discord Community](https://discord.gg/plutonium)
269
+ 4. Create a new [GitHub Issue](https://github.com/radioactive-labs/plutonium-core/issues/new)
270
+ -->