Skip to content

goodylili/YapCoder

Repository files navigation

Yapcoder

Backend for developer reputation and campaign tooling in the Sui ecosystem.

This repository contains the Yapcoder API service and Sui Move contracts that score open‑source developers, track Sui projects, and power campaign flows like hackathons, POAP drops, and on‑chain developer identities. It exposes a JSON REST API that a separate frontend uses to build dashboards, leaderboards, and programmatic reward flows.

How it works

  • Developer onboarding
    Create a developer by GitHub username. The backend validates the user against the GitHub API and stores a canonical record with GitHub user ID and onboarding timestamp.

  • Reputation scoring
    Background jobs compute a reputation score per developer using GitHub data: stars, commits, Sui repo count, language diversity, repository size, and activity recency. Scores are stored in a leaderboard table and exposed over HTTP.

  • Project and campaign management
    Organizers can register projects, attach GitHub repositories and contributor usernames, and fetch analytics for those repositories. Sui Move contracts model campaigns, participants, and outcomes on‑chain.

  • On‑chain developer identity
    The yapcoder Move module creates a YapCoder object per developer that links their GitHub user ID, Sui address, and associated repositories. Additional links can be attached while emitting on‑chain events.

  • POAP‑style rewards
    The poap Move module mints proof‑of‑attendance tokens to participants or batches of addresses, enabling reward distribution tied to campaigns and events.

  • Ecosystem news
    A small AI service scrapes the Sui developer newsletter RSS feed and generates TechCrunch‑style headlines and briefs using the OpenAI API, served via a JSON endpoint for frontends.

Project structure

Top‑level layout:

yapcoder/
├── cmd/                # Go entrypoint (HTTP server bootstrap)
├── internal/
│   ├── ai/             # OpenAI client and headline generation
│   ├── auth/           # API key issuance and validation
│   ├── db/             # GORM models and persistence layer
│   ├── github/         # GitHub API clients, analytics, reputation scoring
│   ├── http/           # REST handlers, middleware, routing
│   ├── luma/           # Luma integration (events, if used)
│   └── sui/
│       ├── yapcoder/   # Sui Move contracts (campaign, POAP, yapcoder identity)
│       └── blockberry.go  # Sui on‑chain data via Blockberry API
├── latest.json         # Cached latest Sui newsletter headlines (generated at runtime)
├── Makefile            # Developer tasks (build, test, lint, Sui, Docker)
├── Dockerfile          # Container image for the HTTP API
├── go.mod / go.sum     # Go module definition and dependencies
└── openapi.yaml        # HTTP API surface (machine‑readable spec)

Backend (Go)

The Go server exposes a JSON REST API under /api/v1/** and handles:

  • Developer lifecycle: create developers, read details, list all developers
  • Reputation and leaderboard: compute and serve normalized scores
  • Project analytics: fetch GitHub repository metadata and derived metrics
  • Developer locations: resolve GitHub users to locations in bulk
  • Sui package analytics: query Sui package stats using Blockberry
  • News: serve latest Sui ecosystem headlines generated by the AI service

Sui contracts (Move)

The Move package in internal/sui/yapcoder contains modules that run on Sui:

  • yapcoder
    On‑chain YapCoder identity object with GitHub user ID, Sui address, username, and repository links, plus events emitted on creation and when new links are added.

  • campaign
    Campaign object for hackathons or programs, with projects, participants, outcomes, and organizer capabilities.

  • poap
    Simple POAP‑style NFT minting to single addresses or batches, typically tied to campaign participation.

Contract sources and an execution log are in internal/sui/yapcoder.

AI and news

The AI component:

  • Scrapes the Sui Dev Newsletter RSS feed.
  • Extracts the latest issue content.
  • Calls OpenAI with a custom prompt to generate:
    • A set of TechCrunch‑style headlines.
    • One‑sentence briefs and links (when present).
  • Caches the result in latest.json keyed by newsletter publish date.

The HTTP layer exposes this data via /api/v1/sui/news.

Frontend

This repository is backend‑only.

The production frontend is live at https://yapcoder.com and consumes the APIs described here. Any web or mobile client can integrate with Yapcoder by calling the documented HTTP endpoints and, where needed, reading on‑chain state from the Sui contracts in internal/sui/yapcoder.

Development

This project uses make for most development tasks.

Prerequisites

  • Go 1.25+
  • PostgreSQL
  • Docker and Docker Compose (optional, for local infra)
  • Make
  • Sui CLI (for Move contracts)

Environment

Configuration is provided via environment variables. See .env.example for the full list:

  • DATABASE_URL – PostgreSQL connection string.
  • GITHUB_TOKEN, GITHUB_TOKEN0GITHUB_TOKEN7 – GitHub API tokens used for analytics and reputation.
  • BLOCKBERRY_API – Blockberry API key for Sui package analytics.
  • API_KEY_SECRET – secret for issuing and validating API keys.
  • ADMIN_API_TOKEN – admin token for privileged operations.

For Docker development, create a .env file based on .env.example and keep all secrets out of version control.

Building

Backend:

make deps   # Download Go dependencies
make build  # Build ./bin/yapcoder

Run the server locally:

make run

Docker image:

make docker-build
make docker-run   # exposes port 8080 by default

Move contracts

Build and test the Sui Move package:

make sui-build   # cd internal/sui/yapcoder && sui move build
make sui-test    # cd internal/sui/yapcoder && sui move test

Testing and linting

Run Go tests and basic vetting:

make test   # go test ./...
make lint   # go vet ./...

Format Go code:

make fmt

Deployed contracts (Testnet)

An example Sui deployment used in the included execution summary:

  • Network: testnet
  • Package: 0xe9d87283c95f2c11e7b38dff9ea6baddac40443080a10bc68c44cbbd4d49497e

See internal/sui/yapcoder/README.md for concrete CLI calls and transaction digests.

Security

  • Treat all API keys, database URLs, and GitHub tokens as secrets.
  • Do not commit .env files or real credentials to version control.
  • Reputation scores are computed from public GitHub data and are best‑effort signals, not guarantees.
  • Move contracts are experimental; review and audit them before using in production campaigns or with significant value.

License

This codebase is released under the GNU Affero General Public License v3.0 (AGPL‑3.0). See LICENSE for the full text.

  • You may use, modify, and redistribute the code, including for commercial purposes.
  • If you distribute a modified version or offer it as a network service, you must:
    • Provide the complete corresponding source code to users, and
    • Keep it under the same AGPL‑3.0 license.

About

YapCoder is the first Developer Relations (DevRel) Provenance Platform, purpose-built to quantify developer activity, reputation, and ecosystem health in real time.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages