Worldwide universities dataset & enrichment toolkit – instant access to a global list of institutions plus an optional, rate‑limited scraper that augments each with descriptive, academic, and classification metadata via a TypeScript API & CLI.
[](https://github.com/Vaporjawn/universities/actions/workflows/install.js.yml) [](https://github.com/Vaporjawn/universities/actions/workflows/build.js.yml) [](https://github.com/Vaporjawn/universities/actions/workflows/lint.js.yml) [](https://github.com/Vaporjawn/universities/actions/workflows/tests.js.yml) [](https://github.com/Vaporjawn/universities/actions/workflows/securityScan.yml) [](https://github.com/Vaporjawn/universities/network) [](https://github.com/Vaporjawn/universities/stargazers) [](https://github.com/Vaporjawn/universities/graphs/contributors)[](https://github.com/sponsors/Vaporjawn) [](https://github.com/Vaporjawn/universities/watchers) [](https://github.com/Vaporjawn/universities/archive/refs/heads/main.zip) [](https://www.typescriptlang.org/)   universities is an evolving TypeScript/Node.js library and CLI that provides a structured, extensible dataset of the world’s universities along with an enrichment pipeline that (optionally) visits institutional homepages to extract additional metadata.
Core goals:
NOTE: Full automatic enrichment of every university (≈9k+) can take considerable time and should be run thoughtfully to avoid undue load on remote servers. The base dataset works instantly without enrichment.
University, Program, Faculty, ranking + classification enums)list, enrich, statsInstall locally (library usage inside another project):
npm install universities
Or for global CLI usage (optional):
npm install -g universities
After a global install you can invoke the CLI via the universities command (see CLI section below). When using as a dependency, import from the package entry points.
List the first 5 US universities:
universities list --country-code US --limit 5
Search by name fragment:
universities list --name polytechnic --limit 10
Output JSON instead of a table:
universities list --country-code CA --json --limit 3
Enrich a single university (fetch + parse homepage):
universities enrich https://www.mit.edu/
View aggregated stats (counts by type, size, etc.— improves once enriched data exists):
universities stats
import { loadBaseUniversities } from 'universities/dist/data/loadBase';
import { UniversityRepository } from 'universities/dist/repository/UniversityRepository';
async function example() {
const base = await loadBaseUniversities();
const repo = new UniversityRepository(base);
const results = repo.search({ countryCode: 'US', name: 'state', limit: 20 });
console.log(results.slice(0, 3));
console.log(repo.stats());
}
example();
The scraper (
UniversityScraper) is intentionally decoupled and lazily imported in the CLI to avoid pulling ESM‑only dependencies when unnecessary. For programmatic enrichment you can:import { UniversityScraper } from 'universities/dist/scraper/UniversityScraper';
interface University {
id: string; // Stable hash/id generation
name: string;
country: string;
countryCode: string;
alphaTwoCode?: string; // If present in source
webPages: string[]; // One or more homepage URLs
domains: string[]; // Domain(s)
stateProvince?: string;
// Enriched fields (optional until scraping):
description?: string;
motto?: string;
foundingYear?: number;
location?: string;
contact?: { email?: string; phone?: string; address?: string };
programs?: { name: string; degreeLevels?: string[] }[];
faculties?: { name: string; description?: string }[];
social?: { twitter?: string; facebook?: string; instagram?: string; linkedin?: string; youtube?: string };
classification?: { type?: string; degreeLevel?: string[] };
dataQuality?: { score: number; factors: string[] };
enrichedAt?: string; // ISO timestamp when enrichment occurred
}
See the full definitions in src/types/University.ts for exhaustive enum types, search options, stats structure, and classification helpers.
Layered design:
world-universities.csv) – raw dataset.loadBaseUniversities) – parses CSV into partial University objects.types/University.ts) – strongly typed schema + enums + search contracts.UniversityRepository) – in‑memory indexing, filtering, sorting, basic statistics.UniversityScraper) – fetch + parse homepage, extraction heuristics, classification & data quality scoring (rate limited via queue).scripts/enrich.ts) – orchestrates batch scraping with caching to data/cache/*.json and writes aggregated enriched dataset.cli.ts) – user interface for listing, enrichment, and stats.<meta name="description">, first meaningful paragraph, or tagline patterns.Established 18xx|19xx|20xx.The batch enrichment script is optional and can be executed when you purposely want deeper metadata.
npm run build
node dist/scripts/enrich.js --concurrency 3 --resume
Flags (planned / implemented):
| Flag | Description |
|---|---|
--concurrency <n> |
Number of parallel fetches (default modest to prevent overloading sites). |
--resume |
Skip already cached universities (looks in data/cache/). |
--limit <n> |
(Planned) Process only the first N universities for sampling. |
--country-code <CC> |
(Planned) Restrict enrichment to a country subset. |
Outputs:
data/cache/{universityId}.json – per‑university enriched snapshot.data/enriched-universities.json – aggregated enriched dataset (written after run).| Command | Purpose | Key Options |
|---|---|---|
list |
Filter & display base (or partially enriched) universities | --name, --country, --country-code, --limit, --json |
enrich <url> |
Enrich a single university homepage | (none yet; uses internal defaults) |
stats |
Show aggregated statistics | None |
Examples:
universities list --name technology --limit 8
universities list --country-code GB --json --limit 5
universities enrich https://www.stanford.edu/
universities stats
Run unit and integration tests:
npm test
Coverage reports are emitted to coverage/.
We welcome contributions! Suggested steps:
npm install.npm run build & ensure tests pass.npm run lint, npm run format).Please consult (or propose) a CONTRIBUTING.md for evolving guidelines. Ethical scraping considerations and rate limiting are especially important—avoid aggressive concurrency.
| Issue | Cause | Resolution |
|---|---|---|
ERR_REQUIRE_ESM when using CLI list |
ESM‑only dependency (p-queue) pulled into non‑enrichment path |
Resolved via lazy import; update to latest version of package |
| Empty enrichment fields | Site structure variation | Re‑run later or inspect HTML; heuristics will improve over time |
| Slow enrichment run | Network latency / conservative concurrency | Increase --concurrency cautiously |
No secrets are stored. If you identify a security concern (e.g., vulnerable dependency or scraping misuse vector) please open an issue with reproduction details or use private disclosure if sensitive.
This repository is distributed under the terms of the MIT License. See LICENSE for details.
Inspired by the open university datasets community and contributors who maintain baseline CSV resources. Future improvements will strive for transparency, repeatability, and respectful data gathering.
Give a ⭐ if you find this useful and feel free to open issues for ideas or enhancements.
Generated documentation improvements are iterative; feel free to propose edits.
Click on these badges to see how you might be able to help:
npm install
npm start
or
npm run dev
npm test
npm run build
Give a ⭐ to show support for the project.