$ show hashicorp-forge/hermes
Hermes is an open-source document management system developed by HashiCorp for creating, reviewing, approving, and publishing internal technical documents (RFCs, PRDs, FRDs). It provides a full-stack application with a Go REST API backend, an Ember.js web frontend, and a Microsoft Word add-in (React/Fluent UI) for editing document metadata directly in documents. The system supports dual content backends: Google Workspace (Drive, Docs, People API) and Microsoft SharePoint/Microsoft Graph, with file storage, permission management, and email notifications. Search is powered by Algolia with faceted filtering, and persistent storage uses PostgreSQL via GORM, though the architecture is in transition from Algolia as the primary data store to PostgreSQL. Authentication supports Google OAuth, Microsoft OAuth, and AWS ALB OIDC/Okta. The API exposes REST endpoints under `/api/v1/` and `/api/v2/` for documents, drafts, approvals, reviews, projects, people, products, and subscriptions. Key background processes include a document indexer that synchronizes file metadata to Algolia and a migration command to move data from Algolia to PostgreSQL. The Ember frontend provides a dashboard, document browsing with advanced search, project management, and settings. The Office add-in enables users to manage related resources, update document status, and edit custom fields without leaving Word. Externally, Hermes depends on Google Workspace APIs, Microsoft Graph API, Algolia, PostgreSQL, and optionally Datadog for tracing and Google Analytics for frontend metrics. It is configured via HCL files and environment variables, with Docker and Docker Compose support for local development. The project is in alpha stage and not an official HashiCorp product, but it is actively developed with CI/CD pipelines, extensive unit/integration tests (Go, Ember QUnit), and a comprehensive test harness using Mirage for the frontend.
The LLM identified 7 files worth highlighting for reuse:
Central document abstraction that converts between Algolia objects, database models, and the internal Document struct. Provides `NewFromAlgoliaObject`, `NewFromDatabaseModel`, and `ToAlgoliaObject` methods, enabling clean separation between search and persistence layers. This module is isolated (no imports of internal packages) and can be reused in any Go project needing a document model with multiple representations.
Directly manipulates DOCX files (ZIP archives) to insert header tables and update core properties without relying on Microsoft Graph APIs. Contains functions like `UpdateDocxHeaderTable`, `generateTableRow`, and `generateStatusXML` that build XML for Word tables. This is a non-trivial pattern for programmatically editing Word documents and can be extracted for any project needing to generate or modify DOCX content server-side.
Contains `CompareAlgoliaAndDatabaseDocument`, a function that logs detailed differences between a document's Algolia object and its database model. Used in approval and mutation handlers to detect drift. Also includes reusable helpers like `decodeRequest` (strict JSON decoding with error wrapping) and `parseResourceIDFromURL`. The comparison function is generic enough to be adapted for any dual-storage validation scenario.
Implements exponential backoff with jitter for Google Workspace API calls using the `cenkalti/backoff` library. Provides a `Backoff` function with configurable initial interval and max elapsed time, used across Drive, Docs, and People API calls. This is a clean, reusable resilience pattern that can be extracted for any external API interaction that needs retry logic.
A generic dropdown list component built on Floating UI, supporting checkable items, actions, links, and toggle buttons. It handles keyboard navigation, positioning, and async item loading. This is a high-quality, self-contained UI primitive that could be reused in any Ember project or even extracted to a standalone addon.
The background document indexer service implemented with functional options (`WithAlgoliaClient`, `WithDatabase`, etc.) for dependency injection. It polls folder timestamps, processes modified documents, extracts text (capped at 85KB), and indexes to Algolia. The design supports both Google Workspace and SharePoint backends through a common interface. The functional options pattern and clean separation of concerns make this a reusable template for building background indexing services in Go.
TypeScript service for the Word add-in that handles document header formatting: detecting edit mode, building header tables with status badges, setting document properties, and generating hyperlinks. Uses Office.js APIs extensively and demonstrates a non-obvious pattern for programmatically inserting formatted tables into Word documents from a task pane. Isolated enough to be reused in other Office add-in projects.