The Stack v1 / v2
The Stack is BigCode's open dataset of source code. Version 1 collects permissively licensed files scraped from GitHub, filtered so that only code under licences such as MIT and Apache is included. Duplicate and near-duplicate files are removed, so you are not storing the same snippet many times over.
Version 2 is a step up in scale. It uses Software Heritage, a long-term archive of public code, as its source and spans 600+ programming languages. Both versions are published on Hugging Face as Parquet files, and you can stream them or download them in full.
For RAG, The Stack is useful as a retrieval corpus for code assistants and as pretraining data for code models such as StarCoder. Because it tracks the original repository licences, it is a safer starting point than a raw GitHub scrape if you care about the terms attached to the code you index.
Related sources
DevDocs
An open-source aggregator that pulls API documentation for major programming languages, frameworks, and tools into one searchable place. A tidy RAG source when you want up-to-date developer reference material without scraping dozens of separate documentation sites yourself.
GitHub Public Repositories (GH Archive / GHTorrent)
Two projects that capture public GitHub activity for analysis. GH Archive records the public GitHub event timeline as downloadable hourly archives, and GHTorrent offers a queryable mirror of GitHub metadata. Together they help you mine code, issues, pull requests, and documentation at scale.
Stack Exchange Data Dump
Periodic XML dumps of every site in the Stack Exchange network, including Stack Overflow. Each dump holds questions, answers, comments, votes, and user profiles. One of the richest question-and-answer datasets you can freely download, and a natural fit for building technical support and developer RAG systems.