The Content Publisher Service is a crucial component of the Gateway suite, providing a familiar REST API for uploading content and publishing announcements to 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 Publisher Service is part of the Gateway suite that provides a Web2-friendly interface for blockchain content operations. It handles all necessary blockchain interactions, allowing clients to use familiar REST API patterns for publishing and managing content on the Frequency chain.
The Content Publisher Service consists of two main components:
- API Controller: Handles incoming HTTP requests and enqueues content publishing tasks
- Worker Process: Processes queued tasks and interacts with the blockchain
The API and Worker processes communicate via a shared BullMQ message queue.
- Upload asset files: Handle file uploads to the system
- Create broadcasts: Publish new posts to the network
- Create replies: Respond to existing content
- Create reactions: Add reactions to content
- Update content: Modify existing content
- Delete content: Remove content (via tombstones)
- Update profiles: Manage user profile information
- Job management: Monitor and manage publishing jobs
- Asset retrieval: Access stored assets
- Test data: Generate sample announcement data
This section guides you through setting up the Content Publisher 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.git cd gateway
-
Install dependencies:
npm install
-
Set up environment variables:
cp env-files/content-publishing.template.env .env.content-publishing
Configure the environment variables according to your needs.
-
Start auxiliary services:
docker compose up -d frequency redis ipfs
-
Start the application services:
API Service:
npm run start:content-publishing-api:dev
Worker Service:
npm run start:content-publishing-worker:dev
-
Set up with account data:
make setup-account
-
Run services using Docker:
docker compose up -d frequency content-publishing-service-api content-publishing-service-worker
-
Set up with account data:
make setup-account
- Access Swagger UI: http://localhost:3012/docs/swagger
- View and manage queues: http://localhost:3012/queues
- Access Swagger UI: http://localhost:3000/docs/swagger
- View and manage queues: http://localhost:3000/queues
Run the test:
npm test:content-publishing
Run E2E tests:
npm run test:e2e:content-publishing
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 own social media app using DSNP on Frequency.
This project is licensed under the Apache 2.0 License.