Skip to content
Back to search

Granary-ERP

The open-source, self-hosted ERP that thinks alongside your team: CRM, sales, finance, HR, inventory and more, with an AI assistant built into every workflow. Rust + Next.js.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/halogass--granary-erp/badge.svg)](/listings/halogass--granary-erp)

HTML

<a href="/listings/halogass--granary-erp"><img src="/api/listings/halogass--granary-erp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

You need Docker with the Compose plugin. Building the Rust images needs about 8 GB of RAM and 10 GB of disk.

git clone <your-repo-url> granary
cd granary
cp .env.example .env

Edit `.env` and replace every value marked `← CHANGE THIS`. Make each secret its own random value (`openssl rand -hex 32`). Compose refuses to start without `REDIS_PASSWORD`, `NEXTAUTH_SECRET` and `SIGNAL_TICKET_KEY`; `REDIS_URL` and `CELERY_BROKER_URL` must carry the Redis password, and `DATABASE_URL` must carry `POSTGRES_PASSWORD`. To try Granary on your own machine without Nginx, also set:

APP_URL=http://localhost:3000
SIGNAL_URL=ws://localhost:3003
CORS_ORIGINS=["http://localhost:3000"]
MINIO_PUBLIC_URL=http://localhost:9000

Then start it. Compose downloads the prebuilt images of the release in `GRANARY_VERSION` (`ghcr.io/halogass/granary-*`, x86-64); `docker compose build` compiles them from source instead:

docker compose up -d
docker compose logs -f backend      # wait for "listening"

On every start the backend runs `granary-migrate` (pending migrations), then `granary-seed` (default data that is missing; it never overwrites your edits), then `granary-api`. Open `http://localhost:3000`. In production, Nginx on the host proxies the frontend and the API (see [Deployment](docs/DEPLOYMENT.md)).

| Service | Purpose | Host port | |---|---|---| | `frontend` | Next.js | 127.0.0.1:3000 | | `backend` | `granary-api` | 127.0.0.1:8000 | | `worker`, `beat` | Background jobs and their schedule (same image as `backend`) | none | | `db`, `redis` | PostgreSQL + pgvector, Redis | none | | `storage` | Object storage (SeaweedFS, S3 API) | 127.0.0.1:9000 | | `pdf`, `face`, `research`, `searxng`, `stt` | Sidecars | none | | `signal` | WebRTC signalling | 127.0.0.1:3003 | | `coturn` | TURN/STUN for video calls | host network |

First sign-in

The seed creates one superadmin on the first start, from these `.env` values:

SUPERADMIN_EMAIL=owner@example.com
SUPERADMIN_NAME=Robert Smith
SUPERADMIN_PASSWORD=change-this-strong-password-immediately

Sign in with that email and password, then change the password. The superadmin is created only while none exists, so changing these values later has no effect.

Before going live

- **Company profile.** Settings → Company & branding: legal name, address, tax ID, registration number, signatory, logo and letterhead. They appear on every document you send. Set the time zone and date format under Regional in the same area. - **Functional currency.** Settings → Money & tax → Currencies. It defaults to USD and can't be changed once journal entries are posted. - **Approval limits.** Settings → Approvals & signing → Approval policies. The amount limits in the shipped policies are in the functional currency and are sized for a currency like JPY (a purchase order above 5,000,000 goes to the Owner, for example). Adjust every limit for your base currency before anyone submits a document. - **Tax and payroll.** Add the taxes you charge and withhold in Finance → Taxes (none are seeded). Set payroll contributions, income tax and overtime in Settings → People & payroll. Payroll refuses to run while they are empty or malformed. - **CRM inboxes.** Settings → Email & WhatsApp: the system email account and at least one CRM inbox (SMTP and IMAP). Quotations, invoices and campaigns are sent through them. - **Secrets in Settings.** AI provider keys (Settings → Nary & AI → Providers & keys), mail passwords, the ExchangeRate-API key and the GitLab token are stored encrypted in the database, not in `.env`. When the API and the worker start, they log every secret (in `.env` or in Settings) that still holds a placeholder value and notify the Owner; `JWT_SECRET_KEY`, `APP_SECRET_KEY` and `NEXTAUTH_SECRET` must not hold a placeholder at all (the API refuses to start).

