| 1 | <h1 align="center"> |
| 2 | Ghost |
| 3 | </h1> |
| 4 | |
| 5 | <p align= |
| 6 | |
| 7 |  |
| 8 | |
| 9 | > [!Note] |
| 10 | > This is just an engineering reproduction and should not be trusted with actual data(yet). |
| 11 | |
| 12 | Self-hosted git. Push over HTTP, browse the code, open pull requests, review the |
| 13 | diff, merge. Object storage holds the truth, local disk is a cache. |
| 14 | |
| 15 | ## Screens |
| 16 | |
| 17 | Repository listing. Directories first, last commit per row, branch switcher. |
| 18 | |
| 19 |  |
| 20 | |
| 21 | File view with syntax highlighting and a raw download. |
| 22 | |
| 23 |  |
| 24 | |
| 25 | Commit history for any branch. |
| 26 | |
| 27 |  |
| 28 | |
| 29 | Pull request list, filtered by state. Open count sits on the tab. |
| 30 | |
| 31 |  |
| 32 | |
| 33 | Pull request overview: markdown description, comments, live merge state. Author |
| 34 | or anyone with write access can edit the title and description in place. |
| 35 | |
| 36 |  |
| 37 | |
| 38 | Split diff, computed from the merge base rather than the branch tips. |
| 39 | |
| 40 |  |
| 41 | |
| 42 | ## Features |
| 43 | |
| 44 | - Push and pull over HTTP, authenticated with a personal access token |
| 45 | - Trees, blobs, raw files, branch switching, commit history |
| 46 | - Forks, stars, public and private repositories |
| 47 | - Pull requests across branches and across forks, with a real merge commit |
| 48 | - Comments with markdown, editable title and description |
| 49 | - Issues with comments, timeline events, labels, assignees, search and filters |
| 50 | - GPG-signed commits shown as verified, against keys an account uploads |
| 51 | - Accounts, sessions, organizations, API keys (better-auth) |
| 52 | |
| 53 | Not built yet: webhooks, CI. |
| 54 | |
| 55 | ## Stack |
| 56 | |
| 57 | | Layer | Choice | |
| 58 | | -------- | ----------------------------------------------------- | |
| 59 | | Web | Next.js 16, React 19, Tailwind, shadcn/ui | |
| 60 | | API | NestJS 12, OpenAPI client generated for the web | |
| 61 | | Database | Postgres, Drizzle | |
| 62 | | Storage | S3-compatible bucket (RustFS locally) | |
| 63 | | Runtime | Bun, Turborepo workspace | |
| 64 | |
| 65 | ## Running it |
| 66 | |
| 67 | Needs Bun and Docker. |
| 68 | |
| 69 | ```sh |
| 70 | docker compose up -d # Postgres, RustFS, and the ghost bucket |
| 71 | bun install |
| 72 | cp .env.example .env # set BETTER_AUTH_SECRET, the rest matches compose |
| 73 | bun run db:migrate |
| 74 | bun run dev |
| 75 | ``` |
| 76 | |
| 77 | Web on `http://localhost:3000`, API on `http://localhost:3001`, RustFS console |
| 78 | on `http://localhost:9001`. |
| 79 | |
| 80 | Push an existing repository. The password is a personal access token from |
| 81 | account settings, not the login password. |
| 82 | |
| 83 | ```sh |
| 84 | git remote add origin http://localhost:3001/<username>/<repo |
| 85 | git push -u origin main |
| 86 | ``` |
| 87 | |
| 88 | ## Layout |
| 89 | |
| 90 | ``` |
| 91 | apps/api NestJS API and the git HTTP transport |
| 92 | apps/web Next.js frontend |
| 93 | apps/docs Fumadocs user guide, e.g. how to sign commits (port 3003) |
| 94 | packages/db Drizzle schema and migrations |
| 95 | docs/ Design decisions, one file each |
| 96 | ``` |
| 97 | |
| 98 | ## User guide |
| 99 | |
| 100 | [`apps/docs`](apps/docs) is the guide for people using an instance: what the |
| 101 | Verified badge on a commit means, how to generate a GPG key, add it to an |
| 102 | account, configure git to sign, and what each failure message means. Run it |
| 103 | with `bun run dev` alongside everything else, or on its own: |
| 104 | |
| 105 | ```bash |
| 106 | bun run --filter @ghost/docs dev |
| 107 | ``` |
| 108 | |
| 109 | ## Design decisions |
| 110 | |
| 111 | [`docs/`](docs/README.md) covers why the transport takes streams instead of |
| 112 | `Request`/`Response`, why a push is one compare-and-swap against a write-ahead |
| 113 | log, why materialization is forward-only replay, and why a pull request spans |
| 114 | two logs and lends objects instead of copying them. Each file lists what was |
| 115 | rejected and what it costs. |