SkillAgentSearch skills...

Gem

🎲 Rust high performance, fault tolerance, low latency, both monolithic and miscroservices stateful backend APIs including actor based HTTP+WebSocket and gRPC servers, API components and realtime pubsub push notification engines with Tokio, Actix, Tonic and Redis

Install / Use

/learn @wildonion/Gem

README

<img src="https://github.com/wildonion/gem/blob/master/assets/conse.png" width="150"/>

is a crypto based social network platform leveraging the Polygon blockchain empowering lovers to build and take participate in social events (see hoopoe) with their NFT artworks

πŸ” Features

Note that the idea behind the chatroom launchpad has been moved to the hoopoe platform with different implementations.

  • actor based component APIs, a reliable design pattern facilitating the communication between each API endpoint without sending HTTP requests, only by utilising actor message sending pattern supports only local communicating process.

  • actor based pubsub push notification strategies to notify different parts of the app clearly the user, on every db updates using redis pubsub pattern (more).

  • SSE technology to inform clients by receiving automatic updates from the server via an HTTP connection.

  • hoopoe a platform for social events

  • an event managing and reservation system with reveal-participant-role functionality

  • X (twitter) task verification system based on pre-defined tasks by admins.

  • broadcasting X tasks registered by admins into discord channel.

  • crypto id, an EVM based wallet with secp256k1 algorithm to store users' onchain digital assets and sign in-app API calls.

  • the most secure logic for authentication process with JWT per device and secp256k1 per each user for API signing.

  • buying, receiving and selling in-app $TOKEN using Stripe payment gateway and minting NFT gift cards with an smart treasury tracking service.

  • creating multiple private galleries to create, mint and transfer NFTs in various art work collections by inviting friends.

  • participating in chatroom launchpad events (%60 COMPLETED - See WIPs) to mint AI generated NFTs, based on summarization of participants' chats in each event.

πŸ₯ͺ Panel Architecture

<p align="center"> <img src="https://github.com/wildonion/gem/blob/master/infra/arch.jpg"> </p>

🚟 Infra Route and API Endpoints

# ---------------------------------------------------------------------------------------------------
# conse panel dev username/password              : devdevy/d3v@%$^$3hjsD
# conse panel admin username/password            : adminy/4dmin@%$^$3hjsD
# postgres adminer username/password/server      : postgres/geDteDd0Ltg2135FJYQ6rjNYHYkGQa70/postgres
# ---------------------------------------------------------------------------------------------------
πŸŽ™οΈ HOSTED ON                                    ==> Digitalocean
πŸ₯› WEBSOCKET PUSH NOTIFICATION ROUTE            ==> wss://event.panel.conse.app/subscribe/
πŸ₯› WEBSOCKET HHTP PUSH NOTIFICATION ROUTE       ==> https://event.panel.conse.app/subscribe/
🌍 MAIN SITE                                    ==> https://conse.app/
πŸ‘¨πŸ»β€βš–οΈ ADMIN PANEL                                  ==> https://panel.conse.app/
πŸ›€οΈ ADMIN/DEV API ROUTE WITH POSTGRES DB STORAGE ==> https://api.panel.conse.app/
πŸ›£ ADMIN/DEV API ROUTE WITH MONGO DB STORAGE    ==> https://api.panel.conse.app/mongo
πŸ—ΊοΈ RENDEZVOUS API ROUTE                         ==> https://api.rendezvous.conse.app/
πŸ›’οΈ ADMINER PANEL                                ==> https://adminer.conse.app
πŸ›ŽοΈ JENKINS PANEL                                ==> https://jenkins.conse.app
β›΅ PORTAINER PANEL                              ==> https://portainer.conse.app
πŸ“Š GRAFANA PANEL                                ==> https://grafana.conse.app
🏦 STRIPE WEBHOOK ENDPOINT                      ==> https://api.panel.stripewh.conse.app
πŸ€– X BOT                                        ==> https://api.xbot.conse.app
πŸ—žοΈ PANEL AND XCORD ERROR LOGS                   ==> https://api.panel.conse.app/logs
πŸ—‚οΈ PANEL ASSETS FOLDER                          ==> https://api.panel.conse.app/assets
πŸ§™β€β™‚οΈ KYC gRPC SERVER                              ==> grpcs://rpc.conse.app/kyc.KycService/Verify

# Push Notification WS Routes
wss://event.panel.conse.app/subscribe/64b827fad916781c6d68948a/reveal-role-64b82757d916781c6d689488
wss://event.panel.conse.app/subscribe/64b827fad916781c6d68948a/mmr-64b82757d916781c6d689488

