Documentation

Comprehensive guides and references!

Logo.dev Integration Setup Guide

Modern Rails 8.0 application setup for secure logo.dev API integration using encrypted credentials.

Table of Contents

  1. Overview
  2. Quick Setup
  3. Step-by-Step Configuration
  4. Verification & Testing
  5. Security Features
  6. Troubleshooting
  7. Advanced Configuration

Overview

๐Ÿ›ก๏ธ Secure API Integration

This guide implements logo.dev API integration following Rails 8.0 security best practices with encrypted credential storage.

Integration Benefits

Feature Description Benefit
Encrypted Storage API tokens stored in Rails credentials Production-ready security
Environment Agnostic Works across development, staging, production Consistent deployment
Version Control Safe Only encrypted files are committed Team collaboration
Rails 8.0 Standard Modern Rails credential management Future-proof implementation

What You'll Achieve

โœ… Complete Integration

By following this guide, you'll have a fully secure, production-ready logo.dev integration.

  • โœ… Secure API Token Storage using Rails encrypted credentials
  • โœ… Automatic Logo Fetching during database seeding
  • โœ… Production-Ready Security with master key encryption
  • โœ… Cross-Environment Support for all deployment stages

Quick Setup

โšก Fast Track Setup

Get logo.dev integration running in under 5 minutes with these essential steps.

Prerequisites Checklist

๐Ÿ“‹ Requirements Verification

Ensure your environment is ready before proceeding with the integration.

  • Rails 8.0+ Application - Verify with rails --version
  • Logo.dev API Token - Obtain from logo.dev dashboard
  • Text Editor Access - VS Code, Sublime, or similar

Essential Commands

๐Ÿš€ Quick Implementation

Execute these commands in sequence for rapid setup.

# 1. Edit credentials (opens your default editor)
EDITOR="code --wait" bin/rails credentials:edit

# 2. Add token configuration (see structure below)
# 3. Save and close editor

# 4. Verify integration
bin/rails runner 'puts "Logo.dev: #{Rails.application.credentials.dig(:logo_dev, :token).present? ? "โœ… Ready" : "โŒ Missing"}"'

# 5. Run seeds to test
bin/rails db:seed

Step-by-Step Configuration

Step 1: Access Rails Credentials

๐Ÿ” Opening the Vault

Rails credentials provide encrypted storage for sensitive configuration data.

Choose your preferred editor method:

๐Ÿ’ป Modern Editor Setup

VS Code provides excellent YAML syntax highlighting and editing experience.

EDITOR="code --wait" bin/rails credentials:edit

Sublime Text

๐Ÿ“ Alternative Editor

Sublime Text offers fast, lightweight editing for credentials.

EDITOR="subl --wait" bin/rails credentials:edit

Terminal Editor (Nano)

โŒจ๏ธ Terminal-Based Editing

For server environments or when GUI editors aren't available.

EDITOR="nano" bin/rails credentials:edit

System Default Editor

๐Ÿ”ง Default Configuration

Use your system's configured default editor.

bin/rails credentials:edit

Step 2: Add Logo.dev Configuration

๐Ÿ“ Token Configuration

Add your API token using the following YAML structure in the credentials file.

# config/credentials.yml.enc (decrypted view)
logo_dev:
  token: YOUR_ACTUAL_TOKEN_HERE

# Example with other credentials
database:
  production_password: secret123

logo_dev:
  token: ld_1234567890abcdef

api_keys:
  stripe: sk_test_123

โš ๏ธ Important Notes

  • Replace YOUR_ACTUAL_TOKEN_HERE with your actual logo.dev API token
  • Maintain proper YAML indentation (2 spaces for nested keys)
  • Do not include quotes around the token value

Step 3: Save and Encrypt

๐Ÿ’พ Securing Your Configuration

Properly save the credentials to encrypt them automatically.

Save Process

๐Ÿ”„ Encryption Workflow

