Quickstart
Get your Rails app connected to Brainz Lab in under 5 minutes.
1. Create an Account
Sign up at brainzlab.ai and create your first project.
2. Get Your API Key
After creating a project, you’ll get a secret key:
sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Keep your secret key safe! Never commit it to version control.
3. Install the SDK
Add the gem to your Gemfile:
Then run:
Create an initializer:
config/initializers/brainzlab.rb
BrainzLab.configure do |config|
config.secret_key = ENV['BRAINZLAB_SECRET_KEY']
end
Add your key to your environment:
BRAINZLAB_SECRET_KEY=sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
5. Start Using!
Logging with Recall
BrainzLab::Recall.info("User signed up", user_id: user.id, plan: "pro")
BrainzLab::Recall.warn("Rate limit approaching", current: 95, limit: 100)
BrainzLab::Recall.error("Payment failed", amount: 99.99, error: e.message)
Error Tracking with Reflex
Errors are automatically captured. Or capture manually:
begin
# risky code
rescue => e
BrainzLab::Reflex.capture(e, user: { id: current_user.id })
raise
end
6. View Your Data
Visit brainzlab.ai/dashboard to see your logs and errors!
What’s Next?