This repository has been archived and its contents have been moved to a new location.
You can now find the content-publishing-service
repository within the AmplicaLabs/gateway repository at the following path:
./services/content-publishing
For any future updates or contributions, please refer to the new location. Thank you!
Link to the new repository: AmplicaLabs/gateway
- π About the Project
- π Arch Map
- π Built With
- π Live OpenAPI Docs
- π» Getting Started
- π€ Contributing
- βοΈ Show your support
- π Acknowledgements
- βFAQ
- π License
The Content Publishing Service is part of the "Social Gateway" collection of services that provides a familiar REST API to allow uploading content and publishing announcements to the Frequency chain. The service handles all of the necessary blockchain interaction and allows clients to interact using a familiar, web2-friendly interface.
The Content Publishing Service consists of two applications: an API controller, and one (or more) Worker processes. The API and Worker processes communicate via a shared BullMQ message queue. The API controller handles incoming requests and enqueues content publishing tasks for the Worker(s).
Server
Data store
Frameworks and Libraries
Polkadot and DSNP Integration
Testing
Formatting
Build and Deployment
- Upload asset files
- Create a broadcast(post)
- Create a reply
- Create a reaction
- Update existing content
- Delete existing content (tombstones)
- Update a user profile
- Get the details of a job
- Get asset
- Populate a queue with dummy announcement data
This guide is tailored for developers working in the code base for the Content Publishing Service itself. For a more tutorial tailored more for developers wanting to deploy the Content Publishing Service as part of the broader Social Gateway in order to develop their own Social Gateway app, visit Live Docs.
To prepare and run a local instance of the Content Publishing Service for local development, follow the guide below.
In order to run this project you need:
- Nodejs
- Docker or Docker-compatible container system for running Gateway Services
- (note, Docker is not strictly required; all of the services described below may be installed or built & run locally, but that is outside the scope of this guide)
Use the provided env.template file to create an initial environment for the application, and edit as desired. Additional documentation on the complete set of environment variables is provided in the ENVIRONMENT.md file.
- For running the application under Docker, copy the environment template to
.env.docker.dev
; for running bare-metal, copy to.env
.
cp env.template .env
cp env.template .env.docker.dev
- Configure the environment variable values according to your environment.
Clone this repository to your desired folder:
Example commands:
git clone [email protected]:AmplicaLabs/content-publishing-service.git
cd content-publishing-service
Install NPM Dependencies:
npm install
To run the project, execute the following command:
Frequency node, Redis, IPFS
docker compose up -d frequency redis ipfs
Each of the application services may be run either under Docker or bare-metal, depending on your preferred development workflow.
The instructions are the same for running both the API service and the worker service:
- Substitute "api" or "worker" for the "< service >" tag in the commands below.
npm run start:<service>::dev
-- or --
docker compose up [-d] content-publishing-service-<service>
Check out the Swagger UI hosted on the app instance at http://localhost:3000/docs/swagger to view the API documentation and submit requests to the service.
You may also view and manage the application's queue at http://localhost:3000/queues.
To run tests, run the following command:
npm test
npm run lint
npm run format
Contributions, issues, and feature requests are welcome!
If you would like to explore contributing bug fixes or enhancements, issues with the label good-first-issue
can be a good place to start.
Thank you to Frequency for assistance and documentation making this possible.
-
Can I use this service in my production social app?
- Yes. All the Gateway Services are intended to be ready-to-use out of the box as part of the fabric of your own social media app using DSNP on Frequency.
This project is Apache 2.0 licensed.