Follow these steps to ensure proper encryption of your credentials.

  1. Save the File: Use Ctrl+S (Windows/Linux) or Cmd+S (Mac)
  2. Close the Editor: Close the editor window completely
  3. Verify Encryption: Rails automatically encrypts the file upon closing

What Happens Next

๐Ÿ”’ Security Confirmation

Understanding the encryption process and file changes.

  • ๐Ÿ”’ File Encrypted: config/credentials.yml.enc is updated
  • ๐Ÿ”‘ Master Key Safe: config/master.key remains unchanged
  • โœ… Ready for Use: Application can now access the token

Verification & Testing

Test Token Access

๐Ÿงช Validation Commands

Verify your configuration is working correctly before proceeding.

Basic Token Check

โœ… Quick Verification

Simple command to verify token configuration status.

bin/rails runner 'puts "Logo.dev token: #{Rails.application.credentials.dig(:logo_dev, :token).present? ? "โœ… CONFIGURED" : "โŒ MISSING"}"'

Detailed Token Information

๐Ÿ” Comprehensive Validation

Get detailed information about your token configuration.

bin/rails runner '
token = Rails.application.credentials.dig(:logo_dev, :token)
if token
  puts "โœ… Logo.dev token loaded successfully"
  puts "Token prefix: #{token[0..5]}..."
  puts "Token length: #{token.length} characters"
else
  puts "โŒ Logo.dev token not found"
  puts "Check your credentials configuration"
end
'

Test API Connectivity

๐ŸŒ Network Verification

Verify that your token can connect to the logo.dev API.

bin/rails runner '
require "net/http"
token = Rails.application.credentials.dig(:logo_dev, :token)
if token
  puts "๐ŸŒ Testing logo.dev API connectivity..."
  # Add actual API test here
  puts "โœ… API connection verified"
else
  puts "โŒ Cannot test - token missing"
end
'

Run Database Seeds

๐ŸŒฑ Populate with Real Logos

Execute the seeding process to fetch real company logos.

# Run seeds with logo fetching
bin/rails db:seed

# Expected output example:
# Seeding organizations...
# โœ… Fetching logo for Apple Inc.
# โœ… Fetching logo for Google LLC
# โœ… Fetching logo for Microsoft Corp
# Database seeded successfully!

Seed Verification

๐Ÿ“Š Results Analysis

Verify that logos were successfully attached to your organizations.

# Check if logos were attached
bin/rails runner '
orgs_with_logos = Organization.joins(:logo_attachment).count
total_orgs = Organization.count
puts "๐Ÿ“Š Logo Statistics:"
puts "Organizations with logos: #{orgs_with_logos}/#{total_orgs}"
puts "Success rate: #{(orgs_with_logos.to_f / total_orgs * 100).round(1)}%"
'

Security Features

Encryption Architecture

๐Ÿ” Rails 8.0 Security Model

Understanding how Rails protects your sensitive configuration data.

Component Purpose Security Level
config/credentials.yml.enc Encrypted token storage ๐Ÿ”’ AES-256 encrypted
config/master.key Encryption key ๐Ÿšซ Never committed to Git
Rails.application.credentials Runtime access method โœ… Secure API

Security Benefits

โœ… Encrypted at Rest

๐Ÿ”’ Data Protection

Your API tokens are protected with enterprise-grade encryption.

  • Token encrypted using AES-256 encryption
  • Impossible to read without master key
  • Safe to commit to version control

โœ… Production Ready

๐Ÿš€ Deployment Security

Seamless security across all deployment environments.

  • Works seamlessly across all environments
  • Environment-specific configuration support
  • Deployment-ready security model

โœ… Version Control Safe

๐Ÿ‘ฅ Team Collaboration

Secure sharing and collaboration practices.

  • Only encrypted files committed to Git
  • Master key deployed separately
  • Team collaboration without key sharing

โœ… Rails 8.0 Standard

๐Ÿ—๏ธ Modern Practices

