A web application for saving user-generated content (UGC) from www.luogu.com.cn.
简体中文 | English
Luogu Saver Next (LGS-NG) is a web application designed to help users save and manage user-generated content from Luogu, a popular Chinese competitive programming platform. This tool allows users to archive articles, pastes, and other content types, ensuring that valuable information is preserved and remains easily accessible.
- Content Archiving: Save articles and pastes directly from Luogu.
- Management UI: User-friendly interface for organizing saved content.
- Broad Support: Handles multiple content types efficiently.
- High Performance: Utilizes client-side rendering for a smooth user experience.
- Responsive Design: Optimized for use on desktops, tablets, and mobile devices.
- Intelligent Recommendations: Suggests related content based on user activity.
This project is a Monorepo managed by npm workspaces:
- Root: Manages shared dev-dependencies (Prettier, TypeScript, etc.) and orchestration.
packages/frontend: Vue 3 + Vite application (Naive UI).packages/backend: Koa + TypeScript API service.- Infrastructure: External services (Database, etc.) managed via Docker Compose.
Ensure you have the following installed:
Before building or running the application, you need to initialize the underlying infrastructure (e.g., databases). A docker-compose.yml is provided in the root directory to spin up these external services.
Note: This Compose file only manages external infrastructure. The Node.js application itself is run separately on the host.
Start the infrastructure in the background:
docker compose up -dgit clone https://github.com/Ark-Aak/luogu-saver-next.git
cd luogu-saver-nextInstall dependencies for the root and all workspaces in one go:
npm installYou can build the entire project (Frontend & Backend) with a single command:
npm run buildOr build them individually using npm workspaces:
Frontend Only:
# Optional: Set environment variables inline
# VITE_API_URL=[https://api.example.com](https://api.example.com) npm run build -w @luogu-saver-next/frontend
npm run build -w @luogu-saver-next/frontendThe compiled static files will be located in packages/frontend/dist.
Backend Only:
npm run build -w @luogu-saver-next/backendThe compiled backend files will be located in packages/backend/dist.
We use concurrently to run both frontend and backend in watch mode with a single command.
Ensure your database and other services are running:
docker compose up -dIn the project root, run:
npm run devThis will:
- Start the Frontend (Vite) in watch mode.
- Start the Backend (ts-node-dev) in watch mode.
- Output logs from both services in the same terminal (color-coded).
On your production server, start the required external services:
docker compose up -dNavigate to the backend workspace or run directly from the root:
cd packages/backend
# Install production dependencies only
npm install --production
# Start the server
node dist/index.jsThe server will start on the configured port (default is 3000).
You need a web server (e.g., Nginx or Caddy) to serve the static files located in:
packages/frontend/dist
If you did not set the VITE_API_URL variable during the frontend build, the application defaults to sending requests to /api on the same domain.
Crucial Step: You must configure your web server (Nginx/Caddy) to reverse proxy requests starting with /api to the running backend service (e.g., localhost:3000).
Contributions are welcome! To contribute to Luogu Saver Next:
- Fork the repository on GitHub.
- Create a new branch for your feature or bug fix.
- Commit your changes with clear, descriptive messages.
- Push your changes to your forked repository.
- Open a Pull Request to the main repository.
Please ensure your code adheres to the project's coding standards (Prettier) and includes appropriate tests.