Bullet Train

website·Indexed 33 days ago

https://bullettrain.co/docs

A Ruby on Rails SaaS template featuring Super Scaffolding, a REST API with versioning, and built-in integrations for Stripe Connect and OAuth providers. The framework provides tools for managing roles and permissions via CanCanCan, a system of Field Partials for DRY form logic, and support for distributing applications as desktop apps.

Tokens
35.8K
Snippets
194
Records
264
Agent score
70%

What's inside Bullet Train

  1. Overview of Super Scaffolding capabilities

    Super Scaffolding is Bullet Train's code generation engine designed to produce production-ready CRUD interfaces. When adding a model, it automatically generates approximately 30 files, including:

    • Basic CRUD controllers and views
    • YAML locale files for translatable strings
    • Type-specific form fields
    • API controllers and API documentation entries
    • Serializers for API and webhooks
    • Multitenancy permissions in CanCanCan configuration
    • Table views in parent 'show' views
    • Application navigation entries and breadcrumbs
    • Routes for CRUD and API endpoints

    Note: Generated code contains "magic comments" used as targets for future scaffolding operations; these should not be removed.

  2. Overview of Bullet Train repositories

    Contributing to Bullet Train involves two primary repositories:

    • The starter repo: The repository cloned to start a new Bullet Train application.
    • The core repo: The repository containing most of the Bullet Train gems.
  3. Overview of Bullet Train Action Models

    Action Models are regular models with scaffolded views and controllers used to implement user-facing custom actions in a RESTful way. They are ideal for bulk actions, long-running background tasks with progress tracking, actions requiring configuration options, scheduled tasks, audit trails of who initiated an action, and approval workflows.
  4. Overview of Bullet Train SaaS Framework

    Bullet Train is an MIT-licensed, Rails-based framework designed to accelerate SaaS development by providing opinionated defaults and common product features out of the box. It functions as a 'Rails on Rails' layer, reducing the amount of boilerplate code developers need to write or generate.
  5. Understand the Bullet Train onboarding system

    Bullet Train provides a modifiable structure to define required onboarding steps and forms. This ensures users complete necessary data entry (for either the User or Team) before accessing the full account interface. The system is designed to increase conversion by allowing a minimal initial sign-up form and collecting additional required details during the onboarding flow.
  6. Understand the 'Parent Model' concept in Bullet Train

    In Bullet Train, a 'parent model' refers to the model that another model primarily belongs to (e.g., a Task primarily belongs to a Project). This is distinct from object-oriented class inheritance. This hierarchy is used to drive the application's navigation structure, such as breadcrumbs and nested RESTful routes.
  7. Understand the Account namespace for controllers and views

    Bullet Train uses the Account namespace for controllers and views by default when using Super Scaffolding. This ensures that authenticated resource workflows are kept separate from public-facing resources (which typically reside in the Public namespace).
  8. Understand Bullet Train API versioning defaults

    Bullet Train implements API versioning to maintain a contract with users, ensuring that endpoints (e.g., /api/v1) do not change in breaking ways. By default, the following components are created in versioned namespaces:

    • API controllers: app/controllers/api/v1 (Module: Api::V1)
    • JSON views: app/views/api/v1
    • Routes: config/routes/api/v1.rb
    • Tests: test/controllers/api/v1 (Module: Api::V1)

    Note: Models, factories, and permissions are not versioned, meaning changes to these shared dependencies can still affect versioned API components.

  9. Understand Bullet Train REST API architecture

    Bullet Train automates the creation of a production-grade REST API using standard Rails tooling. Unlike vanilla Rails, it separates browser-based account controllers from API controllers to support versioning and maintenance.

    API endpoints are structured across three locations:

    1. Routes: Defined in config/routes/api/v1.rb.
    2. Controllers: Located in the app/controllers/api/v1 directory (inheriting from ActiveController::API).
    3. Views: Jbuilder templates located in the app/views/api/v1 directory.

    Authentication is handled by the Doorkeeper gem, and authorization leverages the same permission definitions used by account controllers.

  10. Understand Bullet Train Outgoing Webhook Event Types

    Bullet Train delivers webhooks for any model added under Team (referred to as the 'subject'). By default, every model automatically includes three event types based on Active Record Callbacks: created, updated, and destroyed.
  11. Understand Bullet Train's Zapier architecture

    Bullet Train's Zapier integration leverages the application's REST API, outgoing webhook capabilities, and Doorkeeper for OAuth2 authorization. It includes a specialized OAuth2 connection workflow designed to handle the mismatch between user-based OAuth2 and team-based multitenancy.
  12. Get started with Bullet Train

    To begin using Bullet Train, you can clone the official starter repository from GitHub.
    # Clone the starter repo
    git clone https://github.com/bullet-train-co/bullet_train