All of Spain’s Laws Live in a Git Repo Now

Someone turned 8,600+ Spanish laws into a Git repository, and it’s one of the most clever uses of version control outside of software development. The project, called Legalize, hit Hacker News this week and quickly gained traction with a score of 176.

Created by developer Enrique Lopez, the repository treats every law as a Markdown file and every legal reform as a Git commit. The result is a complete, searchable history of Spanish legislation dating back to 1960, all pulled from the official open data API of Spain’s Official State Gazette (BOE).

What’s Actually in the Repo

The scope is impressive. The repository covers all consolidated legislation classified as “state-level” from the BOE:

  • 🇪🇸 The Spanish Constitution
  • Organic Laws (Leyes Orgánicas)
  • Ordinary Laws
  • Royal Decree-Laws
  • Royal Legislative Decrees
  • 8,600+ legal documents total

Each file starts with YAML frontmatter containing structured metadata: title, official identifier, country code, legal rank, publication date, last update, current status, and a link to the official source.

Why Git Is a Perfect Fit

This is where the project gets interesting. Every legal reform becomes an independent commit, with the official publication date as the author date. Commit messages include the reform identifier and a link to the official source. That means you can use standard Git commands to do things lawyers and researchers currently struggle with:

  • grep to find specific articles in any law
  • git log to see when a law changed
  • git diff to see the exact text that was added, removed, or modified in any reform

Want to know exactly what changed in Spain’s 2011 budgetary stability reform of Article 135 of the Constitution? That’s a single git diff command. Try doing that on a government website.

Why This Matters Beyond Spain

Legislation tracking is a real problem everywhere. Laws change constantly, and understanding what changed, when, and how is critical for lawyers, journalists, researchers, and citizens. Most government portals show you the current version of a law. Some show you a list of reforms. Almost none give you a clean, machine-readable diff.

Git solves this naturally. It was built for exactly this kind of problem: tracking changes to text documents over time, with full attribution and history. The fact that nobody standardized this approach for legislation years ago says more about the gap between legal and tech communities than about the difficulty of the task.

The project is part of a broader initiative at legalize.dev. Lopez plans to launch a programmatic API that will let developers search, filter, compare versions, and receive notifications when laws change. That API isn’t live yet, but the GitHub repo is fully available right now.

The Fine Print

All legislative content is public domain, sourced from official government databases. The repository structure, metadata, and tooling are MIT-licensed. Lopez is clear that the project adds structure and version control to existing public data, not original content.

The community can also contribute by filing issues when they spot errors in consolidated texts or missing reforms, as long as they reference the official source.

What stands out here is the simplicity. No custom platform, no proprietary format, no subscription required. Just Git doing what Git does best. If this model catches on, there’s no reason it couldn’t be replicated for every country that publishes legislation digitally. The original project and repository details are available through the Hacker News discussion.

Scroll to Top