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
- Sign up for a LightRate account at https://lightrate.lightbournetechnologies.ca
- Navigate to Settings → API Keys
- Click Create API Key
- 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.
- Go to Dashboard → Applications
- Click Create Application
- 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)
- 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:
Ruby
Add to your Gemfile:
gem 'lightrate-client'Then install:
bundle installConfigure Your Client
Set up your client with the API key and Application ID from steps 1 and 2:
Ruby
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:
Ruby
# 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."
endWhat’s Next?
Now that you have basic rate limiting set up, explore more advanced features:
- Custom User Identification - Rate limit by API key, IP address, or custom identifiers
- Multiple Rate Limits - Create different rules for different operations
- Error Handling - Handle rate limit errors gracefully
- Local Token Buckets - Understand how LightRate improves performance with client-side buckets
Need Help?
- Full Documentation - Complete API reference and guides
- SDK Documentation - Detailed docs for each client library
- Support - Contact us at support@lightbourne.com
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