Files
MeBox/README.md
T
Kiro d5cf5fb4b2 feat: bootstrap MediaStationGo (Go + React rewrite of MediaStation)
Adopt the cropflre/nowen-video tech stack and rebuild the project from
scratch:

  - Backend: Go 1.25 + Gin + GORM + SQLite (WAL) + JWT + WebSocket hub.
    Layered packages config / database / model / repository / service /
    middleware / handler. Default admin (admin/admin123) seeded on first
    run; /api routes for auth, libraries, media, stream and admin
    panels. WebSocket scan-progress events at /api/ws.
  - Frontend: React 18 + Vite 5 + Tailwind 3.4 + Zustand + axios +
    react-router 6 + lucide-react + framer-motion + hls.js. Pages for
    Login / Home / Library / Search / MediaDetail / Player / Admin
    (Library, Users, Settings tabs).
  - Distribution: multi-arch Dockerfile (frontend -> backend -> Alpine
    runtime), docker-compose.yml, GitHub Actions for CI and GHCR
    publish, Makefile, env-prefixed config (MEDIASTATION_*).
  - Docs: README, CONTRIBUTING, .env.example, config.example.yaml.

Backend builds, vets and tests pass. Frontend builds via tsc -b && vite
build (250 kB JS / 16 kB CSS, gzipped 84 / 4 kB).
2026-05-14 15:26:29 +00:00

140 lines
5.0 KiB
Markdown

<h1 align="center">🎬 MediaStationGo</h1>
<p align="center">A Go rewrite of <a href="https://github.com/ShukeBta/MediaStation">MediaStation</a> — your private home media center.</p>
<p align="center">
<img src="https://img.shields.io/badge/Go-1.25-00ADD8?style=flat-square&logo=go" alt="Go">
<img src="https://img.shields.io/badge/React-18-61DAFB?style=flat-square&logo=react" alt="React">
<img src="https://img.shields.io/badge/TypeScript-5-3178C6?style=flat-square&logo=typescript" alt="TypeScript">
<img src="https://img.shields.io/badge/SQLite-WAL-003B57?style=flat-square&logo=sqlite" alt="SQLite">
<img src="https://img.shields.io/badge/Docker-Alpine_3.19-2496ED?style=flat-square&logo=docker" alt="Docker">
<img src="https://img.shields.io/badge/License-GPL--3.0-blue?style=flat-square" alt="License">
</p>
---
## Why a rewrite?
The original MediaStation is a Python/FastAPI + Vue project. **MediaStationGo**
is a from-scratch reimplementation that adopts the lighter, single-binary
deployment model used by [`cropflre/nowen-video`](https://github.com/cropflre/nowen-video):
- **Backend**: Go 1.25 + Gin + GORM + SQLite (WAL).
- **Frontend**: React 18 + Vite + Tailwind + Zustand.
- **Distribution**: one ~30 MB static binary (CGO disabled), or a
multi-arch Alpine Docker image.
The goal is to keep the user-facing feature surface familiar (libraries,
scanning, scraping, direct play/HLS, multi-user, downloads) while making
deployment painless on NAS hardware.
---
## Features (current scaffold)
- ✅ JWT authentication with admin/user roles
- ✅ First-run admin seeding (`admin / admin123`)
- ✅ Library CRUD + recursive filesystem scan
- ✅ Direct-play streaming with HTTP `Range` support
- ✅ Real-time scan progress via WebSocket
- ✅ React SPA: Login / Home / Library / Search / Media detail / Player / Admin
- ✅ Single-binary build, multi-arch Docker image, GitHub Actions CI
### Roadmap
| Area | Status |
|------|--------|
| ffprobe-driven metadata extraction | ⏳ |
| TMDb / Bangumi / Douban scraper chain | ⏳ |
| HLS on-demand transcoding (NVENC / QSV / VAAPI) | ⏳ |
| qBittorrent / Transmission / RSS automation | ⏳ |
| Playlists, favourites, watch history UI | ⏳ |
| Emby/Jellyfin compatibility layer | ⏳ |
| DLNA / Chromecast | ⏳ |
| AI metadata enhancement & smart search | ⏳ |
---
## Quick start
### Docker
```bash
git clone https://github.com/ShukeBta/MediaStationGo.git
cd MediaStationGo
# (optional) edit docker-compose.yml to mount your media root at /media
docker compose up -d
```
Open <http://localhost:8080> and log in with `admin / admin123`.
### Bare metal
```bash
# requirements: Go 1.25+, Node 20+, ffmpeg
make build # produces bin/mediastation-go and web/dist
./bin/mediastation-go
```
### Local development
```bash
make dev # backend on :8080, MEDIASTATION_APP_DEBUG=true
make dev-web # vite dev server on :3000, proxies /api -> :8080
```
---
## Configuration
Configuration is layered — defaults < `config.yaml` < `config/*.yaml` <
environment variables prefixed with `MEDIASTATION_`.
The most common keys:
| Key | Default | Purpose |
|------|---------|---------|
| `MEDIASTATION_APP_PORT` | `8080` | HTTP listen port |
| `MEDIASTATION_APP_DATA_DIR` | `./data` | DB / cache / JWT secret root |
| `MEDIASTATION_APP_WEB_DIR` | `./web/dist` | SPA bundle to serve |
| `MEDIASTATION_DATABASE_DB_PATH` | `./data/mediastation.db` | SQLite file |
| `MEDIASTATION_SECRETS_JWT_SECRET` | *(auto)* | JWT signing key |
| `MEDIASTATION_APP_CORS_ORIGINS` | *(empty)* | Allow-list, JSON array |
| `ADMIN_INITIAL_PASSWORD` | `admin123` | Bootstrap admin password |
See [`config.example.yaml`](config.example.yaml) for the full surface.
---
## Project layout
```
MediaStationGo/
├── cmd/server/main.go Application entry point
├── internal/
│ ├── config/ Viper-based config loader
│ ├── database/ GORM + SQLite (WAL) bootstrap
│ ├── model/ GORM data models + AutoMigrate registry
│ ├── repository/ Thin data-access layer
│ ├── service/ Business logic (auth/media/scan/stream/ws)
│ ├── middleware/ Gin middleware (CORS / JWT / admin)
│ └── handler/ HTTP route definitions
├── web/ React 18 + Vite SPA
│ ├── src/api/ axios helpers
│ ├── src/components/ Layout, MediaCard, RequireAuth, …
│ ├── src/pages/ Home / Library / Search / Player / Admin
│ ├── src/stores/ Zustand (auth)
│ └── src/types/ Domain types mirrored from Go
├── Dockerfile Multi-stage, multi-arch build
├── docker-compose.yml NAS-friendly deployment
├── Makefile build / dev / docker / test
├── config.example.yaml Full configuration template
└── .github/workflows/ CI + GHCR publish
```
---
## License
Released under the [GNU GPL v3.0](LICENSE).