basecamp/omarchy

Beautiful, Modern & Opinionated Linux

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 33 minutes ago
Added to GitGenius on September 30th, 2025
Created on June 1st, 2025
Open Issues & Pull Requests: 1,386 (+4)
Number of forks: 2,994
Total Stargazers: 29,587 (+40)
Total Subscribers: 152 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 5.7 hours
Mean response time: 5.2 days
90th percentile: 6.6 days
Tracked items: 2,550

How this project is maintained

Around half of the issues opened in the past year never receive a reply. 95% of open issues come from outside the core team, so the backlog reflects real-world use rather than internal planning. 18% of tracked open issues have had no activity in three months. Only 9% of issues opened in the past year have been closed. Three people close 72% of everything that gets resolved.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 588
New in 7 days: 251
Closed in 7 days: 17
Avg open age: 28 days
Stale 30+ days: 163
Stale 90+ days: 110

Recent activity

Opened in 7 days: 198
Closed in 7 days: 16
Comments in 7 days: 191
Events in 7 days: 396

Top labels

  • bug (1,657)
  • enhancement (260)
  • documentation (30)
  • support (26)
  • sleep (22)
  • help wanted (14)
  • mac (8)
  • device specific (7)

Detailed Description

Omarchy is a Ruby on Rails gem developed by Basecamp, designed to provide a simple yet powerful solution for managing hierarchical data within PostgreSQL databases. It offers an elegant `acts_as_omarchy` ActiveRecord extension, allowing developers to easily model and manipulate tree-like structures such as categories, comments, organizational charts, or file systems. Unlike many other hierarchical solutions that rely on complex nested sets or adjacency lists, Omarchy distinguishes itself by leveraging PostgreSQL's specialized `ltree` data type, promising both simplicity in implementation and high performance for common tree operations.

At its core, Omarchy's efficiency stems from its intelligent use of the `ltree` (label tree) extension available in PostgreSQL. Instead of maintaining multiple columns for parent-child relationships or complex left/right boundaries, Omarchy stores the entire path from the root to any given node in a single `path` column of type `ltree`. This path is represented as a sequence of labels, for example, `root.category1.subcategoryA`. The `ltree` data type comes with a rich set of operators and functions specifically optimized for querying hierarchical data, enabling extremely fast lookups for ancestors, descendants, siblings, and subtrees. This approach effectively combines the readability of a materialized path with the performance benefits of a specialized index, making complex tree traversals remarkably efficient.

Integrating Omarchy into a Rails model is straightforward, requiring just a call to `acts_as_omarchy`. Once configured, the model gains a comprehensive API for interacting with the hierarchy. Developers can easily determine relationships using methods like `root?`, `child?`, `parent?`, `ancestor?`, `descendant?`, and `sibling?`. Navigating the tree is equally simple with accessors such as `root`, `parent`, `children`, `ancestors`, `descendants`, and `siblings`. Beyond querying, Omarchy provides robust methods for manipulating the tree structure. Nodes can be re-parented using `move_to_child_of(parent)`, moved to the top level with `move_to_root`, or even reordered amongst their siblings using `move_to_left_of(sibling)` and `move_to_right_of(sibling)`. The gem also includes a `position` column to maintain a specific order among siblings, which can be re-calculated with `reorder_children!`.

To utilize Omarchy, a few prerequisites must be met. Firstly, it is exclusively designed for PostgreSQL databases, as its functionality is entirely dependent on the `ltree` extension. Therefore, the `ltree` extension must be enabled in the database (`CREATE EXTENSION ltree;`). Secondly, the database table for the hierarchical model needs to include two specific columns: `path` of type `ltree` and `position` of type `integer`. Omarchy provides a convenient migration helper, `t.omarchy`, which automatically adds these columns to the table, simplifying the setup process. The gem ensures that all structural changes, such as moving nodes, are wrapped in database transactions, guaranteeing data integrity.

Omarchy's primary advantages lie in its simplicity, performance, and robust feature set. The reliance on `ltree` makes hierarchical queries exceptionally fast, a critical factor for applications dealing with large or frequently accessed tree structures. Its API is intuitive and consistent with ActiveRecord conventions, reducing the learning curve for Rails developers. The transactional nature of its operations provides peace of mind regarding data consistency. Omarchy is ideally suited for a wide array of applications, including content management systems requiring nested categories or tags, forum software with threaded comments, e-commerce platforms with product hierarchies, or any application needing to represent and manage complex relationships in a clear, efficient, and scalable manner. By abstracting away the complexities of `ltree` and providing a clean Rails interface, Omarchy empowers developers to build sophisticated hierarchical features with minimal effort.