[Configuration](docs/CONFIGURATION.md) walks through every setting.

---

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 231 lines
  1. <p align="center">
  2. <img src="docs/images/brand/granary-banner.png" alt="Granary: the open-source ERP that thinks alongside your team" width="100%">
  3. </p>
  4. <p align="center">
  5. <a href="https://github.com/halogass/Granary-ERP/actions/workflows/ci.yml"><img src="https://github.com/halogass/Granary-ERP/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
  6. <a href="#licence"><img src="https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-blue" alt="License: MIT OR Apache-2.0"></a>
  7. <img src="https://img.shields.io/badge/backend-Rust-dea584?logo=rust&logoColor=white" alt="Backend: Rust">
  8. <img src="https://img.shields.io/badge/frontend-Next.js-000000?logo=nextdotjs&logoColor=white" alt="Frontend: Next.js">
  9. <img src="https://img.shields.io/badge/self--hosted-Docker%20Compose-2496ED?logo=docker&logoColor=white" alt="Self-hosted with Docker Compose">
  10. <img src="https://img.shields.io/badge/AI-bring%20your%20own%20model-7c3aed" alt="AI: bring your own model">
  11. </p>
  12. <p align="center">
  13. <a href="https://granary-demo.pages.dev"><b>Live demo</b></a> ·
  14. <a href="https://github.com/halogass/Granary-ERP/wiki"><b>Wiki</b></a> ·
  15. <a href="https://github.com/halogass/Granary-ERP/wiki/Installation">Install</a> ·
  16. <a href="https://github.com/halogass/Granary-ERP/wiki/First-Steps">First steps</a> ·
  17. <a href="https://github.com/halogass/Granary-ERP/wiki/AI-Across-Granary">AI across Granary</a> ·
  18. <a href="https://github.com/halogass/Granary-ERP/discussions">Discussions</a> ·
  19. <a href="CONTRIBUTING.md">Contributing</a> ·
  20. <a href="SECURITY.md">Security</a>
  21. </p>
  22. <p align="center">
  23. <a href="https://github.com/halogass/Granary-ERP/releases/download/v1.0.2/granary-launch.mp4">
  24. <img src="docs/images/brand/granary-launch-preview.gif" alt="Granary in action: Nary drafts an email reply and a quotation priced from the price list, and a person applies it" width="100%">
  25. </a>
  26. <br><sub>▶ <a href="https://github.com/halogass/Granary-ERP/releases/download/v1.0.2/granary-launch.mp4">Watch the 1-minute launch video</a></sub>
  27. </p>
  28. > **Try it in your browser:** [granary-demo.pages.dev](https://granary-demo.pages.dev) is an interactive demo with
  29. > sample data. Click through every module and apply Nary's cards. Nothing is saved, and the AI chat gives a scripted
  30. > answer there; install Granary to use your own AI model.
  31. Granary is a free, self-hosted ERP for small and mid-sized companies, with an AI assistant, **Nary**, built into its
  32. business processes rather than bolted on. Nary scores and researches your leads, drafts replies, quotations and
  33. proposals, reads the attachments customers send, follows up on quotations, prepares invoices and project kickoffs,
  34. and answers questions from your own SOPs and records. **Every action that commits the company (a message to a
  35. customer, a price, an invoice, a merge) comes to a person as a card to approve first.**
  36. One web application covers CRM and sales, finance, HR and payroll, projects, manufacturing and inventory,
  37. procurement, partners, marketing, messaging and video calls. The backend is Rust, the frontend Next.js, and the
  38. whole stack runs with Docker Compose on one server. Bring your own AI provider (Anthropic, OpenAI or any
  39. OpenAI-compatible API, Gemini, DeepSeek, or a local model through Ollama), or connect your own AI client over MCP.
  40. <p align="center">
  41. <img src="docs/images/nary-approval-cards.png" alt="Nary's approval cards: a quotation drafted from a customer conversation and an email reply, each waiting for a person to apply it" width="100%">
  42. <br><sub>Nary's work arrives as cards: here a quotation drafted from a customer conversation and an email reply, waiting for a person to apply them.</sub>
  43. </p>
  44. ---
  45. ## AI across the ERP
  46. | Where | What Nary does |
  47. |---|---|
  48. | CRM | Scores leads (hot, warm, cold, with reasons and a next step), writes an AI brief of any record, enriches new organizations, researches companies and people on the web, finds duplicates, keeps deal notes (fit, negotiation hints, follow-up cadence) |
  49. | Inboxes | Triages incoming email and WhatsApp, takes in new leads from web forms, drafts replies, reads PDFs and images, transcribes voice notes on your own server |
  50. | Sales | Drafts quotations from a conversation (priced by your price lists and rules), drafts proposals with figures and a cost sheet, follows up on sent quotations, drafts the contract and the down-payment proforma when a customer accepts |
  51. | Finance and projects | Lists overdue invoices, summarizes revenue, drafts proformas and invoices, hands a won deal to delivery with a kickoff plan |
  52. | Knowledge | Answers from your published SOPs with citations, turns a PDF into an article, drafts SOP revisions, keeps an AI-only knowledge library |
  53. | Your own AI client | The same tools over MCP, signed in as a person and limited to that person's permissions |
  54. Nary's tools run with the signed-in person's permissions. Proposed changes arrive as cards you **Apply**, edit or
  55. dismiss, and you decide which kinds of action may later run on their own. The full map, including which actions
  56. save directly, is in [AI Across Granary](https://github.com/halogass/Granary-ERP/wiki/AI-Across-Granary).
  57. ---
  58. ## Modules
  59. | Area | What it covers |
  60. |---|---|
  61. | CRM | Leads, contacts, organizations, deals and pipeline, activities, custom attributes, filtered search, duplicate detection and merge, follow-up reminders, AI enrichment and web research |
  62. | CRM inboxes | Shared email inboxes (IMAP/SMTP, Sent folder and read status mirrored with the mail server), scheduled sends, a WhatsApp inbox (needs a WhatsApp bridge you provide, see below) |
  63. | Sales | Quotations with revisions, optional lines, notes templates and pricing rules; proposals; contracts; product catalog with price lists; quotation to invoice |
  64. | Approvals and documents | Approval policies per document type, approval stamped on the PDF, a verification QR on every page (`/v/<token>`), PAdES-sealed e-signature for contracts and offer letters, sending documents by email |
  65. | Finance | Invoices and proformas with per-line discount and tax, credit notes, refunds, payments, bank accounts and reconciliation, chart of accounts, journal, automatic GL posting, fiscal periods, reports, expenses, schedules, taxes and withholding tax, fixed assets, budgets |
  66. | Multi-currency | USD, EUR, GBP, JPY, SGD, AUD and CNY; FX rates from ExchangeRate-API or entered by hand; FX gain and loss in the ledger; a missing rate is refused, never treated as 1.0 |
  67. | HR | Employees, attendance, leave, payroll with configurable contributions and progressive income tax, overtime, recruiting and hiring, offer letters, org chart |
  68. | Face clock-in | Self-hosted face matching with liveness checks, GPS geofence, registered kiosk tablets |
  69. | Projects | Projects, tasks, time logs, comments and activity feed |
  70. | Manufacturing and inventory | Products, bills of materials, production orders, QC, warehouses, transfers, unit serials, warranty |
  71. | Operations | Fleet, maintenance, helpdesk |
  72. | Procurement | Vendors, contractor requests, RFQs, purchase orders, goods receipts, three-way match, work orders, vendor invoices with withholding tax, vendor portal |
  73. | Partners | Partner accounts, deal registration, leads, commissions, MDF, resources and training, partner portal |
  74. | Marketing | Campaigns, content calendar, email campaigns with a signature footer, one-click unsubscribe and preview |
  75. | Knowledge | Markdown articles and SOPs with draft revisions and approval, a document library with versions and download watermarks, PDF import |
  76. | R&D | Product lines, projects, backlog, two-way GitLab issue sync |
  77. | Collaboration | Channels, threads, reactions, mentions and file uploads (WebSocket + Redis), a personal email client (per-user IMAP/SMTP), WebRTC video calls with TURN, guest join and recording |
  78. | Administration | Users, roles and permissions, portal users, two-factor sign-in, settings for every business rule |
  79. Business numbers (tax rates, payroll contributions and wage caps, income tax brackets, approval limits, reminder
  80. schedules, currency decimals) are settings edited in the UI, not code. A missing value makes the action fail
  81. with an error that names the setting.
  82. ---
  83. ## Stack
  84. | Layer | Technology |
  85. |---|---|
  86. | Frontend | Next.js 14 (App Router, TypeScript), Tailwind CSS, NextAuth v4, PWA |
  87. | Backend | Rust (axum, sqlx, tokio) in `rust-version/`: `granary-api` (HTTP API), `granary-worker` (background jobs and their schedule), `granary-migrate` and `granary-seed` |
  88. | Sidecars | Rust services for PDF rendering (Chromium), face matching (ONNX Runtime), WebRTC signalling and web research; a Python speech-to-text service (faster-whisper) in `services/stt` |
  89. | Data | PostgreSQL 16 with pgvector, Redis 7, SeaweedFS (S3-compatible object storage) |
  90. | Other | SearXNG (self-hosted search), coturn (TURN/STUN), Nginx on the host as the reverse proxy |
  91. More in [Architecture](docs/ARCHITECTURE.md).
  92. ---
  93. ## Quick start
  94. You need Docker with the Compose plugin. Building the Rust images needs about 8 GB of RAM and 10 GB of disk.
  95. ```bash
  96. git clone <your-repo-url> granary
  97. cd granary
  98. cp .env.example .env
  99. ```
  100. Edit `.env` and replace every value marked `← CHANGE THIS`. Make each secret its own random value
  101. (`openssl rand -hex 32`). Compose refuses to start without `REDIS_PASSWORD`, `NEXTAUTH_SECRET` and
  102. `SIGNAL_TICKET_KEY`; `REDIS_URL` and `CELERY_BROKER_URL` must carry the Redis password, and `DATABASE_URL` must
  103. carry `POSTGRES_PASSWORD`. To try Granary on your own machine without Nginx, also set:
  104. ```dotenv
  105. APP_URL=http://localhost:3000
  106. SIGNAL_URL=ws://localhost:3003
  107. CORS_ORIGINS=["http://localhost:3000"]
  108. MINIO_PUBLIC_URL=http://localhost:9000
  109. ```
  110. Then start it. Compose downloads the prebuilt images of the release in `GRANARY_VERSION`
  111. (`ghcr.io/halogass/granary-*`, x86-64); `docker compose build` compiles them from source instead:
  112. ```bash
  113. docker compose up -d
  114. docker compose logs -f backend # wait for "listening"
  115. ```
  116. On every start the backend runs `granary-migrate` (pending migrations), then `granary-seed` (default data that is
  117. missing; it never overwrites your edits), then `granary-api`. Open `http://localhost:3000`. In production, Nginx
  118. on the host proxies the frontend and the API (see [Deployment](docs/DEPLOYMENT.md)).
  119. | Service | Purpose | Host port |
  120. |---|---|---|
  121. | `frontend` | Next.js | 127.0.0.1:3000 |
  122. | `backend` | `granary-api` | 127.0.0.1:8000 |
  123. | `worker`, `beat` | Background jobs and their schedule (same image as `backend`) | none |
  124. | `db`, `redis` | PostgreSQL + pgvector, Redis | none |
  125. | `storage` | Object storage (SeaweedFS, S3 API) | 127.0.0.1:9000 |
  126. | `pdf`, `face`, `research`, `searxng`, `stt` | Sidecars | none |
  127. | `signal` | WebRTC signalling | 127.0.0.1:3003 |
  128. | `coturn` | TURN/STUN for video calls | host network |
  129. ### First sign-in
  130. The seed creates one superadmin on the first start, from these `.env` values:
  131. ```dotenv
  132. SUPERADMIN_EMAIL=owner@example.com
  133. SUPERADMIN_NAME=Robert Smith
  134. SUPERADMIN_PASSWORD=change-this-strong-password-immediately
  135. ```
  136. Sign in with that email and password, then change the password. The superadmin is created only while none
  137. exists, so changing these values later has no effect.
  138. ### Before going live
  139. - **Company profile.** Settings → Company & branding: legal name, address, tax ID, registration number,
  140. signatory, logo and letterhead. They appear on every document you send. Set the time zone and date format
  141. under Regional in the same area.
  142. - **Functional currency.** Settings → Money & tax → Currencies. It defaults to USD and can't be changed once
  143. journal entries are posted.
  144. - **Approval limits.** Settings → Approvals & signing → Approval policies. The amount limits in the shipped
  145. policies are in the functional currency and are sized for a currency like JPY (a purchase order above
  146. 5,000,000 goes to the Owner, for example). Adjust every limit for your base currency before anyone submits a
  147. document.
  148. - **Tax and payroll.** Add the taxes you charge and withhold in Finance → Taxes (none are seeded). Set payroll
  149. contributions, income tax and overtime in Settings → People & payroll. Payroll refuses to run while they are
  150. empty or malformed.
  151. - **CRM inboxes.** Settings → Email & WhatsApp: the system email account and at least one CRM inbox (SMTP and
  152. IMAP). Quotations, invoices and campaigns are sent through them.
  153. - **Secrets in Settings.** AI provider keys (Settings → Nary & AI → Providers & keys), mail passwords, the
  154. ExchangeRate-API key and the GitLab token are stored encrypted in the database, not in `.env`. When the API
  155. and the worker start, they log every secret (in `.env` or in Settings) that still holds a placeholder value
  156. and notify the Owner; `JWT_SECRET_KEY`, `APP_SECRET_KEY` and `NEXTAUTH_SECRET` must not hold a placeholder at all
  157. (the API refuses to start).
  158. [Configuration](docs/CONFIGURATION.md) walks through every setting.
  159. ---
  160. ## AI providers, MCP and WhatsApp
  161. **Providers.** Anthropic, OpenAI and OpenAI-compatible endpoints, Gemini, DeepSeek and Ollama, chosen per job in
  162. Settings → Nary & AI, with a cheap model first, a monthly budget cap and keys stored encrypted in the database.
  163. **MCP.** The same tools are available to your AI client at `/api/v1/mcp` (JSON-RPC over HTTP). A connection signs
  164. in with a personal access token (Settings → Integrations & access → MCP access) or a browser login, acts as that
  165. person with their permissions, and is narrowed further by its level: read, propose or act.
  166. **WhatsApp.** Granary does not ship a WhatsApp Web bridge. The WhatsApp inbox and Nary's WhatsApp channel talk
  167. to an HTTP service at `WHATSAPP_SERVICE_URL`; without one they stay disconnected and the rest of Granary works.
  168. ---
  169. ## Documentation
  170. | Guide | Contents |
  171. |---|---|
  172. | [Wiki](https://github.com/halogass/Granary-ERP/wiki) | Installation, first steps, a guide to every module, AI across Granary, administration, developer guide |
  173. | [Architecture](docs/ARCHITECTURE.md) | Services, request routing, auth, AI, documents, money and ledger, background jobs, source layout |
  174. | [Deployment](docs/DEPLOYMENT.md) | Server setup, environment, Nginx (LAN, Cloudflare Tunnel, Let's Encrypt), upgrades |
  175. | [Configuration](docs/CONFIGURATION.md) | Every setting after the first sign-in, and the environment variables |
  176. | [Maintenance](docs/MAINTENANCE.md) | Backups, updates, background jobs, logs, database checks |
  177. | [Troubleshooting](docs/TROUBLESHOOTING.md) | Common problems and fixes |
  178. | [Contributing](CONTRIBUTING.md) | Development setup, tests, checks |
  179. | [Security](SECURITY.md) | Reporting a vulnerability |
  180. ---
  181. ## Licence
  182. Granary is dual-licensed under the [MIT License](LICENSE-MIT) or the [Apache License, Version 2.0](LICENSE-APACHE),
  183. at your option. Contributions are accepted under the same terms. Third-party components keep their own
  184. licences; see [NOTICE](NOTICE).

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.