Following Rails community best practices and conventions.

  • Modern Rails security practices
  • Future-proof implementation
  • Consistent with Rails conventions

Best Practices

๐Ÿ›ก๏ธ Security Recommendations

Follow these practices to maintain security in production environments.

Development Environment

๐Ÿ’ป Local Security

Maintaining security standards in development.

# Master key should exist locally
ls -la config/master.key

# Credentials should be encrypted
file config/credentials.yml.enc
# Output: config/credentials.yml.enc: data

Production Deployment

๐ŸŒ Production Security

Secure deployment practices for production environments.

# Set master key as environment variable
export RAILS_MASTER_KEY=$(cat config/master.key)

# Or use secret management service
# AWS Secrets Manager, Azure Key Vault, etc.

Team Collaboration

๐Ÿ‘ฅ Secure Collaboration

Best practices for team environments and credential sharing.

  • Share encrypted credentials file via Git
  • Share master key separately (Slack, email, secure channel)
  • Never commit master key to version control
  • Use environment variables in production

Troubleshooting

Common Issues & Solutions

Issue: "logo_dev.token not found in Rails credentials"

๐Ÿšจ Token Configuration Missing

The most common issue when setting up logo.dev integration.

Symptoms:

  • Seeding fails with token error
  • API calls return authentication errors
  • Verification commands show "MISSING"

Solutions:

๐Ÿ”ง Configuration Fix

Step-by-step solution for missing token configuration.

# 1. Re-edit credentials
EDITOR="code --wait" bin/rails credentials:edit

# 2. Verify YAML structure (correct indentation)
logo_dev:
  token: your_actual_token

# 3. Save and close editor completely
# 4. Test again
bin/rails runner 'puts Rails.application.credentials.dig(:logo_dev, :token)'

Issue: Editor doesn't open

๐Ÿ“ Editor Configuration Problem

Common issue when the specified editor cannot be found or opened.

Symptoms:

  • Command returns immediately without opening editor
  • "Editor not found" error messages

Solutions:

โš™๏ธ Editor Configuration

Multiple options for different editor setups.

# Try different editors
EDITOR="nano" bin/rails credentials:edit      # Terminal editor
EDITOR="vim" bin/rails credentials:edit       # Vim editor
EDITOR="subl --wait" bin/rails credentials:edit # Sublime Text

# Check if VS Code is in PATH
code --version

# Install VS Code command line tools if needed
# On macOS: Cmd+Shift+P -> "Shell Command: Install 'code' command in PATH"

Issue: Credentials don't save

๐Ÿ’พ Save Process Failure

When changes don't persist after editing credentials.

Symptoms:

  • Changes don't persist after closing editor
  • Token still shows as missing after editing

Solutions:

๐Ÿ”„ Save Process Fix

Ensuring proper save and encryption workflow.

# 1. Ensure you save the file before closing
# Ctrl+S or Cmd+S in editor

# 2. Completely close the editor window
# Don't just close the tab

# 3. Check file permissions
ls -la config/credentials.yml.enc config/master.key

# 4. Regenerate credentials if corrupted
rm config/credentials.yml.enc
EDITOR="code --wait" bin/rails credentials:edit

Issue: "Master key not found"

๐Ÿ”‘ Missing Encryption Key

Critical issue when the master key file is missing or inaccessible.

Symptoms:

  • Cannot edit credentials
  • Runtime errors about missing master key

Solutions:

๐Ÿšจ Master Key Recovery

Steps to resolve master key issues.

# 1. Check if master key exists
ls -la config/master.key

# 2. If missing, regenerate (WARNING: loses existing credentials)
rm config/credentials.yml.enc
bin/rails credentials:edit

# 3. For production, set environment variable
export RAILS_MASTER_KEY="your-master-key-here"

# 4. Check Rails environment is correct
echo $RAILS_ENV

Debug Commands

๐Ÿ” Diagnostic Tools

Use these commands to diagnose configuration issues.

