Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

ProjectLibertyLabs/content-publishing-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

59 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Repository Archived and Moved

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

Content Publisher

πŸ“— Table of Contents

πŸ“– Content Publishing Service

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.

πŸ”­ Arch Maps

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).

Content Publishing Service Arch

(back to top)

πŸ›  Built With

Tech Stack

Server
Data store
Frameworks and Libraries
Polkadot and DSNP Integration
Testing
Formatting
Build and Deployment

Key Features

API

  • Upload asset files
  • Create a broadcast(post)
  • Create a reply
  • Create a reaction
  • Update existing content
  • Delete existing content (tombstones)
  • Update a user profile

Development API

  • Get the details of a job
  • Get asset
  • Populate a queue with dummy announcement data

(back to top)

πŸš€ Live Docs

(back to top)

πŸ’» Getting Started

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.

Prerequisites

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)

Environment Variables

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.

  1. 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
  1. Configure the environment variable values according to your environment.

Setup

Clone this repository to your desired folder:

Example commands:

  git clone [email protected]:AmplicaLabs/content-publishing-service.git
  cd content-publishing-service

Install

Install NPM Dependencies:

  npm install

Usage

To run the project, execute the following command:

1. Start the required auxiliary services

Frequency node, Redis, IPFS

docker compose up -d frequency redis ipfs

2. Start the application services

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.

Running bare metal

npm run start:<service>::dev

-- or --

Running under Docker

docker compose up [-d] content-publishing-service-<service>

3. Check the job in BullUI, to monitor job progress based on defined tests.

Swagger UI

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.

Queue Management

You may also view and manage the application's queue at http://localhost:3000/queues.

Run tests

To run tests, run the following command:

  npm test

Linting:

  npm run lint

Auto-format:

  npm run format

(back to top)

🀝 Contributing

Contributions, issues, and feature requests are welcome!

(back to top)

⭐️ Show your support

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.

(back to top)

πŸ™ Acknowledgements

Thank you to Frequency for assistance and documentation making this possible.

❓FAQ

  • 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.

(back to top)

πŸ“ License

This project is Apache 2.0 licensed.

(back to top)