DEVELOPMENT

Development

From cloning the repo to shipping an installer — the whole pipeline. Everything runs locally, except this update site.

Tech stack

MengMeng Music is built with:

Vue 3 Vite Electron Pinia Element Plus Vue Router Node.js KuGouMusicApi

The UI is a plain Vue 3 SPA. Desktop features (windows, tray, updates, autostart) go through a small set of IPC channels exposed by preload — the renderer never touches Node directly.

Prerequisites

Before you start, make sure you have:

  • Node.js 18 LTS 或更高(低于 18 部分依赖会装不上)
  • npm 随 Node.js 一起安装,或使用 pnpm / yarn
  • Git 与一个顺手的编辑器(VS Code 最省事)
  • Windows 10 / 11 打包目标平台,需要能运行 electron-builder

Get the source

Clone the repo and install dependencies. The first run takes a few minutes (the Electron binary is large):

git clone https://github.com/LHX1925/mm-music-site/
cd mengmeng-music
npm install

Behind a slow network, set the Electron mirror first:npm config set electron_mirror https://npmmirror.com/mirrors/electron/

Start the dev server

npm run dev

Vite handles hot reload for the renderer; the Electron main process opens the window once the dev server is ready.

Debugging

Press F12 (or Ctrl+Shift+I) inside the main window to open DevTools; main-process logs go to the terminal.

The main process starts the local music API automatically (32100 standard / 32101 concept). If a port is taken, the app warns you and lets you change it in Settings.

Project structure

kugou-music/
├── electron/            # 主进程:窗口、托盘、更新、本地接口
│   ├── main.cjs         # 入口与全部 IPC
│   └── updater.cjs      # 检查更新 / 下载 / 覆盖安装
├── public/              # 图标与静态资源
├── src/
│   ├── api/             # 接口封装(搜索、歌单、歌词、MV)
│   ├── components/      # 播放条、歌词、弹窗等组件
│   ├── composables/     # 主题同步等组合式函数
│   ├── stores/          # Pinia:player / user / settings / update
│   ├── utils/           # 歌曲标记、设备号、歌词存储
│   ├── views/           # 页面(首页 / 搜索 / 歌单 / 设置)
│   ├── App.vue
│   └── main.js
├── package.json
└── vite.config.js

Build

Build the renderer first, then package with electron-builder:

npx vite build
npx electron-builder --win

Artifacts land in out_build — one installer and one portable exe.

Quit any running client before packaging, otherwise app.asar stays locked and the write fails.

Data API

Playlists, search and stream URLs all come from a locally running KuGouMusicApi. Two instances (standard + concept) are started side by side.

32100Standard API
32101Concept API
LocalNo public network

KuGouMusicApi 开源仓库 ↗

Update service

This site doubles as the update server. The client calls /api.php?action=check on launch and offers an update when a newer build exists. Publishing is just a version number plus an exe upload in the admin panel.

Update API →

Contributing

Any kind of help is welcome: bug reports, feature requests, copy fixes, translations, or code.

  1. Fork the repository and clone it
  2. Create a branch: git checkout -b feature/xxx
  3. Commit and push to your branch
  4. Open a pull request describing the change and how you tested it
Open repository

Code style

Match the existing style: 2-space indent, single quotes, Composition API. Run a build before submitting.

Troubleshooting

A port is already in use

Defaults are 32100 / 32101. Change them in Settings, or stop whatever is holding the port.

Packaging fails with a locked file

Quit any running instance (including the tray icon) and run the build again.

Search returns nothing

Check that the local API is running and a device id was obtained. The concept instance is occasionally rate-limited — restart the app to request a new id.