|
1 |
| -# mc-server-api |
| 1 | +# Minecraft Server Status API |
| 2 | + |
| 3 | +Fast and reliable Minecraft server status checker API for both Java and Bedrock editions. Get real-time information about any Minecraft server including player count, version, MOTD, and more. |
| 4 | + |
| 5 | +## 🌐 Live Demo |
| 6 | + |
| 7 | +Visit [https://api.raikou.me](https://api.raikou.me) to try out the API. |
| 8 | + |
| 9 | +## ✨ Features |
| 10 | + |
| 11 | +- Support for both Java and Bedrock edition servers |
| 12 | +- Real-time server status checking |
| 13 | +- Detailed server information (version, MOTD, players, etc.) |
| 14 | +- Fast response times |
| 15 | +- Clean and modern web interface |
| 16 | +- RESTful API endpoints |
| 17 | +- Rate limiting for API stability |
| 18 | + |
| 19 | +## 🚀 API Usage |
| 20 | + |
| 21 | +### Java Edition |
| 22 | +```http |
| 23 | +GET https://api.raikou.me/v1/status/java/{server-address} |
| 24 | +``` |
| 25 | + |
| 26 | +### Bedrock Edition |
| 27 | +```http |
| 28 | +GET https://api.raikou.me/v1/status/bedrock/{server-address} |
| 29 | +``` |
| 30 | + |
| 31 | +### Example Response |
| 32 | +```json |
| 33 | +{ |
| 34 | + "online": true, |
| 35 | + "ip": "play.example.com", |
| 36 | + "port": 25565, |
| 37 | + "hostname": "play.example.com", |
| 38 | + "version": "1.20.1", |
| 39 | + "players": { |
| 40 | + "online": 100, |
| 41 | + "max": 1000 |
| 42 | + }, |
| 43 | + "motd": "Welcome to our server!", |
| 44 | + "latency": 42, |
| 45 | + "edition": "java" |
| 46 | +} |
| 47 | +``` |
| 48 | + |
| 49 | +## 🛠️ Self Hosting |
| 50 | + |
| 51 | +### Prerequisites |
| 52 | +- Node.js 18 or higher |
| 53 | +- npm or yarn |
| 54 | +- nginx |
| 55 | +- pm2 |
| 56 | + |
| 57 | +### Installation |
| 58 | + |
| 59 | +1. Clone the repository |
| 60 | +```bash |
| 61 | +git clone https://github.com/devRaikou/mc-server-api.git |
| 62 | +cd mc-server-api |
| 63 | +``` |
| 64 | + |
| 65 | +2. Install dependencies |
| 66 | +```bash |
| 67 | +npm install |
| 68 | +``` |
| 69 | + |
| 70 | +3. Create nginx configuration |
| 71 | +```nginx |
| 72 | +server { |
| 73 | + listen 80; |
| 74 | + server_name api.raikou.me; |
| 75 | +
|
| 76 | + location / { |
| 77 | + proxy_pass http://localhost:3000; |
| 78 | + proxy_http_version 1.1; |
| 79 | + proxy_set_header Upgrade $http_upgrade; |
| 80 | + proxy_set_header Connection 'upgrade'; |
| 81 | + proxy_set_header Host $host; |
| 82 | + proxy_cache_bypass $http_upgrade; |
| 83 | + } |
| 84 | +} |
| 85 | +``` |
| 86 | + |
| 87 | +4. Install and configure SSL with Certbot |
| 88 | +```bash |
| 89 | +sudo apt install certbot python3-certbot-nginx |
| 90 | +sudo certbot --nginx -d api.raikou.me |
| 91 | +``` |
| 92 | + |
| 93 | +5. Start the application with PM2 |
| 94 | +```bash |
| 95 | +npm install pm2 -g |
| 96 | +pm2 start src/index.js --name mc-server-api |
| 97 | +pm2 save |
| 98 | +``` |
| 99 | + |
| 100 | +6. Enable PM2 startup script |
| 101 | +```bash |
| 102 | +pm2 startup |
| 103 | +``` |
| 104 | + |
| 105 | +### Environment Variables |
| 106 | +Create a `.env` file in the root directory: |
| 107 | +```env |
| 108 | +PORT=3000 |
| 109 | +RATE_LIMIT_WINDOW=60000 |
| 110 | +RATE_LIMIT_MAX=60 |
| 111 | +``` |
| 112 | + |
| 113 | +## 📝 License |
| 114 | + |
| 115 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
| 116 | + |
| 117 | +## 🤝 Contributing |
| 118 | + |
| 119 | +Contributions, issues and feature requests are welcome! Feel free to check [issues page](https://github.com/devRaikou/mc-server-api/issues). |
| 120 | + |
| 121 | +## ⭐ Show your support |
| 122 | + |
| 123 | +Give a ⭐️ if this project helped you! |
0 commit comments