# Chatroom Launchpad WS Route
wss://event.panel.conse.app/subscribe/chatroomlp/1/03fe4d2c2eb9ab44971e01d9cd928b4707a9d014381d75ec19f946b78a28164cc6/8ef4637573c6ef6170c817ad22fc4e45de4eae1b86fbe26f19986d49e9c4e24a3fe7d5f6fef58b2ae6a160ca058c41c401401ecc509f8afffe30035e0ad7451f1c/b051b639719983d5062cb8bdb5f57afffb4a634c8c8a6b9e957f583ee1087ea1/?r1pubkey=0x554543320000002d6682f8f7030f89be91e75b5604e14c026d7ec893c4be6de1d221a9e329a59b8dee2fad3b16&r1signature=0x20260426e5000000470000007b22726563697069656e745f636964223a223078353534353433333230303030303032643636383266386637303330663839626539316537356235363034653134633032366437656338393363346265366465316432323161396533323961353962386465653266616433623136222c2266726f6d5f636964223a223078353534353433333230303030303032643636383266386637303330663839626539316537356235363034653134633032366437656338393363346265366465316432323161396533323961353962386465653266616433623136222c22616d6f756e74223a357d3045022100d49e8716ef150129b612c65ef8e798e8fac73577fc8df1d4664674488b89f86d02203f62c3c5776ed393a4d0a761714d9f1e52185c5b24c4a3afe03b7903aa5186af

πŸ—ƒοΈ Directory and Structure Explained

  • core: hyper, tonic gRPC, actix web HTTP and actix WS servers.
    • chatdb: spacetimedb wasm methods used in chatroom launchpad section in conse panel.
    • stripewh: stripe webhook listener for checkout events.
    • xbot: X bot for twitter tasks verification.
    • xcord: discord bot to broadcast new twitter task defined by admin into a discord channel.
    • mailreq: mail sender crate.
    • multipartreq: multipart extractor crate.
    • phonereq: OTP code sender crate.
    • s3req: shared state storage crate.
    • walletreq: wallexerr crate.
    • gastracker: gastracker crate.
    • grpc: KYC grpc server.
    • panel: user, dev and admin dashboard panel health, public and secured APIs with actix web and actix WS server.
    • rendezvous: rendezvous service upsert event and deck, reserve event, reveal role and other in-game APIs.
      • controllers: in-game async controllers related to hyper server.
      • routers: in-game API routers related to hyper server.
      • schemas: in-game mongodb schemas related to hyper server.
  • infra: all infrastructure and devops configs.
  • jobs: gem crontab jobs
  • logs: gem log files generated by conse panel and other parts of the app.
  • migrations: diesel postgres sql files
  • scripts: deployment scripts
  • test: gem test codes like admin and dev password generator script

πŸ“˜ Docs, ERDs, Schemas and Collections

πŸ› οΈ Development Setup

you can download runtime crashing error logs throught the address https://api.panel.conse.app/logs also after setting up the portainer, each container logs can be downloaded inside the panel, also makre sure that you've installed the following packages on MacOS M1:

brew tap cossacklabs/tap
brew install openjdk
brew install pkg-config
brew install openssl
brew install diesel
brew link --force openssl
brew install libpq && brew link --force libpq
brew install protobuf
brew install graphviz
brew tap cossacklabs/tap && brew install libthemis
cargo install spacetimedb-cli
sudo npm i wasm-opt -g
cargo clean

then run:

# πŸ₯’ build proto files
cargo build
# πŸƒ Run Conse Hyper Server
cargo run --bin rendezvous #---> cargo build --bin rendezvous --release
# πŸƒπŸ½β€β™€οΈ Run Conse Actix Panel Server
cargo run --bin panel #---> cargo build --bin panel --release
# πŸƒπŸ½β€β™€οΈ Run Conse KYC gRPC Server
cargo run --bin grpc #---> cargo build --bin grpc --release
# πŸƒπŸΏ Run Conse Test Codes
cargo run --bin contest

πŸš€ Production Setup

Ensure that:

  • all the vars inside .env.prod are filled with their appropriate values.

  • any self-signed SSL certificates used by gRPC server are valid and issued by a recognized certificate authority, if you are using a self-signed certificate, it may not be trusted by default by clients.

  • you've created an NFT product contract for NFT gift card section, later you have to update the up.sql file inside users_collections migration folder with appropriate contract info (address, tx hash and ...), use the following curl to build a new product contract:

        curl --request POST \
        --url https://api.nftport.xyz/v0/contracts \
        --header 'Authorization: <API_KEY>' \
        --header 'accept: application/json' \
        --header 'content-type: application/json' \
    

Related Skills

View on GitHub
GitHub Stars8
CategoryData
Updated1y ago
Forks2

Languages

Rust

Security Score

60/100

Audited on Jul 6, 2024

No findings