{"id":25821161,"url":"https://github.com/consolelabs/mochi-api","last_synced_at":"2025-07-26T06:07:30.319Z","repository":{"id":36950472,"uuid":"482766534","full_name":"consolelabs/mochi-api","owner":"consolelabs","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-23T11:06:47.000Z","size":7333,"stargazers_count":11,"open_issues_count":3,"forks_count":10,"subscribers_count":6,"default_branch":"develop","last_synced_at":"2025-04-03T00:04:19.515Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/consolelabs.png","metadata":{"files":{"readme":"README.MD","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-18T08:08:49.000Z","updated_at":"2025-02-27T08:32:34.000Z","dependencies_parsed_at":"2023-09-22T10:50:35.952Z","dependency_job_id":"5da15501-3e8b-433a-af01-1e5f0573b9e4","html_url":"https://github.com/consolelabs/mochi-api","commit_stats":null,"previous_names":[],"tags_count":653,"template":false,"template_full_name":null,"purl":"pkg:github/consolelabs/mochi-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consolelabs%2Fmochi-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consolelabs%2Fmochi-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consolelabs%2Fmochi-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consolelabs%2Fmochi-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/consolelabs","download_url":"https://codeload.github.com/consolelabs/mochi-api/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consolelabs%2Fmochi-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267127832,"owners_count":24040142,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-28T10:37:01.463Z","updated_at":"2025-07-26T06:07:30.271Z","avatar_url":"https://github.com/consolelabs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mochi Bot API\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://getmochi.co\"\u003e\n    \u003cimg width=\"700\" src=\"./images/mochi.png\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/golang-1.18-blue\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/strategy-gitflow-%23561D25\" /\u003e\n  \u003ca href=\"https://github.com/consolelabs/mochi-api/blob/main/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/license-GNU-blue\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://discord.gg/DMVyp5Fr8Q\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/issues-pr-raw/consolelabs/mochi-api\" /\u003e\n  \u003cimg src=\"https://img.shields.io/github/contributors/consolelabs/mochi-api\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/we%20love-contributors-yellowgreen\" /\u003e\n  \u003ca href=\"https://twitter.com/getmochi_bot\"\u003e\n  \u003cimg src=\"https://img.shields.io/twitter/follow/getmochi_bot?style=social\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Overview\n\nThis repository is official BE service for **[Mochi bot](https://www.notion.so/9f37233d00734759a1ed7f887e385169)**\n\n## How to contribute\n\n### Prerequisites\n\n1. Go installed\n2. Docker installed\n3. [Set up discord bot](https://www.notion.so/ac75c9b08f54477ba4d8d8d20715adc3)\n4. Owned a Metamask’s wallet. If not:\n   1. [Install Metamask](https://metamask.io/download/) on your browser\n   2. After successful installation, you will be redirected to Metamask’s **Getting started** page.\n      Follow the steps to create your own wallet\n\n### How to run source code locally\n\n1. Set up source\n\n   Set up infras (db, redis), install dependencies, etc.\n\n   ```\n   make setup\n   ```\n\n2. Set up env\n\n   Update these variables inside `.env`, [How to get mnemonic](https://metamask.zendesk.com/hc/en-us/articles/360015290032-How-to-reveal-your-Secret-Recovery-Phrase)\n\n   ```\n   CENTRALIZED_WALLET_PRIVATE_KEY=“your metamask wallet mnemonic”\n   DISCORD_TOKEN='your discord bot token'\n   ```\n\n3. Run source\n\n   ```\n   make dev\n   ```\n\n   You should see the service starting with port 8200 as default\n\n### How to work on a TODO\n\n1. Feel free to pick any TODO for you from [Board View](https://www.notion.so/2b9be3fffef74705830ad77058e35c95) → Mochi → Backlog\\*\\*\n2. **Assign** that item to your account\n3. Remember to update item’s **status** based on your working progress\n   - `Backlog`: not started yet\n   - `In Progress`: still working on\n   - `In Review`: Task done = PR has been merged to `develop` branch at least\n   - `Completed`: Confirmation from the team that the TODO is completely finished\n4. When switching your TODO to `In Review`, remember to fill these in\n\n![Untitled](./images/todotime.png)\n\n### PR template\n\n```markdown\n**What does this PR do?**\n\n- [x] New API for updating ...\n- [x] Update logic of ...\n- [x] Fix error ...\n\n**How to test**\n\n- cURL\n- Steps to test new logic\n- etc.\n\n**Flowchart** (optional)\nShould have if the flow is complex\n\n**Media** (Demo) (optional)\nAttach images or demo videos\nCan insert video URL in case the size exceeds github limit\n```\n\n## Technical Document\n\n1. **Project structure**\n\n- `cmd/` this folder contains the main application entry point files for the project\n  - `server/main.go`: Containing init function `main()` of the service. This function will be executed when we run `make dev`\n  - Other `main.go` files (e.g. `fetch-discord-users/main.go`): Entry points to execute some functional jobs. k8s Cronjob will be set up to execute these jobs schedually\n- `docs/`: contains Swagger documentation files generated by [swaggo](https://github.com/swaggo/swag)\n- `migrations/`: contains seeds and SQL migration files\n  - `schemas/`: contains DB schema migration files\n  - `seed/`: contains seed files which will initialize DB with sets of dummy data\n  - `test-seed/`: also seed files but for test DB\n- `pkg/`: contains core source code of service\n  - `cache/`: caching initial and functional methods\n  - `chain/`: crypto chains’ initial and functional methods\n  - `config/`: contains configs loaded from `.env`\n  - `constants/`: constant variables\n  - `discordwallet/`: methods to initialize \u0026 interact with crypto’s wallets (managed by Mochi)\n  - `handler/`: handling API requests\n  - `entities/`: where mainly core business logic happens, invoked by `handler` and `cmd`\n  - `job/`: contains initial and `Run()` as execution functions. These are invoked by `main()` from `main.go` files (except `server/main.go`)\n  - `logger/`: logging initial and functional methods\n  - `model/`: DB model structs\n  - `repo/`: data access layer, contains DB CRUD operations (see [gorm](https://gorm.io/))\n  - `request/` \u0026 `response/`: API request \u0026 response models\n  - `routes/`: API routing (see [gin](https://github.com/gin-gonic/gin))\n  - `services/`: contains interaction with external services (coingecko API, binance API, etc.)\n  - `util/`: utility methods\n\n2. **Modules references**\n\n- [Invite tracker](https://www.notion.so/Invite-tracker-40503e89ce40437c957f1eba1c87905d)\n\n- [Assign Role \u0026 Default Role](https://www.notion.so/Assign-Role-Default-Role-d6f6fd10722c432cb4aba8d24d47e390)\n\n- [Server Stats](https://www.notion.so/Server-Stats-dc76616935ab414d9b99e5655fad053e)\n\n- [Level Role](https://www.notion.so/Level-Role-842c00dd9a6a45c19c03b9e5f5a56324)\n\n- [PoE/Twitter](https://www.notion.so/PoE-Twitter-a19c7960ca0446aa9fc1d2530a999234)\n\n- [Verify-wallet](https://www.notion.so/Verify-wallet-9a3d511920b5416195e634f7b7092255)\n\n- [Tip bot](https://www.notion.so/Tip-bot-634c6fe98a144d6c86d3e9d77a04b90e)\n\n- [Quest](https://www.notion.so/Quest-4f3f9c3932c74ecc875d9750755db134)\n\n- [Price checker](https://www.notion.so/Price-checker-4c7a9ddca67e485284451216e152be4c)\n\n- [NFT](https://www.notion.so/NFT-bc88b0a16fb7457d9621e35ddc5cc90d)\n\n- [NFT Role](https://www.notion.so/NFT-Role-174945895e164d65a2b0df4f262a3cb1)\n\n3. **Sample usecases**\n\n   1. Create new API\n      - Check out file `/pkg/routes/v1.go` and explore the code flow to see how to create and handle an API\n      - Remember to annotate handler functions with [swaggo](https://github.com/swaggo/swag). Then run `make gen-swagger` to generate Swagger documentations\n   2. New DB migration\n\n      Check out `.sql` files under `/migrations` to write a valid schema migration / seed file\n\n      - To apply new migration files, run `make migrate-up`\n      - To apply seed files, run `make seed-db`\n      - To apply new migration files for test DB, run `make migrate-test`\n\n      **Note:** remember to run these 2 every time you pulling new code\n\n      ```\n      make migrate-up\n      make migrate-test\n      ```\n\n   3. DB repositories\n\n      Check out dirs under `/pkg/repo`\n      **Note:** remember to run `make gen-mock` to generate mocks for new `store` file\n\n## :pray: Credits\n\nA big thanks to all who contributed to this project!\n\nIf you'd like to contribute, please check out the [contributing guide](CONTRIBUTING.md).\n\n[![Contributing](https://contrib.rocks/image?repo=consolelabs/mochi-api)](https://github.com/consolelabs/mochi-api/graphs/contributors)\n\n## Keep in touch\n\n- Reach us at [discord](https://discord.gg/dddsYkB8Jw).\n- Discuss development in the #build-with-us channel.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsolelabs%2Fmochi-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconsolelabs%2Fmochi-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsolelabs%2Fmochi-api/lists"}