API Key Setup
Step-by-step guide to get your Fireship.ai API key and configure it in your project.
Getting Your API Key
1Create Account
- • Visit Fireship.ai
- • Click "Sign Up" or "Sign In"
- • Complete the registration process
2Access Settings
- • Click on your profile avatar in the top right corner
- • Select "Settings" from the dropdown menu
- • Navigate to the "API Keys" tab
3Generate API Key
- • Click "Create New API Key"
- • Enter a descriptive name (e.g., "My Blog Project")
- • Select "Publishable Key" type
- • Click "Generate Key"
- • Copy the key (starts with
fs_
)
⚠️ Important: Save your API key securely. You won't be able to see it again.
Environment Configuration
Local Development
Create or update .env.local
in your project root:
bash
# Fireship Blog API Key
NEXT_PUBLIC_FIRESHIP_BLOG_PUBLISHABLE_KEY=fs_your_actual_api_key_here
Production Deployment
Vercel
- Go to your project dashboard on Vercel
- Navigate to Settings → Environment Variables
- Add new variable:
- • Name:
NEXT_PUBLIC_FIRESHIP_BLOG_PUBLISHABLE_KEY
- • Value:
fs_your_actual_api_key_here
- • Environment: Production, Preview, Development
- • Name:
Netlify
- Go to your site dashboard on Netlify
- Navigate to Site settings → Environment variables
- Click "Add a variable":
- • Key:
NEXT_PUBLIC_FIRESHIP_BLOG_PUBLISHABLE_KEY
- • Value:
fs_your_actual_api_key_here
- • Key:
Validation
Test Your API Key
Create a test file test-api.js
:
javascript
const apiKey = process.env.NEXT_PUBLIC_FIRESHIP_BLOG_PUBLISHABLE_KEY;
if (!apiKey) {
console.error('❌ API key not found');
console.log('Make sure NEXT_PUBLIC_FIRESHIP_BLOG_PUBLISHABLE_KEY is set in .env.local');
} else {
console.log('✅ API key found:', apiKey.substring(0, 10) + '...');
// Test API call
fetch('/api/fireship-blog/posts')
.then(res => res.json())
.then(data => console.log('✅ API response:', data))
.catch(err => console.error('❌ API error:', err));
}
Run: node test-api.js
Check in Browser
Open browser console on your blog page and check:
javascript
console.log('API Key:', process.env.NEXT_PUBLIC_FIRESHIP_BLOG_PUBLISHABLE_KEY);
Security Best Practices
✅ Do's
- • Use environment variables for API keys
- • Use
NEXT_PUBLIC_
prefix for client-side keys - • Keep API keys in
.env.local
(not.env
) - • Add
.env.local
to.gitignore
- • Use different keys for development/production
❌ Don'ts
- • Never commit API keys to version control
- • Don't hardcode keys in your source code
- • Don't share API keys in public channels
- • Don't use server-side keys on the client
API Key Types
Type | Prefix | Usage | Security |
---|---|---|---|
Publishable | fs_pk_ | Client-side, public | Safe to expose |
Secret | fs_sk_ | Server-side only | Keep private |
Note: For the blog component, use Publishable Keys only.