A full-stack application that allows Android clients to send command line instructions and MySQL queries to a Node.js server for remote execution. Built with Express.js backend and Jetpack Compose frontend.
βββββββββββββββββββ HTTP/HTTPS βββββββββββββββββββ
β Android App β βββββββββββββββββΊ β Node.js API β
β (Jetpack Compose) β β (Express.js) β
βββββββββββββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β MySQL DB β
β β
βββββββββββββββββββ
- Remote Command Execution: Execute system commands on the server from Android app
- MySQL Query Interface: Run database queries remotely with results returned to mobile client
- JWT Authentication: Secure login/register system with token-based authentication
- Modern UI: Clean Android interface built with Jetpack Compose
- Network Communication: RESTful API communication between client and server
- Port Forwarding Support: Easy development setup with VS Code port forwarding
- Node.js (v14 or higher)
- MySQL Server
- VS Code (for development with port forwarding)
- Android Studio
- Android SDK (API level 25+)
- Kotlin support
# Clone the repository
git clone https://github.com/Janadasroor/ZeroDrop.git
cd zerodrop/server
# Install dependencies
npm install
# Create environment variables file (Optional)
cp .env.example .env
# Make .env file in server folder (important) with your configuration
# DB_HOST=localhost
# DB_USER=your_mysql_user
# DB_PASS=your_mysql_password
# DB_NAME=zerodrop
# ACCESS_TOKEN_SECRET=make_strong_one
# REFRESH_TOKEN_SECRET=make_strong_one
# Start the server
npm start- Navigate to Android project
- Open
client/ZeroDrop_Demoin Android Studio
-
Configure Port Forwarding:
- It should be found near the terminal tab
-
Make Port Public:
- In the Ports panel, right-click on your forwarded port
- Select "Port Visibility" β "Public"
- Copy the generated public URL (e.g.,
https://abc123-3000.preview.app.github.dev)
- Edit the file
app/src/main/java/com/janad/zerodrop/data/api/NetworkModule.kt:
// Replace with your VS Code port forwarding public URL
private const val BASE_URL = "https://your-forwarded-url.preview.app.github.dev/"
POST /auth/register- User registrationPOST /auth/login- User login
POST /run/command- Execute system commandPOST /run/query- Execute MySQL query
// Login Request
POST /auth/login
{
"email": "email",
"password": "password123"
}
// Command Execution
POST /run/command
Headers: { "Authorization": "Bearer <token>" }
{
"command": "ls -la"
}
// MySQL Query
POST /run/query
Headers: { "Authorization": "Bearer <token>" }
{
"query": "SELECT * FROM admins LIMIT 5"
}app/src/main/java/com/janad/zerodrop/
βββ data/
β βββ api/
β β βββ ApiService.kt
β β βββ NetworkModule.kt # β Configure server URL here
βββ MainActivity.kt
- Make code changes
- Server automatically reloads on code changes
- Port forwarding automatically updates
- Update
NetworkModule.ktwith new forwarded URL if needed - Build and run Android app
- Test API communication
// Development (VS Code Port Forwarding)
private const val BASE_URL = "https://abc123-3000.preview.app.github.dev/"
// Production
private const val BASE_URL = "https://your-production-server.com/"
// Local Development if you don't like to forward the port
private const val BASE_URL = "http://10.0.2.2:3000/" // Android Emulator
// or
private const val BASE_URL = "http://192.168.1.100:3000/" // Physical Device
//This is your development machine ip on the same local network http://192.168.1.100- JWT access token refreshing every 5 minutes
- All API endpoints (except auth) require valid authentication
- Command execution is logged and monitored
- Database queries are parameterized to prevent SQL injection
- HTTPS required for production deployment
-
Network Connection Failed
- Verify VS Code port forwarding is active and public
- Check
NetworkModule.kthas correct URL - Ensure Android device/emulator has internet access
-
Authentication Failed
- Check JWT token validity
- Verify server is running and accessible
- Confirm user credentials are correct
-
Command Execution Failed
- Check server permissions for command execution
- Verify MySQL connection settings
- Review server logs for detailed error messages
This project is licensed under the MIT License - see the LICENSE file for details.
Janada Sroor