A Node.js Express server for hosting and managing Electerm package repositories, specifically designed to serve Debian packages and repository metadata.
This server provides:
- Static file serving for repository files
- REST API endpoint for creating/updating Debian repositories
- Automated build process for repository generation
- GitHub Actions integration for CI/CD
- Static File Hosting: Serves repository files from the
repos
folder - Debian Repository Management: Automated creation and management of
.deb
package repositories - GitHub Actions Integration: Accepts repository updates via POST requests from GitHub Actions
- ESM Module Support: Built with modern ES modules
- Express.js Framework: Fast and minimal web framework
- Clone the repository:
git clone https://github.com/electerm/repos.git
cd repos
- Install dependencies:
npm install
- Start the server:
npm start
The server will start on port 3000 by default (or the port specified in the PORT
environment variable).
Root endpoint that provides basic server information and available endpoints.
Health check endpoint that returns server status and timestamp.
Creates or updates a Debian repository with the provided parameters.
Request Body:
{
"releaseInfo": "Release information or metadata",
"gpgKeyId": "GPG key identifier",
"gpgPrivateKey": "GPG private key for signing"
}
Response:
{
"success": true,
"message": "Debian repository created successfully",
"output": "Build script output",
"timestamp": "2025-08-15T10:30:00.000Z"
}
All files in the repos
folder are served statically. For example:
https://your-domain.com/deb/
- Debian repository fileshttps://your-domain.com/deb/public.key
- GPG public key
├── build/
│ └── build-deb.sh # Debian repository build script
├── repos/ # Static files served by the server
│ └── deb/ # Debian repository (created automatically)
├── src/
│ ├── deb-build/ # Template files for Debian repository
│ │ ├── index.html # Repository information page
│ │ └── public.key # GPG public key
│ └── server/
│ └── app.js # Main Express server
├── package.json
└── README.md
When the /deb
endpoint is called:
- The server validates the required parameters (
releaseInfo
,gpgKeyId
,gpgPrivateKey
) - Creates the
repos/deb
directory if it doesn't exist - Sets environment variables for the build script
- Executes
build/build-deb.sh
which copies files fromsrc/deb-build
torepos/deb
- Returns the build results
This server is designed to work with GitHub Actions for automated repository updates. Example workflow:
- name: Update Repository
run: |
curl -X POST https://your-server.com/deb \
-H "Content-Type: application/json" \
-d '{
"releaseInfo": "${{ github.event.release.body }}",
"gpgKeyId": "${{ secrets.GPG_KEY_ID }}",
"gpgPrivateKey": "${{ secrets.GPG_PRIVATE_KEY }}"
}'
PORT
- Server port (default: 3000)NODE_ENV
- Environment (production/development)
- VPS Deployment:
# Clone and setup
git clone https://github.com/electerm/repos.git
cd repos
npm install
# Start with PM2 (recommended)
npm install -g pm2
pm2 start src/server/app.js --name "electerm-repos"
pm2 startup
pm2 save
- Docker Deployment:
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
EXPOSE 3000
CMD ["npm", "start"]
- Nginx Reverse Proxy (recommended):
server {
listen 80;
server_name electerm-repos.html5beta.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
}
}
- Production:
https://electerm-repos.html5beta.com/deb
- Local Development:
http://localhost:3000/deb
Users can add the repository to their system with:
# Add the GPG key
curl -fsSL https://electerm-repos.html5beta.com/deb/public.key | sudo gpg --dearmor -o /usr/share/keyrings/electerm.gpg
# Add the repository
echo "deb [signed-by=/usr/share/keyrings/electerm.gpg] https://electerm-repos.html5beta.com/deb stable main" | sudo tee /etc/apt/sources.list.d/electerm.list
# Update package list
sudo apt update
# Install Electerm
sudo apt install electerm
npm start
# Health check
curl http://localhost:3000/health
# Test repository creation
curl -X POST http://localhost:3000/deb \
-H "Content-Type: application/json" \
-d '{
"releaseInfo": "Test release",
"gpgKeyId": "test-key-id",
"gpgPrivateKey": "test-private-key"
}'
- GPG Keys: Private keys are passed via request body and should be handled securely
- HTTPS: Always use HTTPS in production
- Input Validation: Server validates required parameters
- Environment: Keep sensitive data in environment variables or secrets management
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
MIT License - see LICENSE file for details.
- Electerm - Modern terminal/ssh/sftp client
- Electerm Website - Official website
For issues and questions:
- GitHub Issues: https://github.com/electerm/repos/issues
- Main Project: https://github.com/electerm/electerm