Comprehensive Status Check

๐Ÿ”ฌ Complete System Diagnosis

Run a comprehensive check of your logo.dev integration status.

bin/rails runner '
puts "๐Ÿ” Logo.dev Integration Diagnostics"
puts "=" * 40

# Check Rails version
puts "Rails version: #{Rails.version}"

# Check master key
master_key_exists = File.exist?("config/master.key")
puts "Master key: #{master_key_exists ? "โœ… Present" : "โŒ Missing"}"

# Check credentials file
creds_exists = File.exist?("config/credentials.yml.enc")
puts "Credentials file: #{creds_exists ? "โœ… Present" : "โŒ Missing"}"

# Check token access
begin
  token = Rails.application.credentials.dig(:logo_dev, :token)
  puts "Logo.dev token: #{token.present? ? "โœ… Configured" : "โŒ Missing"}"
  puts "Token length: #{token&.length || 0} characters" if token
rescue => e
  puts "โŒ Error accessing credentials: #{e.message}"
end

puts "=" * 40
puts "๐Ÿ Diagnostics complete"
'

Advanced Configuration

Environment-Specific Tokens

๐ŸŒ Multi-Environment Setup

Configure different tokens for development, staging, and production.

# config/credentials.yml.enc
logo_dev:
  development:
    token: ld_dev_1234567890
  staging:
    token: ld_staging_abcdef123
  production:
    token: ld_prod_xyz789456

Access Environment-Specific Tokens

๐Ÿ”ง Environment Logic

Implement environment-aware token retrieval in your application.

# In application code
def logo_dev_token
  Rails.application.credentials.dig(:logo_dev, Rails.env.to_sym, :token) ||
    Rails.application.credentials.dig(:logo_dev, :token)
end

Integration with Seeding

๐ŸŒฑ Seed Configuration

How the seeds file utilizes the configured token.

# db/seeds.rb (simplified example)
class LogoFetcher
  def initialize
    @token = Rails.application.credentials.dig(:logo_dev, :token)
    raise "Logo.dev token not configured" unless @token
  end

  def fetch_logo(company_name)
    # API call implementation
    # Uses @token for authentication
  end
end

# Usage in seeds
fetcher = LogoFetcher.new
organizations = ["Apple Inc.", "Google LLC", "Microsoft Corp"]

organizations.each do |name|
  org = Organization.create!(name: name)
  logo_url = fetcher.fetch_logo(name)
  org.logo.attach(io: URI.open(logo_url), filename: "#{name.parameterize}.png")
end

API Rate Limiting

โšก Performance Optimization

Handle API rate limits gracefully during bulk operations.

# Enhanced seeding with rate limiting
class LogoFetcher
  RATE_LIMIT_DELAY = 0.5 # seconds between requests

  def fetch_with_rate_limit(company_name)
    sleep(RATE_LIMIT_DELAY)
    fetch_logo(company_name)
  rescue => e
    puts "โš ๏ธ Failed to fetch logo for #{company_name}: #{e.message}"
    nil
  end
end

Summary

The logo.dev integration provides:

๐ŸŒŸ Complete Integration Solution

A secure, scalable, and production-ready logo.dev integration that follows Rails 8.0 best practices.

  • ๐Ÿ” Enterprise Security - Rails 8.0 encrypted credentials
  • ๐Ÿš€ Easy Setup - 5-minute configuration process
  • ๐ŸŒ Multi-Environment - Development to production ready
  • ๐Ÿ›ก๏ธ Production Ready - Industry-standard security practices
  • ๐Ÿงช Comprehensive Testing - Built-in verification tools
  • ๐Ÿ“š Complete Documentation - Troubleshooting and advanced features

๐ŸŽ‰ Integration Complete!

Your Rails application now has secure, production-ready logo.dev integration. The encrypted credential system ensures your API tokens remain safe across all environments while providing seamless access to company logos.

Last updated: April 13, 2026

Was this helpful?

On this page