mirror of
https://github.com/remnawave/node.git
synced 2026-09-21 17:34:44 +00:00
Node component for Remnawave. Learn more at: https://docs.rw
https://docs.rw
| .github | ||
| .vscode | ||
| libs/contract | ||
| src | ||
| .env.sample | ||
| .eslintrc.js | ||
| .gitignore | ||
| .npmrc | ||
| .prettierrc | ||
| docker-compose-dev.yml | ||
| docker-compose-prod.yml | ||
| docker-entrypoint.sh | ||
| Dockerfile | ||
| Dockerfile.dev | ||
| DockerfileLegacy | ||
| LICENCE | ||
| nest-cli.json | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| supervisord.conf | ||
| tsconfig.build.json | ||
| tsconfig.json | ||
Remnawave Node
A Node.js backend service for managing Xray core instances with NestJS framework.
Overview
Remnawave Node is a service that provides REST API endpoints for managing Xray core instances, handling user management, and collecting statistics. It's built using NestJS and includes JWT authentication.
Features
- Xray core management (start/stop/status)
- User management (add/remove/list users)
- Statistics collection (system/user/inbound/outbound)
- JWT-based authentication
- Zod-based validation
- Error handling
- Helmet security
- Docker support
Prerequisites
- Node.js 20+
- npm/yarn
- Docker (optional)
- Xray core
Installation
- Clone the repository:
git clone https://github.com/remnawave/remnawave-node.git
- Install dependencies:
npm install
- Create
.envfile with required environment variables:
NODE_ENV=development
APP_PORT=3002
API_PREFIX=api/v1
SSL_CERT=<your-ssl-cert> (get from Remnawave Panel)
XTLS_IP=127.0.0.1 (DON'T EDIT FOR NOW)
XTLS_PORT=61000 (DON'T EDIT FOR NOW)
Running the Application
Development
npm run start:dev
Production
npm run build
npm run start:prod
Using Docker
docker-compose -f docker-compose-prod.yml up -d
API Endpoints
Xray Management
POST /api/v1/xray/start- Start Xray coreGET /api/v1/xray/stop- Stop Xray coreGET /api/v1/xray/status- Get Xray status and version
User Management
POST /api/v1/handler/add-user- Add new userPOST /api/v1/handler/remove-user- Remove userPOST /api/v1/handler/get-inbound-users- Get list of inbound usersPOST /api/v1/handler/get-inbound-users-count- Get count of inbound users
Statistics
POST /api/v1/stats/get-user-online-status- Get user online statusPOST /api/v1/stats/get-users-stats- Get users statisticsPOST /api/v1/stats/get-system-stats- Get system statisticsPOST /api/v1/stats/get-inbound-stats- Get inbound statisticsPOST /api/v1/stats/get-outbound-stats- Get outbound statistics
Project Structure
├── src/
│ ├── modules/
│ │ ├── handler/ # User management
│ │ ├── stats/ # Statistics collection
│ │ └── xray-core/ # Xray core management
│ ├── common/ # Shared utilities and configs
│ └── app.module.ts # Main application module
├── libs/
│ └── contract/ # Shared contracts and types
└── docker-compose-prod.yml
Security
The application implements several security measures:
- JWT authentication
- Helmet middleware for HTTP security headers
- Input validation using Zod
- Exception filters
- Environment configuration validation
Development
Available Scripts
npm run build- Build the applicationnpm run format- Format code using Prettiernpm run lint- Lint code using ESLintnpm test- Run testsnpm run start:dev- Start in development modenpm run start:debug- Start in debug modenpm run start:prod- Start in production mode
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For support, please open an issue in the repository or contact the maintainers.
Dev
docker compose -f docker-compose-dev.yml up -d
docker exec -it remnawave-node-dev /bin/bash
Install NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
nvm install v22.12.0 && nvm use v22.12.0
sudo apt update && sudo apt install supervisor
run supervisor
supervisord -c supervisord.conf &
curl -L https://raw.githubusercontent.com/remnawave/scripts/main/scripts/install-latest-xray.sh -o install-xray.sh \
&& chmod +x install-xray.sh \
&& bash ./install-xray.sh \
&& rm install-xray.sh