|
|
||
|---|---|---|
| src | ||
| .gitignore | ||
| index.html | ||
| LICENSE | ||
| package.json | ||
| README.md | ||
| vite.config.js | ||
Communitator
A Nostr web application that allows community leaders to create and share relay templates for new users. Users can apply these templates with one click, automatically updating their relay lists (kind 10002), blossom servers (kind 10063), and DM relays (kind 10050).
Overview
When new users join Nostr, one of the biggest friction points is choosing and configuring relays. Communitator solves this by letting community leaders create shareable relay templates that users can apply instantly.
Key Features
- Create Relay Templates: Community leaders can define relay sets with read/write permissions
- Shareable Links: Generate unique URLs for each template
- One-Click Apply: Users apply templates with a single signature
- Blossom Server Support: Configure blossom servers (kind 10063)
- DM Relay Support: Set up private messaging relays (kind 10050)
- Community Templates: Pre-configured templates for popular communities
- Blast Relays: Events are published to both user-defined relays and a configurable blast relay set for redundancy. This makes sure that everyone get to know the new relays the user is leveraging
- Browser Extension Support: Works with Alby, Nos2x, and other NIP-07 extensions
How It Works
For Template Creators
- Create a template with:
- Main relays (with read/write permissions)
- Blossom servers (for media hosting)
- DM relays (for private messages)
- Template name and description
- Generate a shareable link
- Share the link with your community
For Template Users
- Click the shared template link
- Connect your Nostr extension
- Review the relay configuration
- Click "Apply Template"
- Events are published to all configured relays and blast relays
Technology Stack
- React with Vite for fast development
- nostr-tools for Nostr protocol operations
- NIP-07 extension support (Alby, Nos2x, etc.)
- Pure CSS with responsive design
Installation
Prerequisites
- Node.js (v18 or later)
- npm or yarn
- A Nostr extension (Alby, Nos2x, etc.)
Setup
# Clone the repository
git clone https://git.basspistol.org/hq/Communitator.git
cd Communitator
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
The development server will start at https://localhost:3000 (HTTPS is required for Nostr extensions).
Configuration
Blast Relays
Blast relays are used to ensure events are published to reliable relays regardless of the user's configuration. Configure them in src/hooks/useNostr.js:
const BLAST_RELAYS = [
'wss://relay.primal.net',
'wss://relay.damus.io',
'wss://relay.ditto.pub',
'wss://offchain.pub',
'wss://sendit.nosflare.com',
'wss://nostr.mom',
'wss://nos.lol'
];
Community Templates
Add or modify community templates in src/utils/templates.js:
export const getCommunityTemplates = () => {
return {
'my-community': {
id: 'my-community',
name: 'My Community',
description: 'Official relay set for My Community',
relays: [
{ url: 'wss://relay.mycommunity.com', read: true, write: true },
{ url: 'wss://relay.damus.io', read: true, write: true }
],
blossomServers: [
{ url: 'https://cdn.mycommunity.com' }
],
dmRelays: [
{ url: 'wss://dm.mycommunity.com' }
]
}
};
};
Default Relays
Change the landing defaults in src/components/TemplateCreator.jsx:
const [relays, setRelays] = useState([
{ url: 'wss://your-cool.relay', read: true, write: true }
]);
const [blossomServers, setBlossomServers] = useState([
{ url: 'https://your-blossom.server' }
]);
const [showBlossom, setShowBlossom] = useState(true);
const [dmRelays, setDmRelays] = useState([
{ url: 'wss://your-dm.relay' }
]);
const [showDmRelays, setShowDmRelays] = useState(true);
Deployment
Build for Production
# Build the webapp
npm run build
This creates a dist folder with all static assets ready for deployment.
Deploy to Any Static Host
Upload the contents of the dist folder to any static web host (Netlify, Vercel, Cloudflare Pages, etc.).
#Deploy to your server
rsync -av dist/ user@remote.server.tld:/path/to/webroot/
Example: Nginx Configuration
server {
listen 443 ssl http2;
server_name yourdomain.com;
root /var/www/communitator/dist;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
}
Event Types
| Kind | Description | Published To |
|---|---|---|
| 10002 | User's main relays | Blast relays + User's relays |
| 10063 | Blossom servers | Blast relays + User's relays |
| 10050 | DM relays | Blast relays + User's relays |
Requirements
- HTTPS: Nostr extensions require a secure context
- Nostr Extension: Alby, Nos2x, or any NIP-07 compatible extension
- Modern Browser: Chrome, Firefox, Safari (latest versions)
Browser Extension Support
The app works with any NIP-07 compatible Nostr extension:
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
License
MIT
Repository: https://git.basspistol.org/hq/Communitator