1. Install


yarn add stimulus 
mkdir app/javascript/controllers
touch app/javascript/controllers/index.js


import 'controllers'


import { Application } from "stimulus"
import { definitionsFromContext } from "stimulus/webpack-helpers"

const application = Application.start()
const context = require.context(".", true, /\.js$/)

2. See if it works


import { Controller } from 'stimulus'; 
export default class extends Controller {
  connect() {
    console.log("hello from StimulusJS")

in a view:

<div data-controller="hello">

Now when you open the view, the div will call the hello_controller and add hello from StimulusJS in your browser console.