SubstackAPI on GitHub
SubstackAPI is open source and available on GitHub.
Challenge
Substack does not offer a public API. There are currently two ways to access data from a Substack publication:- Use the Substack publication RSS feed
- Use the Substack unofficial/internal API
- ✓ Publicly available and stable
- ✓ Official support from Substack
- ✗ Limited data access
- ✗ Slower query performance
- ✓ Rich data access
- ✓ Fast query performance
- ✗ No official support
- ✗ Could break without notice
- ✗ Restrictive rate limits
Solution
To address these limitations, SubstackAPI implements a hybrid approach:-
Primary Data Source: Unofficial API
- Used to fetch publication data
- Rate limiting handled through minimizing requests
-
Fallback Mechanism: RSS Feed
- Provides backup data access
- Ensures service continuity if unofficial API changes
-
Caching Layer: Redis
- Minimizes calls to the unofficial API
- Provides fast, low-latency data access
- Handles large amounts of requests efficiently
- Reliable and unlimited access to publication data
- Minimal dependency on the unofficial API
- Fast response times
- High availability through fallback mechanisms