{"id":21958184,"url":"https://github.com/TooonyChen/AuthInbox","last_synced_at":"2025-07-22T11:31:19.995Z","repository":{"id":258204192,"uuid":"868950418","full_name":"TooonyChen/AuthInbox","owner":"TooonyChen","description":"Auth Inbox 📬 is a self-hosted, open-source platform for receiving multiple email verification codes and real-time notifications, built using Cloudflare's free services. | Auth Inbox 📬 是一个自建的开源多邮箱验证码的接码平台，基于 Cloudflare 的免费服务。","archived":false,"fork":false,"pushed_at":"2025-01-07T11:44:55.000Z","size":84,"stargazers_count":128,"open_issues_count":0,"forks_count":42,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-25T07:04:56.852Z","etag":null,"topics":["2fa","cloudflare","cloudflare-email","cloudflare-email-routing","cloudflare-workers","email","mail","multiple-emails","open-source","security","verfication"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TooonyChen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-07T13:16:14.000Z","updated_at":"2025-05-24T12:04:21.000Z","dependencies_parsed_at":"2025-01-15T07:09:31.080Z","dependency_job_id":"419b1993-132d-4a34-a572-4bdf1b62ccf2","html_url":"https://github.com/TooonyChen/AuthInbox","commit_stats":null,"previous_names":["tooonychen/authinbox"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TooonyChen/AuthInbox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TooonyChen%2FAuthInbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TooonyChen%2FAuthInbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TooonyChen%2FAuthInbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TooonyChen%2FAuthInbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TooonyChen","download_url":"https://codeload.github.com/TooonyChen/AuthInbox/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TooonyChen%2FAuthInbox/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266483611,"owners_count":23936381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2fa","cloudflare","cloudflare-email","cloudflare-email-routing","cloudflare-workers","email","mail","multiple-emails","open-source","security","verfication"],"created_at":"2024-11-29T09:00:42.887Z","updated_at":"2025-07-22T11:31:19.983Z","avatar_url":"https://github.com/TooonyChen.png","language":"TypeScript","funding_links":[],"categories":["邮箱"],"sub_categories":[],"readme":"# Auth Inbox 📬\n\n[English](https://github.com/TooonyChen/AuthInbox/blob/main/README.md) | [简体中文](https://github.com/TooonyChen/AuthInbox/blob/main/README_CN.md)\n\n**Auth Inbox** is an open-source project that securely receive and views authentication emails using [Cloudflare](https://cloudflare.com/)'s free serverless services. It automatically processes incoming emails, extracts verification codes or links, and stores them in a database. A user-friendly web interface is provided for administrators to easily review the extracted information. AuthInbox also supports real-time notifications via Bark, making it a comprehensive and hassle-free solution for email authentication management.\n\nDon't wanna receive ads and spams on your main email? Want a bunch of alternative email for register services and websites? Try this **secure**, **serverless**, **light** service!\n\n\n[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/TooonyChen/AuthInbox)\n\n![Framework](https://github.com/user-attachments/assets/fb5a0204-85fd-4663-9f9d-cd90a4a1fa96)\n\n---\n\n## Table of Contents 📑\n\n- [Features](#features)\n- [Technologies Used](#technologies-used)\n- [Installation](#installation)\n- [License](#license)\n- [Screenshots](#Screenshots)\n\n---\n\n## Features ✨\n\n- **Email Processing**: Automatically captures and stores incoming emails.\n- **Code Extraction**: Utilizes AI to extract verification codes, links, and organization names from emails.\n- **Secure Front-End**: Provides a web interface protected by Basic Access Authentication for viewing extracted codes.\n- **Real-Time Notifications**: Optionally sends notifications via Bark when new codes are extracted.\n- **Database Integration**: Stores raw and processed email data in a Cloudflare D1 Database.\n\n---\n\n## Technologies Used 🛠️\n\n- **Cloudflare Workers**: Serverless platform for handling email processing and web requests.\n- **Cloudflare D1**: Cloudflare's serverless SQL database for storing email data.\n- **TypeScript**: Strongly typed programming language for robust and maintainable code.\n- **Google AI Studio API**: Utilized for extracting relevant information from emails with optimized AI prompts to enhance data accuracy and reliability.\n- **AI Prompt Optimization**: Custom-crafted prompts ensure precise extraction of titles, codes, and topics from varied email formats.\n- **Bark API**: Optional integration for sending real-time notifications.\n- **HTML/CSS**: Front-end interface with responsive and modern design.\n\n---\n\n## AI Prompt Optimization 🧠\n\nTo ensure accurate extraction of information from incoming emails, we've implemented AI prompt optimization using the Google AI Studio API. By crafting precise and context-aware prompts, the AI can reliably identify and extract key elements such as:\n\n- **Organization Name (Title)**: Identifies the sender's organization or company.\n- **Verification Code/Link**: Extracts codes, links, or passwords necessary for account verification.\n- **Email Topic**: Summarizes the main purpose of the email, such as 'account verification' or 'password reset'.\n\n**Prompt:**\n```plaintext\nEmail content: [Insert raw email content here].\n\nPlease read the email and extract the following information:\n1. Code/Link/Password from the email (if available).\n2. Organization name (title) from which the email is sent.\n3. A brief summary of the email's topic (e.g., 'account verification').\n\nFormat the output as JSON with this structure:\n{\n  \"title\": \"The organization or company that sent the verification code (e.g., 'Netflix')\",\n  \"code\": \"The extracted verification code, link, or password (e.g., '123456' or 'https://example.com/verify?code=123456')\",\n  \"topic\": \"A brief summary of the email's topic (e.g., 'account verification')\",\n  \"codeExist\": 1\n}\n\nIf both a code and a link are present, include both in the 'code' field like this:\n\"code\": \"code, link\"\n\nIf there is no code, clickable link, or this is an advertisement email, return:\n{\n  \"codeExist\": 0\n}\n```\n\n---\n\n## Installation ⚙️\n0. **Prerequisites**\n\n\t- Create a [Google AI Studio API](https://aistudio.google.com/)\n\n\t- Bind a domain to your [Cloudflare](https://dash.cloudflare.com/) account\n\n\t  - Get Your Cloudflare Account ID from [here](https://dash.cloudflare.com/profile)\n\n      - Generate a Cloudflare Workers API Token from [here](https://dash.cloudflare.com/profile/api-tokens)\n\n\t- (Optional) Download the [Bark App](https://bark.day.app/) and get a Bark Token from the App\n\n1. **Install using Github Pages**\n\n   1. **Creating D1 Database**\n\n      1. Go to [Cloudflare Dashboard](https://dash.cloudflare.com/) -\u003e `Workers \u0026 Pages` -\u003e `D1 SQL Database` -\u003e `Create`\n\n      2. Input Name `inbox-d1` and click `Create`\n\n      3. After Creating `inbox-d1`, click in to it and find `Console`\n\n      4. Execute the following SQL command from [db/schema.sql](https://github.com/TooonyChen/AuthInbox/blob/main/db/schema.sql) in the console, just copy, paste and execute it.\n\n      5. Copy the `database_id` and `database_name` for the next step when you configure the `TOML` file\n\n   2. **Deploy the Cloudflare Worker**\n\n      [![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/TooonyChen/AuthInbox)\n\n      1. Click the button on the top to fork this repository or directly fork this repository.\n\n      2. Open the repository that you fork, find the `Actions` page, find `Deploy Auth Inbox to Cloudflare Workers`, and click `enable workflow` to activate the workflows.\n\n      3. Then, in the repository page, navigate to `Settings` -\u003e `Secrets and variables` -\u003e `Actions` -\u003e `Repository secrets` and add the following secrets:\n         - `CLOUDFLARE_ACCOUNT_ID`: Cloudflare account ID.\n         - `CLOUDFLARE_API_TOKEN`: Cloudflare API Token.\n         - `TOML`: Configuration file, refer to [wrangler.toml with comments](https://github.com/TooonyChen/AuthInbox/blob/main/wrangler.toml.example). **Please use the [version without comments](https://github.com/TooonyChen/AuthInbox/blob/main/wrangler.toml.example.clear) in adding the secret in case of unknown errors.**\n\n      4. Back to `Action` Page in your repository, find `Deploy Auth Inbox to Cloudflare Workers` and press `Run workflow` to deploy the worker. If you can't find the `Run workflow` button, you can trigger GitHub Actions automatically by making a small edit to the `readme.md` file in your repository.\n\n      5. After the deployment is successful, you can find the URL of your worker in the `Deploy Auth Inbox to Cloudflare Workers` workflow log.\n\n      6. Find the `delete all logs` button in the upper-right corner of the workflow logs page. Delete the logs to avoid data leakage.\n\n      7. Done! ✅ Jump to step 3: Set Email Forwarding.\n\n\n2. **Install using command-line**\n\n\t1. **Initialization**\n\n\t\t```bash\n\t\tnpm install wrangler -g # install wrangler\n\t\tgit clone https://github.com/TooonyChen/AuthInbox.git # clone the repository\n\t\tcd AuthInbox # change directory\n\t\tnpm install # install dependencies\n\t\t```\n\n\t2. **create d1 database**\n\n\t\tWhen you execute the [Wrangler](https://developers.cloudflare.com/workers/wrangler/get-started/) login command for the first time, you will be prompted to log in. Just follow the prompts.\n\n\t\t```bash\n\t\tnpx wrangler d1 create inbox-d1 # creating a d1 database called 'inbox-d1'\n\t\tnpx wrangler d1 execute inbox-d1 --remote --file=./db/schema.sql # write the schema.sql to the database\n\t\t```\n\t\tyou will get the result like this:\n\t\t```bash\n\t\t✅ Successfully created DB 'inbox-d1'\n\n\t\t[[d1_databases]]\n\t\tbinding = \"DB\" # available in your Worker on env.DB\n\t\tdatabase_name = \"inbox-d1\"\n\t\tdatabase_id = \"\u003cunique-ID-for-your-database\u003e\"\n\t\t```\n\t\tplease copy the result from your terminal, you will use them in the next step\n\n\t3. **Configure Environment Variables**\n\n\t\tUse `wrangler.toml` file in the project root with the necessary environment variables:\n\n\t\t```toml\n\t\tname = \"auth-inbox\"\n\t\ttype = \"typescript\"\n\n\t\t[vars]\n\t\tUseBark = \"true\" # set 'true' to use or 'false' to not use\n\t\tbarkUrl = \"https://api.day.app\"\n\t\tbarkTokens = \"[token1, token2]\" # set to your bark tokens on your iOS device, download it from https://bark.day.app/, you can use multiple tokens, if you only use one, then set it to '[token1]'\n\t\tFrontEndAdminID = \"admin\" # your login\n\t\tFrontEndAdminPassword = \"password\" # your password\n\t\tGoogleAPIKey = \"xxxxxxxxxxx\" # your google api, go to https://aistudio.google.com/ to generate one if u dont have\n\n\t\t[[d1_databases]] # Copy the lines obtained from step 2 from your terminal.\n\t\tbinding = \"DB\"\n\t\tdatabase_name = \"inbox-d1\" # Copy from step 2\n\t\tdatabase_id = \"\u003cunique-ID-for-your-database\u003e\" # Copy from step 2\n\t\t```\n\n\t4. **Deploy your own worker** 🌐\n\t   Deploy your Worker to make your project accessible on the Internet. Run:\n\t   ```bash\n\t   npx wrangler deploy\n\t   ```\n\t   You will get output like this:\n\t   ```\n\t   Outputs: https://auth-inbox.\u003cYOUR_SUBDOMAIN\u003e.workers.dev\n\t   ```\n\t   You can now visit the URL for your newly depolyed Auth Inbox for checking the email results.\n\n3. **Set Email Forwarding** ✉️\n\n\tGo to [Cloudflare Dashboard](https://dash.cloudflare.com/) -\u003e `Websites` -\u003e `\u003cyour-domain\u003e` -\u003e `Email` -\u003e `Email-Routing` -\u003e `Routing Rules`\n\n\tif you want to use `catch-all address`:\n\t![image](https://github.com/user-attachments/assets/53e5a939-6b03-4ca6-826a-7a5f02f361ac)\n\n\tif you want to use `custom address`:\n\t![image](https://github.com/user-attachments/assets/b0d0ab94-c2ad-4870-ac08-d53e64b2c880)\n\n4. **Enjoy!** 🎉\n\n\tAll set! ✅ You can now receive and view your authentication emails securely and efficiently using Auth Inbox!\n\n---\n\n## License 📜\n\nThis project is licensed under the [MIT License](LICENSE).\n\n---\n\n## Screenshots 📸\n\n![image](https://github.com/user-attachments/assets/ec14d226-ae82-4689-b44d-22850002c34c)\n\n\n---\n\n## Acknowledgements 🙏\n\n- **Cloudflare Workers** for providing a powerful serverless platform.\n- **Google Gemini AI** for enabling intelligent email content extraction.\n- **Bark** for real-time notification capabilities.\n- **Open Source Community** for inspiring and supporting projects like AuthInbox.\n- **ChatGPT** for helping me writing some of the code.\n\n---\n\n## TODO 📝\n\n- [x] **Github Pages Deployment**: Automatically deploy to Cloudflare Workers via Github Actions.\n- [ ] **Regular Expressions**: Using regular expressions instead of Google Gemini AI for privacy, make Gemini AI to an optional function.\n- [ ] **Multi-User Support**: Add functionality to manage multiple users for increased flexibility and broader usage.\n- [ ] **Enhance Front-End Design**: Improve the UI/UX of the web interface for a more modern and user-friendly experience.\n- [ ] **API**: Add API functionality.\n- [ ] **Sending Email**: Add the ability to send emails.\n- [ ] **More Notification Methods**: Support additional notification methods such as email, Slack, etc.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTooonyChen%2FAuthInbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTooonyChen%2FAuthInbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTooonyChen%2FAuthInbox/lists"}