You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: .cursor/architecture/swarm-technical-architecture.md
+14-3
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,15 @@ For detailed notes on implementation challenges, solutions, and lessons learned
65
65
- Created maintenance scripts to monitor service health and automatically restart if needed
66
66
- Implemented comprehensive error handling and logging
67
67
68
-
These recent improvements have significantly enhanced the reliability and functionality of the Swarm Community Platform, ensuring a better user experience for community members.
68
+
3.**CORS and API Access Issues**: The client application had difficulty accessing the feed generator API due to CORS restrictions and hydration challenges.
69
+
-**Root Causes**: Cross-origin restrictions when accessing the feed generator from the client application, and issues with post hydration.
70
+
-**Solutions**:
71
+
- Implemented a dedicated CORS proxy at https://swarm-cors-proxy.onrender.com with comprehensive header handling
72
+
- Developed a direct API access implementation that bypasses problematic proxies when necessary
73
+
- Created a custom `SwarmFeedAPI` class to handle feed data retrieval and hydration
74
+
- Enhanced error handling and diagnostics to better trace and resolve issues
75
+
76
+
These improvements have significantly enhanced the reliability and functionality of the Swarm Community Platform, ensuring a better user experience for community members.
69
77
70
78
## 3. Architecture Overview
71
79
@@ -95,8 +103,9 @@ These recent improvements have significantly enhanced the reliability and functi
95
103
1. AT Protocol firehose sends real-time posts to feed generator
96
104
2. Feed generator filters posts based on community membership and rules
97
105
3. Client application authenticates with the feed generator using JWT tokens via Bluesky credentials
98
-
4. Client requests feed data from feed generator
99
-
5. Users interact with content through the client application
106
+
4. Client requests feed data from feed generator either directly or through the CORS proxy when needed
107
+
5. Custom `SwarmFeedAPI` handles post hydration and data processing
108
+
6. Users interact with content through the client application
100
109
101
110
### Domain Architecture
102
111
The Swarm platform consists of two separate services with distinct domains:
@@ -194,6 +203,8 @@ By maintaining a single feed generator service with support for multiple algorit
194
203
-**Domain Separation**: Maintaining clear separation between the client application domain (swarm-social.onrender.com) and the feed generator service domain (swarm-feed-generator.onrender.com) is crucial for proper functionality.
195
204
-**DID Document Structure**: The AT Protocol has specific requirements for DID document structure, including service types ("BskyFeedGenerator") and service IDs ("#bsky_fg").
196
205
-**Deployment Environment Variables**: Consistent environment variables across development and production environments are essential for proper service configuration.
206
+
-**CORS Handling**: CORS issues between client and feed generator required a dedicated proxy solution, highlighting the importance of cross-origin considerations in distributed architecture.
207
+
-**Direct vs. Proxied Access**: A hybrid approach of direct API access with custom hydration provides the best reliability, bypassing proxy-related issues while maintaining functionality.
197
208
198
209
### Implementation Approach
199
210
-**Modular Design**: The separation of feed generator logic from client application provides flexibility
0 commit comments