This is a prototype for a DSNP Gateway to allow for simple provider setup.
- 📖 About the Project
- 🔍 Arch Map
- 🛠 Built With
- 🚀 Live OpenAPI Docs
- 💻 Getting Started
- 📋 Testing & Development
- 📚 References
- 🤝 Contributing
- ❓FAQ
- 📝 License
The Gateway Services are a suite of services designed to make interacting with Frequency easy for applications integrating with DSNP. The SAT is an example client that shows you how to use Gateway.
Gateway enables web2 companies to use a simple gateway into web3 using tooling they are accustomed to. It aims to let service providers self-serve with minimal help outside of docs and tools, rather than interacting with Frequency directly. Providers no longer need to fully understand blockchain tooling to build on DSNP over Frequency.
Key: * = coming soon
- Framework: Node.js with Express
- Language: Typescript
- Testing Library:Vitest
- API Documentation:
- Sign in with Frequency
- Create a post
- Create a comment on a post
- Get feed data
- Get users' profile data
- Post graph data (i.e. follow/unfollow)
- Get graph data (i.e.follow list)
- Gateway Live Docs
- Open Api docs coming soon...
In order to run this project you need to:
- Become a provider. To do so, visit the Provider Dashboard!
- Get Docker
Clone this repository to your desired folder:
Example commands:
git clone [email protected]:ProjectLibertyLabs/social-app-template.git
cd social-app-template
Install NPM Dependencies:
npm install
The application is configured by way of environment variables. A complete list of available environment variables is here. Environment variables are supplied to the application through environment files.
More Details
The default scripts and images for this app are configured in a slightly different way from the usual method. Because this Gateway app is a template meant to be used with other services and built upon, the supplied scripts enable launching a full environment of all Frequency Gateway services needed by this Gateway application. To that end, each service has its own environment, which are specified in the `docker-compose-bare-metal.yaml` and `docker-compose.yaml` files. Additionally, when running in bare-metal mode, `npm run env:init` will create the necessary `.env.social-app-backend` file from the `env.social-app-backend.template` file.Sample configuration files can be found here.
Initialize the env files using the templates:
npm run env:init
This environment is the best for supporting frontend development.
To quickly start up a set of preconfigured services, including this sample backend Gateway, run:
./scripts/restart-chain-docker.sh
For more details on configuring and running the individual services, see Usage.
This environment is the best for supporting local backend development.
./scripts/restart-chain-bare-metal.sh
npm run start:dev
Note: There are other options, but these are simplest to get started with.
This is best for Testnet interactions.
Setup the Environment Variables:
FREQUENCY_API_WS_URL="wss://rpc.paseo.frequency.xyz"
SIWF_NODE_RPC_URL="https://rpc.paseo.frequency.xyz"
This is for simple local development work.
Run the provided Docker Compose script to launch a local Frequency node:
docker compose up -d frequency
Create Provider for //Alice
on localhost Frequency node.
Note: There are other options, but these are simplest to get started with.
-
Follow the instructions on the Frequency Provider Dashboard (coming soon).
-
npm run local:init
Run the following command to start all Gateway Services and dependencies. For more info on what's included or if you want to run each service individually, check out the docker compose file.
docker compose --profile full up -d
Option 1: Build a Docker image from the Dockerfile:
npm docker-build
--or--
Option 2: Build Docker images from the docker-compose.yml file for dev:
npm docker-build:dev
Run the test script, which uses Vitest:
npm test
npm run lint
npm run format
Generate types from openapi.json
npm run gen:types
Check out the Swagger UI hosted on the app instance at <base url>/api/docs/swagger to view the API documentation and submit requests to the service.
- Stop all docker containers.
docker compose down
- Go to Docker and delete all Volumes.
- Rerun quickstart or usage commands.
- If that doesn't work, repeat step 1 and 2, delete the relative Containers and Images, then repeat step 3.
You can deploy using containers. Check the docker-compose.yaml file for more details.
Contributions, issues, and feature requests are welcome!
This project is Apache 2.0 licensed.