A lightweight image upload service built on Nitro, backed by a third-party image hosting API. After logging in, you can upload images through the REST API, the project-local CLI, or a global CLI command available anywhere on your machine.
- Two login methods — scan with the Bilibili app or submit login credentials manually
- REST API —
POST /api/uploadfor programmatic uploads, cookie-based auth - CLI upload — batch upload a file or a whole directory, with concurrency control and a progress bar
- Node.js 20.12 or later
- pnpm (any recent version)
git clone <this-repo-url>
cd image-uploader
pnpm install
pnpm devThe dev server starts on Nitro's default port. Open the root URL in your browser to see the live API reference page.
| Method | Path | Description |
|---|---|---|
POST |
/api/auth/certificate |
Validate login credentials and set the auth cookies |
GET |
/api/qrcode/generate |
Generate a login QR code |
GET |
/api/qrcode/poll?qrcode_key= |
Poll scan status; sets the auth cookie on success |
GET |
/api/myinfo |
Get the currently logged-in account's info |
POST |
/api/upload |
Upload an image (multipart/form-data, field name file) |
POST |
/api/auth/logout |
Log out and clear the authentication cookies |
Run uploads from inside this repo without any extra setup:
pnpm upload -f avatar.png
pnpm upload -d ./imagesRun pnpm upload --help for all available flags.
Want to run k3img from any directory, not just this repo? See the dedicated global CLI setup guide.
pnpm buildThis project targets the vercel preset (see nitro.config.ts). See the Nitro deployment docs for other presets.
See LICENSE.