SaasPlatform 💎

Gem Version License: MIT Rails Version Security Scan

SaasPlatform is an enterprise-grade, mountable Ruby on Rails 8 engine that delivers a complete SaaS Operating System. It provides a premium Apple-inspired GUI, robust multi-tenancy, banking logic, ecommerce, and enterprise security out of the box.


🏗 Installation

Add this line to your application's Gemfile:

gem 'saas_platform'

1. Initialize Infrastructure

Run the following commands to install migrations and prepare your database:

$ bundle install
$ bin/rails saas_platform:install:migrations
$ bin/rails db:migrate

2. Mount the GUI

Mount the engine in your config/routes.rb. This is where your users and admins will access the platform.

Rails.application.routes.draw do
  # You can mount it at any path, e.g., /app, /admin, or /dashboard
  mount SaasPlatform::Engine => "/app"
end

3. Add Middleware

Enable rate-limiting security in config/application.rb:

config.middleware.use Rack::Attack

🖥 Using the GUI (Graphical User Interface)

SaasPlatform features a high-end design system inspired by macOS and iOS. All interfaces are fully responsive and support Hotwire (Turbo/Stimulus) for a "Single Page App" feel.

1. Authentication (Glassmorphic Interface)

Access the login page at /app/users/sign_in.

  • Design: Features a centered frosted-glass card with native SF-inspired typography.
  • Flows: Includes premium layouts for Sign In, Sign Up, Password Reset, and 2FA Verification.

2. The Main Dashboard

The primary landing zone for users (/app).

  • Sidebar: Persistent navigation with frosted-glass effects. Includes sections for Overview, Orders, Products, and Settings.
  • Analytics Widgets: Real-time charts showing Revenue Growth (Line Chart) and Top Products (Bar Chart).
  • Recent Activity: Live data tables showing latest transactions and orders with status badges.

Located in the top navigation bar.

  • Functionality: Instant search across all your data (Users, Products, Orders).
  • Security: Automatically filters results based on the current user's Account (Multi-tenant isolation).

4. Notification Center 🔔

The "Bell" icon in the top right tracks all system activity.

  • Real-time: Alerts appear instantly via Turbo Streams.
  • Management: Users can view recent notifications and mark them as read directly from the dropdown.

5. Enterprise Audit Logs 📜

Available for accounts on the Enterprise Plan.

  • Location: /app/audit_logs.
  • GUI Feature: A detailed list showing exactly who changed what data, including "before and after" snapshots.

🛠 Developer Guide (Customizing the GUI)

Using ViewComponents

You can use the platform's premium UI components in your own host application views:

<%# Render a native-feeling card %>
<%= render SaasPlatform::CardComponent.new(glass: true) do %>
  <h3 class="text-lg font-bold">Custom Widget</h3>
  <p>Your custom content here...</p>
<% end %>

<%# Render a native Apple-style button %>
<%= render SaasPlatform::ButtonComponent.new(variant: :primary) do %>
  Action Item
<% end %>

Role-Based Access (RBAC)

Control what users see in the GUI based on their roles:

user = SaasPlatform::User.find(1)
user.add_role(:admin) # Now has access to admin-only GUI features

Plan-Based Gating

Hide or show GUI features based on the account's subscription:

<% if current_account.can_use?(:advanced_analytics) %>
  <%= render "premium_gui_widget" %>
<% end %>

💰 Banking & Fintech Logic

The GUI interfaces directly with a robust backend banking system:

  • Atomic Wallets: Every account has a balance managed in cents (money-rails).
  • Transaction Integrity: Every credit/debit is logged with a polymorphic reference.
# Example: Process a GUI-triggered refund
.wallet.credit!(order.total, category: "refund", reference: order)

🔒 Security Standards

  • Rate Limiting: Throttles brute-force attempts on the GUI login.
  • Secure Headers: Injected CSP to prevent XSS and clickjacking.
  • Multi-Tenancy: The GUI never shows data from another account.

📄 License

The gem is available as open source under the terms of the MIT License.


Built for excellence by Shiboshree Roy. 🚀