├── envs ├── creator-client.env ├── mongo.env ├── postgres.env ├── creator-server.env └── db-api.env ├── funding.json ├── cleanup.sh ├── setup-env.sh ├── setup.sql ├── LICENSE ├── docker-compose.yml ├── docker-compose-dev.yml ├── CONTRIBUTING.md ├── CODE_OF_CONDUCT.md └── README.md /envs/creator-client.env: -------------------------------------------------------------------------------- 1 | PORT=5173 2 | -------------------------------------------------------------------------------- /envs/mongo.env: -------------------------------------------------------------------------------- 1 | MONGO_INITDB_ROOT_USERNAME=mongo 2 | MONGO_INITDB_ROOT_PASSWORD=mongo 3 | -------------------------------------------------------------------------------- /envs/postgres.env: -------------------------------------------------------------------------------- 1 | POSTGRES_USER=postgres 2 | POSTGRES_PASSWORD=postgres 3 | POSTGRES_DB=dapp_analytics 4 | -------------------------------------------------------------------------------- /funding.json: -------------------------------------------------------------------------------- 1 | { 2 | "opRetro": { 3 | "projectId": "0x46aff4985914b8e56b8fd62a9b8c3a03e2320315a9dfd6126e5ae272173cda87" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /cleanup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker-compose down -v 3 | rm -rf dashboard-creator-client 4 | rm -rf dashboard-creator-server 5 | rm -rf db-api 6 | 7 | -------------------------------------------------------------------------------- /envs/creator-server.env: -------------------------------------------------------------------------------- 1 | NODE_ENV=development 2 | PORT=8081 3 | API_KEY_TOKEN=token 4 | MONGODB_URL=mongodb://mongo:mongo@mongodb:27017 5 | MONGODB_DB_NAME=dc-db 6 | CLIENT_URL=http://localhost:5173 7 | API_BASE_URL=http://db-api:8082 8 | -------------------------------------------------------------------------------- /setup-env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | git clone https://github.com/tokenguardio/dashboard-creator-client.git 3 | cd dashboard-creator-client 4 | git checkout dapp-analytics-dev 5 | cd .. 6 | git clone https://github.com/tokenguardio/dashboard-creator-server.git 7 | cd dashboard-creator-server 8 | git checkout dapp-analytics-dev 9 | cd .. 10 | git clone https://github.com/tokenguardio/db-api.git 11 | cd db-api 12 | git checkout dev 13 | 14 | -------------------------------------------------------------------------------- /setup.sql: -------------------------------------------------------------------------------- 1 | CREATE USER squid WITH PASSWORD 'postgres'; 2 | CREATE SCHEMA IF NOT EXISTS dapp_analytics AUTHORIZATION squid; 3 | ALTER USER squid 4 | SET 5 | search_path TO dapp_analytics; 6 | 7 | GRANT CONNECT, CREATE ON DATABASE dapp_analytics TO squid; 8 | GRANT ALL PRIVILEGES ON SCHEMA dapp_analytics TO squid; 9 | GRANT ALL PRIVileges ON ALL TABLES IN SCHEMA dapp_analytics TO squid; 10 | ALTER DEFAULT PRIVILEGES IN SCHEMA dapp_analytics GRANT ALL ON TABLES TO squid; 11 | -------------------------------------------------------------------------------- /envs/db-api.env: -------------------------------------------------------------------------------- 1 | QUERIES_DB_HOST=postgres 2 | QUERIES_DB_USER=postgres 3 | QUERIES_DB_PASSWORD=postgres 4 | QUERIES_DB_NAME=dapp_analytics 5 | QUERIES_DB_PORT=5432 6 | DATA_DB_HOST=postgres 7 | DATA_DB_USER=postgres 8 | DATA_DB_PASSWORD=postgres 9 | DATA_DB_NAMES=dapp_analytics 10 | DATA_DB_PORT=5432 11 | DAPP_ANALYTICS_DB_HOST=postgres 12 | DAPP_ANALYTICS_DB_USER=squid 13 | DAPP_ANALYTICS_DB_PASSWORD=postgres 14 | DAPP_ANALYTICS_DB_NAME=dapp_analytics 15 | DAPP_ANALYTICS_DB_PORT=5432 16 | PORT=8082 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Tokenguard 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.9" 2 | 3 | services: 4 | mongodb: 5 | image: mongo:latest 6 | ports: 7 | - 27017:27017 8 | volumes: 9 | - mongodata:/data/db 10 | env_file: 11 | - ./envs/mongo.env 12 | postgres: 13 | image: postgres:latest 14 | ports: 15 | - "5432:5432" 16 | volumes: 17 | - postgresdata:/var/lib/postgresql/data 18 | - ./setup.sql:/docker-entrypoint-initdb.d/setup.sql 19 | env_file: 20 | - ./envs/postgres.env 21 | wasabi-image: 22 | image: patternsjrojek/subsquid-squids:wasabi-substrate-latest 23 | command: 24 | [ 25 | "echo", 26 | "Processor image wasabi-substrate-latest pulled successfully. No service started.", 27 | ] 28 | 29 | creator-client: 30 | image: patternsjrojek/dashboard-creator:client-v3.0.1 31 | ports: 32 | - "5173:5173" 33 | volumes: 34 | - /app/node_modules 35 | env_file: 36 | - ./envs/creator-client.env 37 | depends_on: 38 | - creator-server 39 | creator-server: 40 | user: root 41 | image: patternsjrojek/dashboard-creator:server-v3.0.1 42 | restart: always 43 | command: ["npm", "run", "start:dev"] 44 | ports: 45 | - 8081:8081 46 | env_file: 47 | - ./envs/creator-server.env 48 | volumes: 49 | - "/var/run/docker.sock:/var/run/docker.sock" 50 | depends_on: 51 | - mongodb 52 | - db-api 53 | db-api: 54 | image: patternsjrojek/db-api:v1.4.1 55 | ports: 56 | - "8082:8082" 57 | env_file: 58 | - ./envs/db-api.env 59 | depends_on: 60 | - postgres 61 | volumes: 62 | mongodata: 63 | postgresdata: 64 | -------------------------------------------------------------------------------- /docker-compose-dev.yml: -------------------------------------------------------------------------------- 1 | version: "3.9" 2 | 3 | services: 4 | mongodb: 5 | image: mongo:latest 6 | ports: 7 | - 27017:27017 8 | volumes: 9 | - mongodata:/data/db 10 | env_file: 11 | - ./envs/mongo.env 12 | postgres: 13 | image: postgres:latest 14 | ports: 15 | - "5432:5432" 16 | volumes: 17 | - postgresdata:/var/lib/postgresql/data 18 | - ./setup.sql:/docker-entrypoint-initdb.d/setup.sql 19 | env_file: 20 | - ./envs/postgres.env 21 | wasabi-image: 22 | image: patternsjrojek/subsquid-squids:wasabi-substrate-latest 23 | command: 24 | [ 25 | "echo", 26 | "Processor image wasabi-substrate-latest pulled successfully. No service started.", 27 | ] 28 | 29 | creator-client: 30 | build: 31 | context: ./dashboard-creator-client 32 | dockerfile: localhost.Dockerfile 33 | command: "npm run dev" 34 | ports: 35 | - "5173:5173" 36 | volumes: 37 | - ./dashboard-creator-client:/app/ 38 | - /app/node_modules 39 | env_file: 40 | - ./envs/creator-client.env 41 | depends_on: 42 | - creator-server 43 | creator-server: 44 | user: root 45 | build: 46 | context: ./dashboard-creator-server 47 | dockerfile: Dockerfile 48 | restart: always 49 | command: ["npm", "run", "start:dev"] 50 | ports: 51 | - 8081:8081 52 | env_file: 53 | - ./envs/creator-server.env 54 | volumes: 55 | - "./dashboard-creator-server/src:/app/src" 56 | - "./dashboard-creator-server/scripts/db:/app/scripts/db" 57 | - "/var/run/docker.sock:/var/run/docker.sock" 58 | depends_on: 59 | - mongodb 60 | - db-api 61 | db-api: 62 | build: 63 | context: ./db-api 64 | dockerfile: Dockerfile 65 | ports: 66 | - "8082:8082" 67 | command: ["npm", "run", "start:dev"] 68 | volumes: 69 | - ./db-api:/app 70 | env_file: 71 | - ./envs/db-api.env 72 | depends_on: 73 | - postgres 74 | volumes: 75 | mongodata: 76 | postgresdata: 77 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Tokenguard dApp Marvels 2 | 3 | Thank you for considering contributing to the Tokenguard dApp Marvels! Your help is essential for improving the project and making it even better. 4 | 5 | ## Code of Conduct 6 | 7 | Please note that this project adheres to the [Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project, you agree to abide by its terms. 8 | 9 | ## How Can I Contribute? 10 | 11 | ### Reporting Bugs 12 | 13 | If you come across a bug while using the Tokenguard dApp Marvels, we appreciate it if you could [open an issue](https://github.com/tokenguardio/dapp-marvels/issues) on our GitHub repository. When reporting a bug, please include the following details: 14 | 15 | - A clear and descriptive title 16 | - Steps to reproduce the bug 17 | - Expected behavior 18 | - Actual behavior 19 | - Any error messages or screenshots if applicable 20 | 21 | ### Suggesting Enhancements 22 | 23 | Have an idea for an enhancement or a new feature for the Tokenguard dApp Marvels? Feel free to share it by [opening an issue](https://github.com/tokenguardio/dapp-marvels/issues) on our GitHub repository. When suggesting enhancements, please provide: 24 | 25 | - A clear and descriptive title 26 | - Detailed description of the enhancement or feature request 27 | - Any relevant context or examples 28 | 29 | ### Pull Requests 30 | 31 | We welcome pull requests from the community! If you'd like to contribute code to the Tokenguard dApp Marvels, please follow these steps: 32 | 33 | 1. Fork the repository and create your branch from `main`. 34 | 2. Ensure that your code follows the project's coding style and conventions. 35 | 3. Write tests for any new functionality and ensure existing tests pass. 36 | 4. Make sure your commits are descriptive and follow best practices. 37 | 5. Once you've finished your changes, submit a pull request to the `main` branch of the original repository. 38 | 39 | ## License 40 | 41 | By contributing to the Tokenguard dApp Marvels, you agree that your contributions will be licensed under the [MIT License](LICENSE) found in the root directory of this repository. 42 | 43 | Thank you for your contributions! 44 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | - Using welcoming and inclusive language 12 | - Being respectful of differing viewpoints and experiences 13 | - Gracefully accepting constructive criticism 14 | - Focusing on what is best for the community 15 | - Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | - The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | - Trolling, insulting/derogatory comments, and personal or political attacks 21 | - Public or private harassment 22 | - Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | - Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [dev@tokenguard.io](mailto:dev@tokenguard.io). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html), version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 44 | 45 | For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | patterns 3 |
4 | 5 | ## Analyze wallet behaviour and preview CRM of your Solidity & Ink! based dApp 6 | 7 | Patterns was founded to help web3 projects grow and build utility around their products. We know how to build successful dApps & ecosystems solving real problems with blockchain technology and we want to allow the whole industry to follow this path. 8 | 9 | [Patterns app is available for free here >>](https://patterns.build/web3-crm) 10 | 11 | [Learn more about Patterns](https://patterns.build/about-us) 12 | 13 | ### Social channels: 14 |
15 | 16 | 17 | 18 |
19 | 20 | ### Supported blockchains: 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | ## dApp Marvels 💎 32 | 33 | Welcome to the dApp Marvels repository! This repository consists of handy setup scripts to help you get started with dApp Marvels - an on-chain analytics tool designed for Ink! dApps builders to support their growth and operations through in-depth metrics and analytics of on-chain user behavior. 34 | 35 | dApp Marvels will help to Polkadot builders create their dApps & protocols faster and easily analyze data coming from their smart contracts without additional hassle. 36 | 37 | This guide covers how to set up and run the project for Substrate-bases chains. This respository is umbrella part of a bigger system consisting of 3 components + corresponding databases. 38 | 39 | 1. [dashboard-creator-server](https://github.com/tokenguardio/dashboard-creator-server/) - the backend service storing information about built dashboards and queries 40 | 2. [dashboard-creator-client](https://github.com/tokenguardio/dashboard-creator-client/) - frontend app 41 | 3. [db-api](https://github.com/tokenguardio/db-api) - REST interface between PostgreSQL database and backend service. 42 | 4. [subsquid-indexer](https://github.com/tokenguardio/substrate-squids/blob/wasabi/) - custom squid indexer suited for decoded ABIs for dApps 43 | 44 | To fully function backend service needs mongodb to store dashboard configuration, layout and displayed dashboard elements and PostgreSQL database to store indexing data pulled by subsquid indexer. 45 | 46 | ## Prerequisites 47 | 48 | Before you begin, make sure you have the following installed on your system: 49 | 50 | - [Docker](https://www.docker.com/get-started) 51 | - [Docker Compose](https://docs.docker.com/compose/install/) 52 | 53 | ### Features 54 | - **dApp decoding**: with user-provided contract ABIs this app is able to index decoded interactions with the dApp 55 | - **dApp indexing**: automated deployments of subsquid indexers 56 | - **API Reading Mechanism**: Connect frontend visualizations with underlying data through a RESTful API built with NodeJS and Express. 57 | - **Data Storage**: Store visualization and dashboard-related data in MongoDB for efficient retrieval and management. 58 | - **Scalability**: Built with scalability in mind to handle large datasets and user traffic effectively. 59 | - **Metrics Visualisation**: Visualize data from raw sources using customizable visualizations such as line charts, bar charts, pie charts, and more. 60 | - **Dashboard Layout**: Create, save, modify, and delete dashboards with drag-and-drop functionality. Customize dashboard layouts with captions, titles, and links. 61 | - **User-Friendly Interface**: Intuitive user interface for seamless dashboard creation and customization. 62 | 63 | ### Use examples 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | ### Getting started 72 | 73 | #### Fastest 74 | If you just want to start the project to see how it works, just run `docker-compose up` and it will pull recent images of services and run the app. 75 | 76 | #### For devs 77 | For simple and smooth application rollout for further customization and development purposes you can pull all required repositories into fresh directory using a script provided in this repository: 78 | ``` 79 | ./setup-env.sh 80 | ``` 81 | 82 | The script pulls repositories in locations expected by `docker-compose-dev.yml` file enclosed in this repository. 83 | ``` 84 | git clone https://github.com/tokenguardio/dashboard-creator-client.git 85 | cd dashboard-creator-client 86 | git checkout dapp-analytics-dev 87 | cd .. 88 | git clone https://github.com/tokenguardio/dashboard-creator-server.git 89 | cd dashboard-creator-server 90 | git checkout dapp-analytics-dev 91 | cd .. 92 | git clone https://github.com/tokenguardio/db-api.git 93 | cd db-api 94 | git checkout dev 95 | cd .. 96 | ``` 97 | After the script is done, all you have to do is to let docker-compose run and build/pull all required images. 98 | ``` 99 | docker-compose -f docker-compose-dev.yml up 100 | ``` 101 | After the environment starts, you should be able to see the frontend app of dApp Marvels at [localhost:5173](http://localhost:5173) 102 | 103 | ### Cleanup 104 | To clean up environment, simply run 105 | ``` 106 | ./cleanup.sh 107 | ``` 108 | 109 | ### Tech Stack 110 | 111 | - **Backend Framework**: NodeJS with Express 112 | - **Database**: MongoDB, PostgreSQL 113 | - **API Documentation**: OpenAPI 114 | - **Development Tool**: Docker 115 | - **Frontend Framework**: ReactJS, TypeScript, ViteJS 116 | - **Data Storage**: MongoDB 117 | - **Visualization Library**: Apache ECharts 118 | 119 | ### Contributing 120 | 121 | We encourage contributions from the community! If you'd like to contribute to the Patterns Dashboard Builder Server, please refer to our [contribution guidelines](CONTRIBUTING.md) for more information. 122 | 123 | ### License 124 | 125 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. 126 | --------------------------------------------------------------------------------