A user-friendly web application for migrating emails between Google Workspace domains.
🚨 INTERNAL DEVELOPMENT TOOL - This software is currently in active development and should be considered ALPHA/BETA quality.
🚨 USE AT YOUR OWN RISK - This tool directly manipulates email data in Google Workspace accounts. Users assume ALL RESPONSIBILITY for:
- Data loss or corruption
- Service interruptions
- Security implications
- Compliance with organizational policies
- Google API usage and quota limits
🚨 NO WARRANTIES - This software is provided "AS IS" without warranty of any kind, either express or implied.
🚨 BACKUP YOUR DATA - Always backup your emails before running any migration operations.
🚨 TEST THOROUGHLY - Test with a small subset of emails before attempting large-scale migrations.
- ✅ Core functionality implemented
- ✅ Background processing system
- ✅ Authentication pairs management
⚠️ Testing and validation in progress⚠️ Production hardening ongoing
- Internal company migrations
- Technical users comfortable with email systems
- Development and testing environments
- Users who can troubleshoot issues independently
- Simple Web Interface: Easy-to-use Bootstrap UI suitable for non-technical users
- OAuth2 Authentication: Secure Google Workspace authentication for both domains
- Email Selection: Browse and select specific emails to migrate, or migrate entire inbox
- Large Inbox Support: No limits - can migrate thousands of emails from any size inbox
- Real-time Progress: Live migration progress tracking with detailed logs
- Smart Labeling: Automatically creates Gmail labels to identify migrated emails
- Email Tracking: Adds custom headers with source email IDs for easy identification
- Error Handling: Comprehensive error handling and recovery
- Migration History: Track all migration jobs and their status
- Google Cloud Project with Gmail API enabled
- OAuth2 Credentials configured for both domains
- Node.js (v16 or higher)
- SQLite (automatically included)
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable the Gmail API:
- Go to APIs & Services > Library
- Search for "Gmail API" and enable it
- Create OAuth2 credentials:
- Go to APIs & Services > Credentials
- Click "Create Credentials" > "OAuth 2.0 Client IDs"
- Set application type to "Web application"
- Add authorized redirect URI:
http://localhost:3000/auth/google/callback - Save the Client ID and Client Secret
-
Clone/Download this project
-
Install dependencies:
npm install
-
Configure environment variables:
cp .env.example .env
Edit
.envfile with your values:GOOGLE_CLIENT_ID=your_google_client_id_here GOOGLE_CLIENT_SECRET=your_google_client_secret_here GOOGLE_REDIRECT_URI=http://localhost:3000/auth/google/callback SESSION_SECRET=your_random_session_secret_here PORT=3000 NODE_ENV=development DB_PATH=./data/migrations.db
-
Start the application:
# Development mode (with auto-restart) npm run dev # Production mode npm start
-
Access the application: Open http://localhost:3000 in your web browser
- Click "Connect Source Domain" to authenticate your source account
- Log in with your source Google Workspace account
- Click "Connect Destination Domain" to authenticate your destination account
- Log in with your destination Google Workspace account
- Once both accounts are connected, click "Start New Migration"
- The system will create a new migration job
- Browse emails: View emails from the source account with search filters
- Individual selection: Select specific emails you want to migrate
- Entire inbox: Click "Migrate Entire Inbox" to migrate all emails at once
- Start migration: Click "Start Migration" to begin the process
- View real-time migration progress
- See detailed logs and status updates
- Check for any failed migrations
- Note the Gmail label created for tracking
- View migration history in the dashboard
- Check migration statistics and labels created
- Review any errors or issues
- Find migrated emails in Gmail using the migration labels
The tool automatically creates Gmail labels to help you track migrated emails:
- Parent Label:
Email Migration/ - Source Label:
Email Migration/Migrated from [source-email]
- Visual Identification: Blue color coding for easy recognition
- Source Tracking: Each label shows which source account emails came from
- Custom Headers: Adds tracking headers to emails with original message IDs
- Easy Organization: All migration labels grouped under "Email Migration" folder
- In the Inbox: All migrated emails automatically appear in your Inbox
- By Labels: Look for labels starting with "Email Migration/"
- Filter by Source: Click on the migration label to see all emails from that source
- Advanced Tracking: Each email contains custom headers with original source information
- Inbox: All migrated emails are automatically placed in the Inbox
- Labels: Migration labels are applied in addition to Inbox placement
- Organization: You can move emails to other folders while keeping the migration labels
- Backend: Node.js with Express.js
- Database: SQLite for migration tracking
- Authentication: Google OAuth2
- Frontend: Bootstrap 5 with EJS templates
- API: Gmail API v1
users: Store OAuth tokens for authenticated usersmigration_jobs: Track migration job status and progressemail_migrations: Individual email migration recordsmigration_logs: Detailed operation logs
- Secure OAuth2 flow with refresh tokens
- Session-based authentication
- Domain validation (ensures users use correct email domains)
- Input validation and sanitization
- Error logging without exposing sensitive data
GET /auth/source- Start OAuth for source domainGET /auth/destination- Start OAuth for destination domainGET /auth/google/callback- OAuth callback handlerGET /auth/logout- Logout user
GET /migration/dashboard- View migration jobsPOST /migration/start- Create new migration jobGET /migration/select-emails/:jobId- Email selection pageGET /migration/progress/:jobId- Migration progress page
GET /api/emails/:userEmail- List emails from GmailPOST /api/migrate- Start email migrationGET /api/progress/:jobId- Get migration progress
-
"OAuth Error" or "Invalid Credentials"
- Check your Google Cloud Console configuration
- Verify Client ID and Secret in
.envfile - Ensure redirect URI matches exactly
-
"Domain Mismatch" Error
- Ensure you're using the correct email domains
- Source: @source-domain.com, Destination: @destination-domain.com
-
"Failed to Load Emails"
- Check Gmail API is enabled in Google Cloud Console
- Verify user has granted necessary permissions
- Check network connectivity
-
Migration Failures
- Review migration logs in the progress page
- Check quota limits in Google Cloud Console
- Verify both accounts have necessary permissions
Set NODE_ENV=development in .env file for detailed error logs.
- Gmail API has rate limits (250 quota units per user per second)
- Large migrations may take considerable time
- Requires active internet connection
- Both Google Workspace accounts must have API access enabled
For production deployment:
- Set
NODE_ENV=productionin environment variables - Use a reverse proxy (nginx) for SSL termination
- Use a process manager (PM2) for application monitoring
- Configure proper backup for SQLite database
- Set up monitoring and logging
- Use HTTPS for all OAuth redirects
This is an open source project. Contributions are welcome!
- Fork the repository
- Create a feature branch
- Make your changes with proper testing
- Submit a pull request with detailed description
- Follow the existing code style and patterns
Self-Service Support:
- Check the troubleshooting section above
- Review application logs for detailed error information
- Verify Google Cloud Console configuration
- Test with a small number of emails first
- Search existing GitHub issues
- Create new GitHub issues for bugs or feature requests
Enterprise Support: Not available. Users are responsible for their own implementations.
MIT License - See LICENSE file for details.
This software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Built with Node.js, Express, and Gmail API
- UI components from Bootstrap 5
- Background processing powered by Bull and Redis
- Authentication via Google OAuth2