User Profiles Across Nodes
One of the Swarm’s most powerful features is seamless cross-node user profiles. When you view a user from another Synapsis node, their profile loads in full — with accurate stats, posts, and all profile data — as if they were a local user.
How It Works
Synapsis uses the Swarm API for all cross-node communication — direct JSON API calls between Synapsis nodes.
When you click on a user from another node:
Your Node Remote Node
| |
| GET /api/swarm/users/alice |
|---------------------------------->|
| |
| { profile, posts } |
|<----------------------------------|
| |This means interactions between Synapsis nodes are fast, accurate, and real-time.
Why the Swarm API?
The Swarm API was designed specifically for Synapsis:
| Aspect | Swarm API |
|---|---|
| Speed | Single direct request |
| Data freshness | Real-time |
| Profile data | Full profile, clean JSON |
| Stats accuracy | Included in response |
| Complexity | Simple REST API |
What You Get
Full, accurate profile data:
- Display name, bio, avatar, header image
- Accurate follower/following/post counts
- Website link
- Account creation date
- Bot status
- Recent posts with full media and link previews
Following Remote Users
Following works seamlessly:
# Following a Synapsis user on another node
POST /api/users/alice@other.synapsis.social/followFollows are delivered instantly via the Swarm.
Viewing Remote Profiles
Navigate to any federated handle:
https://your-node.com/@alice@other-node.comThe profile page automatically:
- Detects it’s a remote user (handle contains
@domain) - Fetches profile via Swarm API
- Fetches their posts
- Displays everything as a native profile
API Endpoints
GET /api/swarm/users/[handle]
Returns a user’s profile and posts for cross-node requests.
Response:
{
"profile": {
"handle": "alice",
"displayName": "Alice",
"bio": "Building cool stuff",
"avatarUrl": "https://...",
"headerUrl": "https://...",
"website": "https://alice.dev",
"followersCount": 150,
"followingCount": 75,
"postsCount": 342,
"createdAt": "2024-01-15T12:00:00Z",
"isBot": false,
"nodeDomain": "other.synapsis.social"
},
"posts": [
{
"id": "post-123",
"content": "Hello from the swarm!",
"createdAt": "2024-01-20T15:30:00Z",
"likesCount": 12,
"repostsCount": 3,
"repliesCount": 5,
"media": [],
"linkPreviewUrl": null
}
],
"nodeDomain": "other.synapsis.social",
"timestamp": "2024-01-20T16:00:00Z"
}GET /api/users/[handle]
Fetches any user’s profile (local or remote).
For remote users (handle@domain), fetches via Swarm API.
GET /api/users/[handle]/posts
Fetches any user’s posts (local or remote).
For remote users, fetches via Swarm API.
Best Practices
For Node Operators
The Swarm user API is enabled by default. No configuration needed.
For Developers
When building features that display remote users:
- Use the standard
/api/users/[handle]endpoint - It handles Swarm requests automatically
- Check
isSwarmin the response to know the source - Remote user IDs are prefixed with
swarm:
Performance Tips
- Swarm requests timeout after 5 seconds
- Consider caching remote profiles client-side