├── .gitignore ├── LICENSE ├── README.md ├── package-lock.json ├── package.json ├── src ├── data.ts └── index.ts ├── tsconfig.json └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | .npmrc 2 | node 3 | node_modules/ 4 | dist/ 5 | distribution/ 6 | .yarn/ 7 | yarn-error.log -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Dominic Whyte 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Email Enricher: An Offline Clearbit Alternative 2 | 3 | **Email Enricher** is a free, offline alternative to Clearbit for enriching emails. Determine if an email likely belongs to a Fortune 1000 company. 4 | 5 | ## Table of Contents 6 | 7 | - [Installation](#installation) 8 | - [Usage](#usage) 9 | - [How It Works](#how-it-works) 10 | 11 | ## Installation 12 | 13 | To install Email Enricher, use either of the following package managers: 14 | 15 | ### Using Yarn 16 | 17 | ```bash 18 | yarn add email-enricher 19 | ``` 20 | 21 | ### Using npm 22 | 23 | ```bash 24 | npm install email-enricher 25 | ``` 26 | 27 | ## Usage 28 | 29 | Below are examples showing how to obtain enriched information about a company from an email address. 30 | 31 | ### Import the Function 32 | 33 | ```javascript 34 | import { companyFromEmail } from "email-enricher"; 35 | ``` 36 | 37 | ### Basic Usage 38 | 39 | #### Example 1: Amazon 40 | 41 | ```javascript 42 | const amazonInfo = companyFromEmail("jeff@amazon.com"); 43 | console.log(amazonInfo); 44 | ``` 45 | 46 | The output will be: 47 | 48 | ```json 49 | { 50 | "company": "Amazon", 51 | "rank": 2, 52 | "rank_change": 0, 53 | "revenue": 469822, 54 | "profit": 33364, 55 | "num_of_employees": 1608000, 56 | "sector": "Retailing", 57 | "city": "Seattle", 58 | "state": "WA", 59 | "newcomer": "no", 60 | "ceo_founder": "no", 61 | "ceo_woman": "no", 62 | "profitable": "yes", 63 | "prev_rank": 2, 64 | "CEO": "Andrew R. Jassy", 65 | "Website": "www.amazon.com", 66 | "Ticker": "AMZN", 67 | "Market_Cap": 1202717 68 | } 69 | ``` 70 | 71 | #### Example 2: Dropbox 72 | 73 | ```javascript 74 | const dropboxInfo = companyFromEmail("drew@dropbox.com"); 75 | console.log(dropboxInfo); 76 | ``` 77 | 78 | The output will be: 79 | 80 | ```json 81 | { 82 | "company": "Dropbox", 83 | "rank": 988, 84 | "rank_change": 0, 85 | "revenue": 2157.9, 86 | "profit": 335.8, 87 | "num_of_employees": 2667, 88 | "sector": "Technology", 89 | "city": "San Francisco", 90 | "state": "CA", 91 | "newcomer": "no", 92 | "ceo_founder": "yes", 93 | "ceo_woman": "no", 94 | "profitable": "yes", 95 | "prev_rank": "", 96 | "CEO": "Andrew W. Houston", 97 | "Website": "https://www.dropbox.com", 98 | "Ticker": "DBX", 99 | "Market_Cap": 8873.5 100 | } 101 | ``` 102 | 103 | #### Example 3: Unrecognized Email 104 | 105 | ```javascript 106 | const unknownInfo = companyFromEmail("john.smith@fakecompany.com"); 107 | console.log(unknownInfo); // Outputs null 108 | ``` 109 | 110 | ## How It Works 111 | 112 | Email Enricher uses a [data set from Kaggle](https://www.kaggle.com/datasets/winston56/fortune-500-data-2021) that contains information about Fortune 1000 companies. The email address you provide is compared against the URLs of the companies. Note that this is not fool-proof - some companies don't use the same URL for their email domains. 113 | 114 | ## Contributions 115 | 116 | We're very open to contributions! Whether it's adding a better data set, improving the documentation, or adding new features, all forms of contribution are welcome. To get started, simply fork the repository and create a pull request. If you're new to the project and looking for a place to start, check out the open issues. 117 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "email-enricher", 3 | "version": "1.0.0", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "email-enricher", 9 | "version": "1.0.0", 10 | "license": "MIT", 11 | "devDependencies": { 12 | "typescript": "^5.2.2" 13 | } 14 | }, 15 | "node_modules/typescript": { 16 | "version": "5.2.2", 17 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", 18 | "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", 19 | "dev": true, 20 | "bin": { 21 | "tsc": "bin/tsc", 22 | "tsserver": "bin/tsserver" 23 | }, 24 | "engines": { 25 | "node": ">=14.17" 26 | } 27 | } 28 | }, 29 | "dependencies": { 30 | "typescript": { 31 | "version": "5.2.2", 32 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", 33 | "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", 34 | "dev": true 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "email-enricher", 3 | "version": "1.0.2", 4 | "description": "A free, offline alternative to Clearbit for enriching emails. Determine if an email likely belongs to a Fortune 1000 company.", 5 | "main": "dist/index.js", 6 | "scripts": { 7 | "build": "tsc", 8 | "start": "node dist/index.js", 9 | "test": "echo \"Error: no test specified\" && exit 1" 10 | }, 11 | "author": "", 12 | "license": "MIT", 13 | "devDependencies": { 14 | "typescript": "^5.2.2" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { COMPANIES_BY_DOMAIN, CompanyType } from "./data"; 2 | 3 | export const companyFromEmail = (email: string): CompanyType | null => { 4 | const emailDomain = email.trim().split("@")[1]; 5 | const rootDomainParts = emailDomain?.split(".").slice(-2); // This splits the root domain into parts e.g., ["google", "com"] 6 | 7 | const companyName = rootDomainParts?.[0]; // This gets the first part of the root domain (e.g., "google" from ["google", "com"]) 8 | 9 | return COMPANIES_BY_DOMAIN[companyName] || null; 10 | }; 11 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "outDir": "dist", 6 | "strict": true, 7 | "esModuleInterop": true 8 | }, 9 | "include": [ 10 | "src/**/*.ts" 11 | ], 12 | "exclude": [ 13 | "node_modules" 14 | ] 15 | } -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | typescript@^5.2.2: 6 | version "5.2.2" 7 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78" 8 | integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w== 9 | --------------------------------------------------------------------------------