Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/syhily/yufan.me/llms.txt

Use this file to discover all available pages before exploring further.

yufan.me includes a music library that lets you embed audio tracks in posts using the APlayer music player. Tracks — both the MP3 file and the album cover — are stored in your S3 bucket and referenced from posts via PortableText. Lyrics are stored alongside each track in the database so the player never has to make a second network request to fetch them.

Prerequisites

S3 storage must be enabled before you can add tracks. Go to Settings → Assets (/admin/settings/assets) and turn on Enable S3 uploads. This is the same toggle that gates image uploads — enabling it once covers both media types.
Audio files and cover art are stored in the same S3 bucket as images. The assets.storage.enabled toggle in Settings → Assets controls all uploads. If images are already working, music uploads will work too.

Music library structure

Each track in the library has the following shape:
FieldDescription
Audio fileStored at musics/<playerId>.mp3
Cover image300 × 300 JPEG stored at musics/<playerId>.jpg
Title, artist, albumText metadata displayed by the player
LyricsStored in music.lyric — pre-loaded with the track to avoid a second round-trip
Source / Source IDCurrently netease (NetEase Cloud Music); (source, sourceId) is unique. source is reserved for future providers
The playerId is a 16-character lowercase alphanumeric nanoid generated at import time. PortableText blocks reference tracks by this ID.

Adding a track

  1. Go to Admin → Music Library and click New Track.
  2. Enter the track title, artist, and album.
  3. Upload the audio file (MP3) and cover art.
  4. Optionally paste a NetEase Cloud Music track ID — the service fetches metadata, the stream URL, and lyrics automatically via Meting.
  5. Save the track.
The cover image is re-encoded to 300 × 300 JPEG by Sharp before being written to S3. The audio file is stored as-is (up to the 25 MB limit). If a track with the same (source, sourceId) pair already exists in the library, saving returns the existing row without re-uploading — this makes bulk imports safe to re-run.

Embedding a track in a post

Two entry points in the Tiptap editor open the music picker:
  • Music Picker button in the top toolbar
  • /music slash command in the body
Selecting a track inserts a musicPlayer PortableText block that references the track by its playerId. The block renders on the public site using APlayer with the per-track lyrics pre-loaded from the database.

Build docs developers (and LLMs) love