Skip to content

coreyhaines31/cornerstone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

57 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧱 Cornerstone Rails SaaS Template

A Rails 8 SaaS template foundation with modern UI, authentication, and multi-tenancy. Built for rapid development with a clean, modular architecture.

🎯 Current Status

Version: 0.1.0 (Early Development)

This is an actively developed template. See below for what's currently shipped vs. planned.

✨ Features

βœ… Currently Implemented

  • πŸš€ Rails 8.0.4 with PostgreSQL (UUIDs)
  • 🎨 TailwindCSS with dark/light mode support
  • ⚑ Hotwire (Turbo + Stimulus) ready
  • 🎯 Heroicons via rails_icons gem (1,289+ icons)
  • πŸ” Authentication via Devise (email/password configured)
  • πŸ›‘οΈ Authorization via Pundit (base setup complete)
  • 🏒 Multi-tenancy with Account, User, and Membership models
  • πŸ“„ Pages - Homepage, Dashboard, Styleguide
  • 🎨 Icon Helper - Convenient methods for all Heroicons

🚧 In Progress / Planned

  • πŸ’³ Billing - Stripe/Paddle/Polar integration
  • πŸ“§ Email - Provider abstraction (Resend/Postmark/SendGrid/Mailgun)
  • πŸ”’ Security - Rack::Attack, SecureHeaders, and CSP
  • πŸ“Š Observability - Honeybadger/Sentry integration
  • πŸ€– AI Features - LLM integration, agent workflows
  • πŸ“ CMS - Content management system
  • πŸ” SEO - Programmatic SEO tools
  • πŸͺ Webhooks - Webhook delivery system
  • πŸ“ˆ Analytics - Basic attribution dashboard

πŸ“‹ Planned: Switchable Modules

Future goal: Configure different providers in config/cornerstone.yml:

Module Planned Default Planned Alternatives
Billing Stripe Paddle, Polar
Email Resend Postmark, SendGrid, Mailgun
Storage AWS S3 R2, GCS
AI OpenAI Anthropic, Gemini, Ollama
Jobs Sidekiq Solid Queue

πŸ“‹ Planned: Optional Modules (via Generators)

Future generators to extend functionality:

rails g cornerstone:cms        # Page & Post models with inline editing
rails g cornerstone:seo        # Programmatic SEO pipeline
rails g cornerstone:ai         # AI stack with LLM support
rails g cornerstone:webhooks   # Webhook delivery system
rails g cornerstone:analytics  # Basic analytics dashboard

Note: These generators are not yet implemented.

πŸš€ Quick Start

Development Setup

Currently, the best way to use Cornerstone is to clone and develop directly:

# Clone the repository
git clone https://github.com/coreyhaines31/cornerstone.git
cd cornerstone

# Install dependencies and setup database
bin/setup

# Start the development server
bin/dev

The server will start on http://localhost:3000

What You'll See

After setup, you'll have access to:

Environment Setup

Basic environment variables (optional for now):

cp .env.example .env
# Edit .env as needed:
# - APP_NAME (defaults to "Cornerstone")
# - APP_HOST (defaults to "localhost:3000")

Note: Billing, email, and other integrations are not yet required.

πŸ“ Project Structure

app/
β”œβ”€β”€ components/        # ViewComponent UI library
β”œβ”€β”€ controllers/       # Rails controllers
β”œβ”€β”€ models/           # Active Record models
β”œβ”€β”€ policies/         # Pundit authorization policies
β”œβ”€β”€ services/         # Business logic services
└── views/            # Rails views

lib/
└── cornerstone/      # Core template modules
    β”œβ”€β”€ core/         # Core functionality
    β”œβ”€β”€ billing/      # Billing adapters
    β”œβ”€β”€ email/        # Email provider adapters
    β”œβ”€β”€ ai/           # AI provider integrations
    └── generators/   # Module generators

config/
β”œβ”€β”€ cornerstone.yml   # Module configuration
β”œβ”€β”€ ai.yml           # AI provider settings
└── plans.yml        # Subscription plans

πŸ› οΈ Development

Commands

bin/setup     # Initial setup (installs dependencies, prepares database)
bin/dev       # Start development servers (Rails + Tailwind CSS watcher)
bin/test      # Run test suite
bin/lint      # Run linters

Development Server

The bin/dev command starts all necessary processes using Foreman:

The server runs on port 3000 by default. If you need to change the port, you can:

# Temporarily for one session
PORT=4000 bin/dev

# Or edit Procfile.dev to change it permanently
# Change the first line to: web: bin/rails server -p 4000

You can also run processes individually if needed:

rails server        # Just the Rails server
rails tailwindcss:watch  # Just the CSS watcher

Running Tests

bundle exec rspec              # Run all tests
bundle exec rspec spec/models  # Run model tests
bundle exec rspec spec/system  # Run system tests

Code Quality

bundle exec standard           # Ruby style guide
bundle exec erb_lint           # ERB linting
bundle exec brakeman           # Security analysis
bundle exec bundler-audit      # Dependency audit

πŸ”„ Upgrading

Cornerstone includes an upgrade script to help you update to newer versions:

# Upgrade to latest version
ruby upgrade.rb

# Upgrade to specific version
ruby upgrade.rb 1.2.0

# Dry run to see what would change
ruby upgrade.rb --dry-run

🚒 Deployment

The template is configured for deployment to:

  • Heroku - One-click deploy ready
  • Render - Blueprint included
  • Fly.io - fly.toml configuration
  • Docker - Dockerfile included
  • Any VPS - Capistrano ready

Heroku Deploy

heroku create myapp
heroku addons:create heroku-postgresql:mini
heroku addons:create heroku-redis:mini
git push heroku main
heroku run rails db:migrate

Environment Variables

Required environment variables for production:

DATABASE_URL          # PostgreSQL connection
REDIS_URL            # Redis connection
SECRET_KEY_BASE      # Rails secret
STRIPE_SECRET_KEY    # Stripe API key
RESEND_API_KEY       # Email provider key
HONEYBADGER_API_KEY  # Error tracking

πŸ“š Documentation

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

Cornerstone is built on the shoulders of giants:

  • Rails framework and the Rails community
  • All the amazing gem authors whose work powers this template
  • The SaaS founders who've shared their learnings

πŸ”— Links


Built with ❀️ for Rails developers who want to ship faster.

About

An open source Ruby on Rails template

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors