| 1 | import Link from "next/link"; |
| 2 | import { redirect } |
| 3 | import { |
| 4 | ChartPie, |
| 5 | Code2, |
| 6 | FileCode2, |
| 7 | File, |
| 8 | Folder, |
| 9 | Ghost, |
| 10 | GitBranch, |
| 11 | GitCommitHorizontal, |
| 12 | GitFork, |
| 13 | GitPullRequest, |
| 14 | History, |
| 15 | KeyRound, |
| 16 | Lock, |
| 17 | MessageSquare, |
| 18 | Package, |
| 19 | Star, |
| 20 | Terminal, |
| 21 | Webhook, |
| 22 | } from "lucide-react"; |
| 23 | |
| 24 | import { ThemePicker } |
| 25 | import { Button } |
| 26 | import { Badge } |
| 27 | import { languageColor } |
| 28 | |
| 29 | import { getServerSession } |
| 30 | import { API_URL } |
| 31 | |
| 32 | const FEATURES = [ |
| 33 | { |
| 34 | icon: Terminal, |
| 35 | title: "Push and pull over HTTP", |
| 36 | description: |
| 37 | "A real git remote. Clone, fetch and push with the git you already have - no client, no daemon, no extra port.", |
| 38 | }, |
| 39 | { |
| 40 | icon: GitPullRequest, |
| 41 | title: "Pull requests, reviewed and merged", |
| 42 | description: |
| 43 | "Compare two branches, read the diff file by file, talk it through in the thread, and merge server-side when it is ready.", |
| 44 | }, |
| 45 | { |
| 46 | icon: MessageSquare, |
| 47 | title: "Issues with labels and assignees", |
| 48 | description: |
| 49 | "Threads on a repository, filtered by state, label, author or assignee, with a timeline that records every close, reopen and label change.", |
| 50 | }, |
| 51 | { |
| 52 | icon: FileCode2, |
| 53 | title: "Read your code in the browser", |
| 54 | description: |
| 55 | "Syntax highlighting for 300+ languages, READMEs rendered in every directory, images and PDFs in place, raw downloads for the rest.", |
| 56 | }, |
| 57 | { |
| 58 | icon: History, |
| 59 | title: "Commit context on every row", |
| 60 | description: |
| 61 | "Directory listings show the newest commit touching each entry, indexed up front instead of walked per request.", |
| 62 | }, |
| 63 | { |
| 64 | icon: ChartPie, |
| 65 | title: "Language breakdown", |
| 66 | description: |
| 67 | "Bytes per language, counted from the tree rather than by reading files, so it stays fast on a repository with years of history.", |
| 68 | }, |
| 69 | { |
| 70 | icon: GitFork, |
| 71 | title: "Forks and stars", |
| 72 | description: |
| 73 | "Fork any repository you can read, star the ones worth coming back to, and see who else did from the repository page.", |
| 74 | }, |
| 75 | { |
| 76 | icon: Lock, |
| 77 | title: "Private by choice", |
| 78 | description: |
| 79 | "Public repositories are readable by anyone; private ones stay invisible to everyone but you, over HTTP and the web alike.", |
| 80 | }, |
| 81 | { |
| 82 | icon: Ghost, |
| 83 | title: "Durable by design", |
| 84 | description: |
| 85 | "Every push is appended to a write-ahead log in object storage. Local disk is only a cache, so a repository can be rebuilt wherever it is next needed.", |
| 86 | }, |
| 87 | ]; |
| 88 | |
| 89 | const PREVIEW_ENTRIES = [ |
| 90 | { |
| 91 | type: "tree", |
| 92 | name: "apps", |
| 93 | message: "split the api and the web app", |
| 94 | age: "2 hours ago", |
| 95 | }, |
| 96 | { |
| 97 | type: "tree", |
| 98 | name: "packages", |
| 99 | message: "share the database schema", |
| 100 | age: "2 days ago", |
| 101 | }, |
| 102 | { |
| 103 | type: "blob", |
| 104 | name: "README.md", |
| 105 | message: "explain what this is", |
| 106 | age: "5 days ago", |
| 107 | }, |
| 108 | { |
| 109 | type: "blob", |
| 110 | name: "package.json", |
| 111 | message: "bump the workspace", |
| 112 | age: "last week", |
| 113 | }, |
| 114 | ]; |
| 115 | |
| 116 | const PREVIEW_LANGUAGES = [ |
| 117 | { language: "TypeScript", |
| 118 | { language: "Rust", |
| 119 | { language: "CSS", |
| 120 | { language: "Shell", |
| 121 | ]; |
| 122 | |
| 123 | const FAQ = [ |
| 124 | { |
| 125 | question: "Does it work with the git I already have?", |
| 126 | answer: |
| 127 | "Yes. A Ghost repository is a plain HTTP remote, so clone, fetch, pull and push all work with stock git. There is nothing to install and no plugin to add.", |
| 128 | }, |
| 129 | { |
| 130 | question: "Can repositories be private?", |
| 131 | answer: |
| 132 | "Every repository is public or private, and a private one is invisible to everyone but its owner - over HTTP and in the browser alike. Visibility is checked on the way in, not hidden in the interface.", |
| 133 | }, |
| 134 | { |
| 135 | question: "How do accounts work?", |
| 136 | answer: |
| 137 | "Sign up with an email address and a password, pick a username, and your repositories live under it. That username is the first part of every clone URL.", |
| 138 | }, |
| 139 | { |
| 140 | question: "What happens with large files?", |
| 141 | answer: |
| 142 | "Files past a megabyte are not rendered in the browser, but they download in full at their original size. Git LFS is not supported yet.", |
| 143 | }, |
| 144 | { |
| 145 | question: "Is it ready for a team?", |
| 146 | answer: |
| 147 | "Issues and pull requests are both here: open a request from a branch, read the diff, review it in the thread and merge it from the page. What is still missing for a team is SSH access and webhooks.", |
| 148 | }, |
| 149 | { |
| 150 | question: "Can I fork someone else's repository?", |
| 151 | answer: |
| 152 | "Any repository you can read, yes. The fork keeps its own history from the moment you make it, and the original keeps a link back from its page.", |
| 153 | }, |
| 154 | { |
| 155 | question: "What does it take to run?", |
| 156 | answer: |
| 157 | "An API process, a web app, a PostgreSQL database and an S3-compatible bucket. The bucket holds the write-ahead log that every repository is replayed from; the git directories on disk are a cache you can throw away.", |
| 158 | }, |
| 159 | ]; |
| 160 | |
| 161 | const STEPS = [ |
| 162 | { |
| 163 | title: "Create a repository", |
| 164 | description: |
| 165 | "Name it. Public or private. It exists as a bare repository the moment you press create.", |
| 166 | }, |
| 167 | { |
| 168 | title: "Add it as a remote", |
| 169 | description: |
| 170 | "The repository page hands you the clone URL, ready to paste into the project you already have.", |
| 171 | }, |
| 172 | { |
| 173 | title: "Push", |
| 174 | description: |
| 175 | "Your files, branches and history show up in the browser as soon as the push lands.", |
| 176 | }, |
| 177 | ]; |
| 178 | |
| 179 | const STACK = [ |
| 180 | "Next.js", |
| 181 | "NestJS", |
| 182 | "PostgreSQL", |
| 183 | "Drizzle", |
| 184 | "S3-compatible storage", |
| 185 | ]; |
| 186 | |
| 187 | const ROADMAP = [ |
| 188 | { |
| 189 | icon: KeyRound, |
| 190 | title: "SSH access", |
| 191 | description: |
| 192 | "git over SSH with your own keys, served by a dedicated process rather than bolted onto the API.", |
| 193 | status: "Next", |
| 194 | }, |
| 195 | { |
| 196 | icon: Webhook, |
| 197 | title: "Webhooks", |
| 198 | description: |
| 199 | "Push events posted to a URL you own - the hook every CI runner is waiting for.", |
| 200 | status: "Planned", |
| 201 | }, |
| 202 | { |
| 203 | icon: Package, |
| 204 | title: "Large files", |
| 205 | description: |
| 206 | "Git LFS, so a repository that carries binaries is as ordinary as one that does not.", |
| 207 | status: "Planned", |
| 208 | }, |
| 209 | ]; |
| 210 | |
| 211 | export default async function |
| 212 | const session = |
| 213 | if (session) redirect |
| 214 | |
| 215 | return ( |
| 216 | <div className="flex min-h-full flex-col |
| 217 | <header className="sticky top-0 z-40 border-b bg-background/80 backdrop-blur |
| 218 | <div className="mx-auto flex h-14 w-full max-w-5xl items-center gap-3 px-4 md:px-6 |
| 219 | <span className="flex items-center gap-2 font-semibold tracking-tight |
| 220 | <Ghost className=" |
| 221 | Ghost |
| 222 | </span> |
| 223 | |
| 224 | <div className="ml-auto flex items-center gap-2 |
| 225 | <ThemePicker /> |
| 226 | <Button asChild variant |
| 227 | <Link href=" |
| 228 | </Button> |
| 229 | <Button asChild size |
| 230 | <Link href=" |
| 231 | </Button> |
| 232 | </div> |
| 233 | </div> |
| 234 | </header> |
| 235 | |
| 236 | <main className="mx-auto flex w-full max-w-5xl flex-1 flex-col gap-24 px-4 py-20 md:px-6 |
| 237 | <section className="flex flex-col items-center gap-6 text-center |
| 238 | <Badge variant=" |
| 239 | Self-hosted git, without the weight |
| 240 | </Badge> |
| 241 | |
| 242 | <h1 className="max-w-3xl text-4xl font-semibold tracking-tight text-balance md:text-6xl |
| 243 | Your repositories, on your own machine |
| 244 | </h1> |
| 245 | |
| 246 | <p className="max-w-xl text-lg text-pretty text-muted-foreground |
| 247 | Ghost is a git host you can run yourself. Push over HTTP, read your |
| 248 | code, open issues, review pull requests - and nothing you did not |
| 249 | ask for. |
| 250 | </p> |
| 251 | |
| 252 | <div className="flex flex-wrap justify-center gap-3 |
| 253 | <Button asChild size |
| 254 | <Link href=" |
| 255 | </Button> |
| 256 | <Button asChild size |
| 257 | <Link href=" |
| 258 | </Button> |
| 259 | </div> |
| 260 | |
| 261 | <div className="mt-8 w-full max-w-2xl overflow-hidden rounded-lg border bg-card text-left shadow-sm |
| 262 | <div className="flex items-center gap-2 border-b bg-muted/40 px-4 py-2.5 |
| 263 | <span className="size-2.5 rounded-full bg-destructive/60 |
| 264 | <span className="size-2.5 rounded-full bg-muted-foreground/40 |
| 265 | <span className="size-2.5 rounded-full bg-primary/60 |
| 266 | <span className="ml-2 text-xs text-muted-foreground |
| 267 | push an existing repository |
| 268 | </span> |
| 269 | </div> |
| 270 | |
| 271 | <pre className="overflow-x-auto p-4 font-mono text-sm leading-relaxed |
| 272 | <code> |
| 273 | <span className="text-muted-foreground |
| 274 | git remote add origin {API_URL}/you/project.git{"\n |
| 275 | <span className="text-muted-foreground |
| 276 | git push -u origin main |
| 277 | </code> |
| 278 | </pre> |
| 279 | </div> |
| 280 | </section> |
| 281 | |
| 282 | <section className="flex flex-col gap-8 |
| 283 | <div className="flex flex-col gap-3 text-center |
| 284 | <h2 className="text-3xl font-semibold tracking-tight text-balance |
| 285 | A repository, the way you expect to read one |
| 286 | </h2> |
| 287 | <p className="mx-auto max-w-lg text-pretty text-muted-foreground |
| 288 | Directories first, the latest commit against every row, and the |
| 289 | languages, stars and forks of the repository beside it. |
| 290 | </p> |
| 291 | </div> |
| 292 | |
| 293 | {/* the repository page in miniature, down to the sidebar it now has */ |
| 294 | <div className="flex flex-col gap-4 lg:flex-row lg:items-start |
| 295 | <div className="flex min-w-0 flex-1 flex-col gap-3 |
| 296 | <div className="flex items-center gap-3 |
| 297 | <span className="flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-xs |
| 298 | <GitBranch className=" |
| 299 | main |
| 300 | </span> |
| 301 | <span className="ml-auto flex items-center gap-1.5 rounded-md bg-primary px-2.5 py-1.5 text-xs font-medium text-primary-foreground |
| 302 | <Code2 className=" |
| 303 | Code |
| 304 | </span> |
| 305 | </div> |
| 306 | |
| 307 | <div className="overflow-hidden rounded-lg border bg-card shadow-sm |
| 308 | <div className="flex items-center gap-2 border-b bg-muted/40 px-4 py-2.5 text-sm |
| 309 | <GitCommitHorizontal className=" |
| 310 | <span className="truncate font-medium |
| 311 | serve raw file contents |
| 312 | </span> |
| 313 | <code className="ml-auto shrink-0 text-xs text-muted-foreground |
| 314 | a3f19c2 |
| 315 | </code> |
| 316 | </div> |
| 317 | |
| 318 | <ul className="divide-y |
| 319 | {PREVIEW_ENTRIES.map(( |
| 320 | <li |
| 321 | key={entry.name |
| 322 | className="flex items-center gap-3 px-4 py-2.5 text-sm" |
| 323 | > |
| 324 | {entry.type === |
| 325 | <Folder className=" |
| 326 | ) : ( |
| 327 | <File className=" |
| 328 | )} |
| 329 | <span className="truncate |
| 330 | <span className="ml-auto hidden truncate text-xs text-muted-foreground md:block |
| 331 | {entry.message} |
| 332 | </span> |
| 333 | <span className="w-24 shrink-0 text-right text-xs text-muted-foreground |
| 334 | {entry.age} |
| 335 | </span> |
| 336 | </li> |
| 337 | ))} |
| 338 | </ul> |
| 339 | </div> |
| 340 | </div> |
| 341 | |
| 342 | {/* plain, like the real sidebar: a second card here would read as a |
| 343 | panel bolted onto the listing */} |
| 344 | <aside className="flex w-full flex-col gap-5 lg:w-60 lg:shrink-0 lg:pt-11 |
| 345 | <div className="flex flex-col gap-3 |
| 346 | <h3 className="text-sm font-semibold |
| 347 | <p className="text-sm text-muted-foreground |
| 348 | The project you pushed five minutes ago. |
| 349 | </p> |
| 350 | <div className="flex flex-col gap-2 text-sm text-muted-foreground |
| 351 | <span className="flex items-center gap-2 |
| 352 | <Star className=" |
| 353 | <span className="font-medium text-foreground |
| 354 | stars |
| 355 | </span> |
| 356 | <span className="flex items-center gap-2 |
| 357 | <GitFork className=" |
| 358 | <span className="font-medium text-foreground |
| 359 | forks |
| 360 | </span> |
| 361 | </div> |
| 362 | </div> |
| 363 | |
| 364 | <div className="flex flex-col gap-2 |
| 365 | <h3 className="text-sm font-semibold |
| 366 | <div className="flex h-2 overflow-hidden rounded-full bg-muted |
| 367 | {PREVIEW_LANGUAGES.map(( |
| 368 | <span |
| 369 | key={language} |
| 370 | style={{ |
| 371 | width: `${percent} |
| 372 | backgroundColor: languageColor(language |
| 373 | }} |
| 374 | /> |
| 375 | ))} |
| 376 | </div> |
| 377 | <ul className="flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground |
| 378 | {PREVIEW_LANGUAGES.map(( |
| 379 | <li key={language |
| 380 | <span |
| 381 | aria-hidden |
| 382 | className="size-2 rounded-full" |
| 383 | style={{ backgroundColor: |
| 384 | /> |
| 385 | <span className="font-medium text-foreground |
| 386 | {language} |
| 387 | </span> |
| 388 | {percent.toFixed(1 |
| 389 | </li> |
| 390 | ))} |
| 391 | </ul> |
| 392 | </div> |
| 393 | </aside> |
| 394 | </div> |
| 395 | </section> |
| 396 | |
| 397 | <section className="grid gap-6 sm:grid-cols-2 lg:grid-cols-3 |
| 398 | {FEATURES.map(( |
| 399 | <div |
| 400 | key={title} |
| 401 | className="flex flex-col gap-3 rounded-lg border bg-card p-6" |
| 402 | > |
| 403 | <Icon className=" |
| 404 | <h2 className="font-semibold |
| 405 | <p className="text-sm text-pretty text-muted-foreground |
| 406 | {description} |
| 407 | </p> |
| 408 | </div> |
| 409 | ))} |
| 410 | </section> |
| 411 | |
| 412 | <section className="flex flex-col gap-10 |
| 413 | <div className="flex flex-col gap-3 text-center |
| 414 | <h2 className="text-3xl font-semibold tracking-tight text-balance |
| 415 | Three commands from empty to hosted |
| 416 | </h2> |
| 417 | <p className="mx-auto max-w-md text-pretty text-muted-foreground |
| 418 | No setup wizard, no config file, no CI to configure before the |
| 419 | first push works. |
| 420 | </p> |
| 421 | </div> |
| 422 | |
| 423 | <ol className="grid gap-6 md:grid-cols-3 |
| 424 | {STEPS.map(( |
| 425 | <li key={title |
| 426 | <span className="flex size-8 items-center justify-center rounded-full bg-primary/10 font-mono text-sm font-medium text-primary |
| 427 | {index + 1} |
| 428 | </span> |
| 429 | <h3 className="font-semibold |
| 430 | <p className="text-sm text-pretty text-muted-foreground |
| 431 | {description} |
| 432 | </p> |
| 433 | </li> |
| 434 | ))} |
| 435 | </ol> |
| 436 | |
| 437 | <div className="flex flex-wrap items-center justify-center gap-2 border-t pt-8 |
| 438 | <span className="text-sm text-muted-foreground |
| 439 | {STACK.map(( |
| 440 | <Badge key={ |
| 441 | {item} |
| 442 | </Badge> |
| 443 | ))} |
| 444 | </div> |
| 445 | </section> |
| 446 | |
| 447 | <section className="flex flex-col gap-10 |
| 448 | <div className="flex flex-col gap-3 text-center |
| 449 | <h2 className="text-3xl font-semibold tracking-tight text-balance |
| 450 | What comes next |
| 451 | </h2> |
| 452 | <p className="mx-auto max-w-lg text-pretty text-muted-foreground |
| 453 | Issues, pull requests, forks and stars are done. These are not, |
| 454 | and they are being built in roughly this order. |
| 455 | </p> |
| 456 | </div> |
| 457 | |
| 458 | <ul className="grid gap-4 sm:grid-cols-2 |
| 459 | {ROADMAP.map(( |
| 460 | <li |
| 461 | key={title} |
| 462 | className="flex gap-4 rounded-lg border border-dashed p-6" |
| 463 | > |
| 464 | <Icon className=" |
| 465 | <div className="flex flex-col gap-2 |
| 466 | <div className="flex flex-wrap items-center gap-2 |
| 467 | <h3 className="font-semibold |
| 468 | <Badge |
| 469 | variant={status === |
| 470 | className="rounded-full text-xs" |
| 471 | > |
| 472 | {status} |
| 473 | </Badge> |
| 474 | </div> |
| 475 | <p className="text-sm text-pretty text-muted-foreground |
| 476 | {description} |
| 477 | </p> |
| 478 | </div> |
| 479 | </li> |
| 480 | ))} |
| 481 | </ul> |
| 482 | </section> |
| 483 | |
| 484 | <section className="flex flex-col gap-10 |
| 485 | <h2 className="text-center text-3xl font-semibold tracking-tight text-balance |
| 486 | Questions worth asking first |
| 487 | </h2> |
| 488 | |
| 489 | <div className="grid gap-8 md:grid-cols-2 |
| 490 | {FAQ.map(( |
| 491 | <div key={question |
| 492 | <h3 className="font-semibold |
| 493 | <p className="text-sm text-pretty text-muted-foreground |
| 494 | {answer} |
| 495 | </p> |
| 496 | </div> |
| 497 | ))} |
| 498 | </div> |
| 499 | </section> |
| 500 | |
| 501 | <section className="flex flex-col items-center gap-6 rounded-lg border border-dashed px-6 py-16 text-center |
| 502 | <h2 className="max-w-xl text-3xl font-semibold tracking-tight text-balance |
| 503 | Start with one repository |
| 504 | </h2> |
| 505 | <p className="max-w-md text-pretty text-muted-foreground |
| 506 | Create an account, add a remote, push. Everything else can wait |
| 507 | until you need it. |
| 508 | </p> |
| 509 | <Button asChild size |
| 510 | <Link href=" |
| 511 | </Button> |
| 512 | </section> |
| 513 | </main> |
| 514 | |
| 515 | <footer className="border-t |
| 516 | <div className="mx-auto flex w-full max-w-5xl items-center gap-2 px-4 py-6 text-sm text-muted-foreground md:px-6 |
| 517 | <Ghost className=" |
| 518 | Ghost |
| 519 | <span className="ml-auto |
| 520 | </div> |
| 521 | </footer> |
| 522 | </div> |
| 523 | ); |
| 524 | } |