No description
  • JavaScript 85.9%
  • Dockerfile 14.1%
Find a file
2026-05-27 03:57:42 +00:00
.dockerignore Add initial implementation of MailGetto email bridge API with IMAP integration 2026-05-25 12:29:15 +07:00
.env.example Update environment variables and configuration for email bridge API 2026-05-25 12:45:35 +07:00
.gitignore Add initial implementation of MailGetto email bridge API with IMAP integration 2026-05-25 12:29:15 +07:00
docker-compose.yml Update environment variables and configuration for email bridge API 2026-05-25 12:45:35 +07:00
Dockerfile Update Dockerfile to use npm install for production dependencies 2026-05-25 12:53:08 +07:00
index.js Perbarui index.js 2026-05-27 03:57:42 +00:00
package.json Add initial implementation of MailGetto email bridge API with IMAP integration 2026-05-25 12:29:15 +07:00
README.md Update environment variables and configuration for email bridge API 2026-05-25 12:45:35 +07:00

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

  1. Clone repository
git clone <repository-url>
cd mailgetto
  1. Install dependencies
npm install
  1. Setup environment variables
cp .env.example .env
# Edit .env dengan konfigurasi Anda
  1. Run application
npm start
# atau untuk development dengan auto-reload
npm run dev

Docker Deployment

  1. Setup environment variables
cp .env.example .env
# Edit .env dengan konfigurasi Anda
  1. Build dan run dengan Docker Compose
docker-compose up -d
  1. Check logs
docker-compose logs -f
  1. 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 pengirim
  • to (required) - Email penerima
  • first (optional) - Jika true, 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