The Content Watcher Service is a crucial component of the Gateway suite, providing a familiar callback API to retrieve content and publishing announcements from the Frequency blockchain. This document provides an overview of the service, its architecture, and guides for setup and usage.
- 📖 About the Project
- 🔍 Architecture Overview
- 🔑 Key Features
- 💻 Getting Started
- 🚀 API Documentation
- 🛠 Development
- 🤝 Contributing
- ❓ FAQ
- 📝 License
The Content Watcher Service is part of the Gateway suite that provides a Web2-friendly interface for monitoring and retrieving blockchain announcements through a webhook system.
On Frequency, announcements about content (posts, replies, reactions) are stored on-chain, while the content itself is stored off-chain. The Content Watcher Service simplifies the process of monitoring these announcements by automatically watching the blockchain, processing new announcements as they appear, and delivering them to your application in a familiar format through webhooks.
The Content Watcher Service provides a webhook-based system for receiving notifications about new content.
- Parse DSNP Messages: Monitor and parse messages on Frequency
- Webhook Integration: Send content to registered webhooks
- Flexible Filtering: Simple Schema and MSA Id based filtering
- Start/Stop Control: Manage scanning operations
- Restart Capability: Reset and restart scanning processes
- Block Range Scanning: Specify custom block ranges for content retrieval
This section guides you through setting up the Content Watcher Service for both development and deployment.
Ensure you have the following installed:
-
Clone the repository and navigate to the project directory:
git clone https://github.com/ProjectLibertyLabs/gateway cd gateway
-
Install dependencies:
npm install
-
Start auxiliary services:
docker compose up -d frequency redis ipfs
-
Start the Content Watcher Service:
docker compose up -d content-watcher-service
-
Start required services:
docker compose up -d frequency redis ipfs
-
Set up environment variables:
cp env-files/content-watcher.template .env.content-watcher
Configure the environment variables according to your needs.
-
Start Content-Watcher
npm run start:content-watcher:dev
-
Set up publishing services:
docker compose up -d content-publishing-service-api content-publishing-service-worker
-
Initialize basic publisher:
npm run setup:content-publishing:chain
-
Start test webhook:
npm run setup:content-watcher:webhook
-
Generate test content:
npm run setup:content-watcher:publish
- Access Swagger UI: http://localhost:3011/api/docs/swagger
- View and manage queues: http://localhost:3011/queues
- Access Swagger UI: http://localhost:3000/api/docs/swagger
- View and manage queues: http://localhost:3000/queues
Run unit tests:
npm run test:content-watcher
Run E2E tests:
make test-content-watcher-services-start
npm run test:e2e:content-watcher
Run linter:
npm run lint
Auto-format code:
npm run format
- Server Framework: NestJS, Node.js, TypeScript
- Data Store: Redis (ioredis)
- Queue System: BullMQ
- Blockchain Integration: Polkadot API, DSNP
- Testing: Jest, Supertest
- Documentation: Swagger
- Containerization: Docker, Docker Compose
We welcome contributions! Please check our Contributing Guidelines and open issues.
Q: Can I use this service in my production social app?
Yes, Gateway Services are designed to be ready-to-use out of the box as part of your social media app using DSNP on Frequency.
Q: Does this service index content?
No. This can be used by your own indexing service to get access to the content, but the service is intentionally limited to getting the content and further customization is open to you.
Q: Does this service filter content?
No. This can be used by your own content filtering service to get new content and then have your custom service process them.
This project is licensed under the Apache 2.0 License.