Go to file
journey-ad 522c7eea58 Improve searching
By using quotes to specify exact search terms and considering the part of speech of the tokenizer to determine whether each keyword is required or optional, search performance is improved.
2024-06-23 01:48:35 +08:00
.github/workflows 🐳 Create docker-image.yml 2024-06-19 01:22:26 +08:00
.readme Caching time 2024-06-19 00:38:18 +08:00
.vscode 🎉 Initial. 2024-06-12 17:32:22 +08:00
app Improve searching 2024-06-23 01:48:35 +08:00
components Add Stats info to Index page 2024-06-22 12:17:47 +08:00
config Improve searching 2024-06-23 01:48:35 +08:00
i18n Add Stats info to Index page 2024-06-22 12:17:47 +08:00
lib Improve searching 2024-06-23 01:48:35 +08:00
public 🎉 Initial. 2024-06-12 17:32:22 +08:00
styles 🎨 Style improve 2024-06-19 01:14:03 +08:00
types 🎉 Initial. 2024-06-12 17:32:22 +08:00
utils Support keyword tokenizer using jieba 2024-06-21 02:29:39 +08:00
.dockerignore 🎉 Initial. 2024-06-12 17:32:22 +08:00
.eslintignore 🎉 Initial. 2024-06-12 17:32:22 +08:00
.eslintrc.json 🎨 Lint code 2024-06-19 16:27:45 +08:00
.gitignore 🎉 Initial. 2024-06-12 17:32:22 +08:00
.npmrc 🎉 Initial. 2024-06-12 17:32:22 +08:00
.prettierrc.js 🎨 Lint code 2024-06-19 16:27:45 +08:00
docker-compose.yml 🐳 Server listening on 0.0.0.0 2024-06-22 12:12:27 +08:00
Dockerfile 🐳 Server listening on 0.0.0.0 2024-06-22 12:12:27 +08:00
LICENSE 🎉 Initial. 2024-06-12 17:32:22 +08:00
next.config.js Support keyword tokenizer using jieba 2024-06-21 02:29:39 +08:00
package.json 📦 Fix async server component error 2024-06-22 12:57:26 +08:00
postcss.config.js 🎉 Initial. 2024-06-12 17:32:22 +08:00
README_zh-CN.md 🎉 Initial. 2024-06-12 17:32:22 +08:00
README.md 🎉 Initial. 2024-06-12 17:32:22 +08:00
tailwind.config.js 🎉 Initial. 2024-06-12 17:32:22 +08:00
tsconfig.json 🎉 Initial. 2024-06-12 17:32:22 +08:00

Bitmagnet-Next-Web

Bitmagnet-Next-Web

English / 中文文档

A more modern magnet search website program, developed using Next.js 14 + NextUI v2, with the backend powered by Bitmagnet.

Index Search

Deployment Instructions

Container Deployment

The most convenient way to deploy is using Docker Compose. Refer to the docker-compose.yml

Running with docker run

If not using Docker Compose, you can run each container separately using the following commands:

  1. Run the PostgreSQL container:
docker run -d \
  --name bitmagnet-postgres \
  -p 5432:5432 \
  -e POSTGRES_PASSWORD=postgres \
  -e POSTGRES_DB=bitmagnet \
  -e PGUSER=postgres \
  -v ./data/postgres:/var/lib/postgresql/data \
  --shm-size=1g \
  postgres:16-alpine
  1. Run the Bitmagnet container:
docker run -d \
  --name bitmagnet \
  --link bitmagnet-postgres:postgres \
  -p 3333:3333 \
  -p 3334:3334/tcp \
  -p 3334:3334/udp \
  -e POSTGRES_HOST=postgres \
  -e POSTGRES_PASSWORD=postgres \
  ghcr.io/bitmagnet-io/bitmagnet:latest \
  worker run --keys=http_server --keys=queue_server --keys=dht_crawler
  1. Run the Bitmagnet-Next-Web container:
docker run -d \
  --name bitmagnet-next-web \
  --link bitmagnet-postgres:postgres \
  -p 3000:3000 \
  -e POSTGRES_DB_URL=postgres://postgres:postgres@postgres:5432/bitmagnet \
  journey0ad/bitmagnet-next-web:latest

Full-Text Search Optimization

The search capability relies on the torrents.name and torrent_files.path columns. The original Bitmagnet does not index these columns, so it's recommended to create indexes to improve query efficiency:

create extension pg_trgm; -- Enable pg_trgm extension

-- Create indexes on `torrents.name` and `torrent_files.path`
CREATE INDEX idx_torrents_name_1 ON torrents USING gin (name gin_trgm_ops);
CREATE INDEX idx_torrent_files_path_1 ON torrent_files USING gin (path gin_trgm_ops);

Development Guide

Before starting development, create a .env.local file in the project root directory and fill in the environment variables:

# .env.local
POSTGRES_DB_URL=postgres://postgres:postgres@localhost:5432/bitmagnet

It's recommended to use pnpm as the package manager.

Install Dependencies

pnpm install

Run Development Environment

pnpm run dev

Build & Deploy

pnpm run build
pnpm run serve

Credits

License

Licensed under the MIT license.