No description
- JavaScript 85.9%
- Dockerfile 14.1%
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| docker-compose.yml | ||
| Dockerfile | ||
| index.js | ||
| package.json | ||
| README.md | ||
MailGetto
Email bridge API dengan integrasi IMAP untuk mengambil email dari server mail.
Features
- ✉️ Fetch emails via IMAP
- 🔒 Secure authentication
- 🚀 Fast and lightweight
- 🐳 Docker ready
- 🔧 Environment-based configuration
Prerequisites
- Node.js >= 18.0.0
- npm atau yarn
- Docker & Docker Compose (untuk deployment)
Installation
Local Development
- Clone repository
git clone <repository-url>
cd mailgetto
- Install dependencies
npm install
- Setup environment variables
cp .env.example .env
# Edit .env dengan konfigurasi Anda
- Run application
npm start
# atau untuk development dengan auto-reload
npm run dev
Docker Deployment
- Setup environment variables
cp .env.example .env
# Edit .env dengan konfigurasi Anda
- Build dan run dengan Docker Compose
docker-compose up -d
- Check logs
docker-compose logs -f
- Stop container
docker-compose down
Manual Docker Build
# Build image
docker build -t mailgetto:latest .
# Run container
docker run -d \
--name mailgetto \
-p 3000:3000 \
--env-file .env \
mailgetto:latest
Environment Variables
| Variable | Description | Default | Required |
|---|---|---|---|
PORT |
Server port | 3000 |
No |
HOST |
Server host | 0.0.0.0 |
No |
NODE_ENV |
Environment mode | development |
No |
LOG_LEVEL |
Log level (info, debug, error) | info |
No |
IMAP_HOST |
IMAP server hostname | - | Yes |
IMAP_PORT |
IMAP server port | 993 |
No |
IMAP_SECURE |
Use SSL/TLS | true |
No |
ALLOWED_DOMAINS |
Allowed email domains (comma-separated) | - | Yes |
EMAIL_PASSWORD |
Password untuk semua akun email | - | Yes |
AUTH_KEY |
Kunci akses untuk menggunakan API | - | Yes |
Example .env:
ALLOWED_DOMAINS=arcodo.dev,ac.arcodo.dev,mail.arcodo.dev
API Endpoints
GET /get
Fetch emails dari IMAP server.
Query Parameters:
authkey(required) - Kunci akses API (dari .env)from(required) - Email pengirimto(required) - Email penerimafirst(optional) - Jikatrue, hanya ambil email terbaru
Example:
curl "http://localhost:3000/get?authkey=your_secret_key&from=sender@example.com&to=user@arcodo.dev&first=true"
Response:
{
"data": [
{
"subject": "Email Subject",
"from": "sender@example.com",
"to": "receiver@arcodo.dev",
"date": "2026-05-25T12:00:00.000Z",
"text": "Email content",
"html": "<p>Email content</p>"
}
],
"count": 1,
"server": "mail.arcodo.dev"
}
GET /health
Health check endpoint.
Response:
{
"status": "ok",
"timestamp": "2026-05-25T12:00:00.000Z",
"uptime": 123.456
}
GET /info
Get server configuration info.
Response:
{
"allowedDomain": "arcodo.dev",
"imapHost": "mail.arcodo.dev",
"imapPort": 993
}
Docker Image Optimization
Image ini dioptimasi untuk ukuran minimal:
- ✅ Multi-stage build
- ✅ Alpine Linux base (node:20-alpine)
- ✅ Production dependencies only
- ✅ Non-root user
- ✅ Health check included
- ✅ Resource limits configured
- ✅ Security hardening (read-only filesystem, no-new-privileges)
Estimated image size: ~150MB
Security Features
- Non-root user execution
- Read-only filesystem
- No privilege escalation
- TLS certificate validation
- Input validation
- Proper error handling
License
ISC