Skip to Content
LightRateQuick Start

Quick Start

Get started with LightRate in minutes. This guide will walk you through setting up your account, creating your first rate limiting rule, and integrating with your application.

Create Your Account and Get API Credentials

  1. Sign up for a LightRate account at https://lightrate.lightbournetechnologies.ca 
  2. Navigate to SettingsAPI Keys
  3. Click Create API Key
  4. Save your API key securely - you’ll need it for configuration

Keep your API key secure! Never commit it to version control. Use environment variables instead.

Create Your First Application

Applications are containers for rate limiting rules.

  1. Go to DashboardApplications
  2. Click Create Application
  3. Enter your application details:
    • Name: e.g., “My API”
    • Default Refill Rate: 5 tokens/second (how fast tokens replenish)
    • Default Burst Rate: 50 tokens (maximum tokens available)
  4. Copy your Application ID - you’ll need this for your client configuration

Install the Client SDK

Choose your language/framework and install the appropriate SDK:

Add to your Gemfile:

gem 'lightrate-client'

Then install:

bundle install

Configure Your Client

Set up your client with the API key and Application ID from steps 1 and 2:

require 'lightrate_client' # Configure globally LightrateClient.configure do |config| config.api_key = ENV['LIGHTRATE_API_KEY'] config.application_id = ENV['LIGHTRATE_APPLICATION_ID'] end # Or create a client instance client = LightrateClient::Client.new( ENV['LIGHTRATE_API_KEY'], ENV['LIGHTRATE_APPLICATION_ID'] )

Add Rate Limiting to Your Code

Now implement rate limiting in your application:

# Consume tokens for an operation (uses local token bucket) response = client.consume_local_bucket_token( operation: 'send_email', user_identifier: 'user123' ) if response.success # Proceed with your operation send_email_to_user(user) puts "Email sent! Token consumed from #{response.used_local_token ? 'local bucket' : 'server'}" else # Rate limited puts "Rate limit exceeded. Please try again later." end

What’s Next?

Now that you have basic rate limiting set up, explore more advanced features:

Need Help?

Common Issues

Rate limits not working? Make sure you:

  • Have the correct API key and Application ID
  • Created at least one rule or are using the default application limits
  • Are using the correct user identifier format
  • Have internet connectivity (client needs to reach LightRate API)
Last updated on