> For the complete documentation index, see [llms.txt](https://docs.hyperstack.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hyperstack.org/development-workflow/hyper-spec/04-using-with-rack.md).

# Using with Rack

Hyperspec will run with Rails out of the box, but you can also use Hyperspec with any Rack application, with just a little more setup. For example here is a sample configuration setup with Sinatra:

```ruby
# Gemfile
...

gem "sinatra"
gem "rspec"
gem "pry"
gem "opal"
gem "opal-sprockets"
gem "rack"
gem "puma"
group :test do
  # gem 'hyper-spec', '~> 1.0.alpha1.0'
  # or to use edge:
  gem 'hyper-spec',
      git: 'git://github.com/hyperstack-org/hyperstack.git',
      branch: 'edge',
      glob: 'ruby/*/*.gemspec'
end
```

```ruby
# spec/spec_helper.rb

require "bundler"
Bundler.require
ENV["RACK_ENV"] ||= "test"

# require your application files as needed
require File.join(File.dirname(__FILE__), "..", "app.rb")

# bring in needed support files
require "rspec"
require "rack/test"
require "hyper-spec/rack"

# assumes your sinatra app is named app
Capybara.app = HyperSpecTestController.wrap(app: app)

set :environment, :test
set :run, false
set :raise_errors, true
set :logging, false
```

## Details

The interface between Hyperspec and your application environment is defined by the `HyperspecTestController` class. This file typically includes a set of helper methods from `HyperSpec::ControllerHelpers`, which can then be overridden to give whatever behavior your specific framework needs. Have a look at the `hyper-spec/rack.rb` and `hyper-spec/controller_helpers.rb` files in the Hyperspec gem directory.

## Example

A complete (but very simple) example is in this repos `ruby/examples/misc/sinatra_app` directory


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.hyperstack.org/development-workflow/hyper-spec/04-using-with-rack.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
