DAON Integration Examples
Show Don’t Tell - Working Code Examples
These examples prove how simple DAON integration is. Copy, paste, and you’re protecting creators in minutes.
Quick Integration Examples
1. Next.js Blog (3 lines of code)
import { protect } from 'daon-sdk';
// Protect content when publishing
const result = await protect(postContent, {
title: post.title,
author: post.author
});
console.log('🛡️ Protected!', result.verificationUrl);
Full example: ./nextjs-blog/
2. PHP/WordPress (auto-protect posts)
// Automatically protects posts as they're published
add_action('save_post', 'daon_auto_protect');
function daon_auto_protect($post_id) {
$content = get_post_field('post_content', $post_id);
$daon = new Daon\DaonClient();
$result = $daon->protect($content, [
'title' => get_the_title($post_id),
'author' => get_the_author_meta('display_name')
], 'liberation_v1');
}
3. Ruby/Rails (AO3 integration)
class Work < ApplicationRecord
after_create :protect_with_daon
def protect_with_daon
work = Daon::Work.from_activerecord(self)
Daon.protect(work.content, work.metadata, 'liberation_v1')
end
end
Full integration: See ../AO3_INTEGRATION_GUIDE.md
4. Python/Django (2 lines)
import daon
# Protect content anywhere
result = daon.protect(content, metadata={'title': title, 'author': author})
print(f"🛡️ Protected: {result.verification_url}")
5. PHP/Laravel (3 lines)
use Daon\DaonClient;
$daon = new DaonClient();
$result = $daon->protect($content, $metadata, 'liberation_v1');
echo "🛡️ Protected: " . $result->verificationUrl;
Platform-Specific Examples
Fanfiction Platforms
Archive of Our Own (AO3)
# Add to Work model
include Daon::WorkMixin
# Automatic protection on publish
auto_protect_with_daon license: 'liberation_v1'
FanFiction.Net
There is no DAON browser extension – see the note on why. Register a published work by pasting it into the web tool, or from your own server with any SDK:
const result = await daon.protect(text, { license: 'liberation_v1' });
console.log(result.verificationUrl);
Blogging Platforms
Medium Alternative
// Next.js with DAON protection
export async function publishPost(post: Post) {
// Publish normally
const published = await db.posts.create(post);
// Add DAON protection
const protected = await protect(post.content, {
title: post.title,
author: post.author,
url: `https://yourblog.com/posts/${post.slug}`
});
// Update with protection info
await db.posts.update(published.id, {
daonHash: protected.contentHash,
protectionUrl: protected.verificationUrl
});
return published;
}
Ghost Blog
// Ghost webhook integration
app.post('/webhook/post-published', async (req, res) => {
const post = req.body.post.current;
// Protect with DAON
const result = await protect(post.plaintext, {
title: post.title,
author: post.primary_author.name,
url: post.url
});
// Store protection info in Ghost
await updatePostMeta(post.id, {
daon_hash: result.contentHash,
daon_verification: result.verificationUrl
});
});
Academic Platforms
ArXiv-style Preprint Server
class Paper(models.Model):
title = models.CharField(max_length=200)
content = models.TextField()
authors = models.ManyToManyField(Author)
def save(self, *args, **kwargs):
super().save(*args, **kwargs)
# Auto-protect academic papers
if self.content:
result = daon.protect(
self.content,
metadata={
'title': self.title,
'authors': [a.name for a in self.authors.all()],
'type': 'academic_paper',
'institution': self.institution.name
},
license='cc_by_nc_sa' # Academic-friendly
)
self.daon_hash = result.content_hash
self.save(update_fields=['daon_hash'])
Research Blog
// Protect research posts automatically
const protectResearchPost = async (post: ResearchPost) => {
const result = await protect(post.content, {
title: post.title,
authors: post.authors.map(a => a.name),
institution: post.institution,
field: post.researchField,
publishedAt: post.publishedAt
}, 'cc_by_nc'); // CC license for academic use
return {
...post,
protection: result
};
};
Development Setup
For Testing (Any Platform)
# 1. Clone integration examples
git clone https://github.com/daon-network/integration-examples
# 2. Choose your platform
cd nextjs-blog # For Next.js
cd wordpress-plugin # For WordPress
cd rails-integration # For Rails/AO3
cd django-blog # For Django
cd php-site # For PHP
# 3. Install dependencies
npm install # Node.js
composer install # PHP
bundle install # Ruby
pip install -r requirements.txt # Python
# 4. Configure DAON API
cp .env.example .env
# Edit DAON_API_URL=https://api.daon.network
# 5. Run example
npm run dev # Next.js
php -S localhost:8000 # PHP
rails server # Rails
python manage.py runserver # Django
Copy-Paste Snippets
Protection Helper Function
// TypeScript/JavaScript
export async function protectContent(
content: string,
metadata: any = {},
license: string = 'liberation_v1'
) {
try {
const result = await protect(content, metadata, license);
if (result.success) {
console.log('🛡️ Content protected:', result.verificationUrl);
return result;
} else {
console.error('❌ Protection failed:', result.error);
return null;
}
} catch (error) {
console.error('❌ Protection error:', error);
return null;
}
}
# Python
def protect_content(content, metadata=None, license='liberation_v1'):
"""Protect content with DAON - handles errors gracefully."""
try:
result = daon.protect(content, metadata or {}, license)
if result.success:
print(f"🛡️ Content protected: {result.verification_url}")
return result
else:
print(f"❌ Protection failed: {result.error}")
return None
except Exception as e:
print(f"❌ Protection error: {e}")
return None
<?php
// PHP
function protect_content($content, $metadata = [], $license = 'liberation_v1') {
try {
$daon = new Daon\DaonClient();
$result = $daon->protect($content, $metadata, $license);
if ($result->success) {
echo "🛡️ Content protected: " . $result->verificationUrl . "\n";
return $result;
} else {
echo "❌ Protection failed: " . $result->error . "\n";
return null;
}
} catch (Exception $e) {
echo "❌ Protection error: " . $e->getMessage() . "\n";
return null;
}
}
?>
# Ruby
def protect_content(content, metadata = {}, license = 'liberation_v1')
begin
result = Daon.protect(content, metadata, license)
if result.success
puts "🛡️ Content protected: #{result.verification_url}"
result
else
puts "❌ Protection failed: #{result.error}"
nil
end
rescue => e
puts "❌ Protection error: #{e.message}"
nil
end
end
Protection Status Display
<!-- HTML/CSS for protection badges -->
<div class="protection-badge protected">
<span class="shield">🛡️</span>
<span>Protected by DAON</span>
<a href="" target="_blank" class="verify-link">Verify</a>
</div>
<div class="protection-badge unprotected">
<span class="warning">⚠️</span>
<span>Not protected</span>
<button onclick="protectContent()" class="protect-btn">Protect Now</button>
</div>
<style>
.protection-badge {
display: inline-flex;
align-items: center;
padding: 6px 12px;
border-radius: 20px;
font-size: 14px;
font-weight: 500;
gap: 6px;
}
.protected {
background: #d4edda;
border: 1px solid #c3e6cb;
color: #155724;
}
.unprotected {
background: #fff3cd;
border: 1px solid #ffeaa7;
color: #856404;
}
.verify-link {
text-decoration: underline;
color: inherit;
}
.protect-btn {
background: #007bff;
color: white;
border: none;
padding: 4px 8px;
border-radius: 4px;
cursor: pointer;
}
</style>
Success Metrics
Integration Complexity
| Platform | Lines of Code | Setup Time | Complexity |
|---|---|---|---|
| WordPress | 1 (plugin install) | 2 minutes | ⭐ |
| Next.js | 3 lines | 5 minutes | ⭐ |
| Rails/AO3 | 5 lines | 10 minutes | ⭐⭐ |
| Django | 8 lines | 15 minutes | ⭐⭐ |
| PHP | 10 lines | 15 minutes | ⭐⭐ |
Developer Experience
- Copy-paste ready - All examples work immediately
- Error handling - Graceful failure, never breaks existing functionality
- Documentation - Every example is fully documented
- Testing - Dry-run modes for safe testing
- Support - GitHub issues
Production Examples
DAON is early-stage and has no public production deployments to point at yet.
This section previously listed four .example sites with post counts and three
testimonials from a “Platform Developer”, a “Content Creator” and a “Startup
Founder”. None of them were real. They have been removed rather than rewritten,
because an invented endorsement is worse than an empty section.
If you deploy DAON somewhere public and are willing to be named, open an issue – a real integration listed here would be worth more than the four invented ones were.
Get Started
- Choose your platform from examples above
- Copy the integration code (usually 3-10 lines)
- Install DAON SDK for your language
- Test with dry-run mode first
- Deploy and protect creators!
Questions? Open a GitHub issue: https://github.com/daon-network/daon/issues
Issues? GitHub: https://github.com/daon-network/integration-examples
Every platform integration is an act of creator protection. 🛡️
Make it so easy that NOT protecting creators becomes the harder choice.