Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["web", "@pigo/api", "@pigo/typescript-config"]
"ignore": ["web", "@pigo/typescript-config"]
}
4 changes: 4 additions & 0 deletions .changeset/nervous-cars-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

Move the Go modules onto Turborepo's experimental Go workspace support. Build tooling only; no change to the published library.
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ A minimal-dependency, minimal-configuration image optimizer with a Go API backen
- **Go API backend**: A REST server built on the standard library's JPEG and PNG codecs, with Catmull-Rom interpolation for resizing.
- **Next.js frontend**: Drag-and-drop uploads, clipboard paste, ZIP downloads, and a before/after comparison slider.
- **Zero heavy runtime dependencies**: The backend builds and runs without C libraries, GraphicsMagick, or libvips.
- **Turborepo monorepo**: Bun workspaces handle builds and package management.
- **Turborepo monorepo**: Bun workspaces and `go.work` modules share one task graph and one cache.

## Tech stack

- **Backend**: Go (1.26+), [`chi`](https://github.com/go-chi/chi) router, `golang.org/x/image/draw`
- **Frontend**: Next.js (16.3+), React 19, Tailwind CSS v4, Lucide Icons, JSZip
- **Tooling**: Bun, Turborepo, [Ultracite](https://github.com/PunGrumpy/ultracite) (Oxlint + Oxfmt), Air (Go hot-reloading)
- **Tooling**: Bun, Turborepo (with experimental Go workspace support), [Ultracite](https://github.com/PunGrumpy/ultracite) (Oxlint + Oxfmt)

## Project structure

Two apps and two shared packages, split across a Bun workspace and a Go workspace:

```text
pigo/
├── apps/
Expand All @@ -28,9 +30,21 @@ pigo/
├── packages/
│ ├── core/ # Go image decoding, encoding, and resizing
│ └── typescript-config/ # Shared TypeScript configs
└── package.json # Workspace configuration
├── go.work # Go workspace; its members are Turborepo packages
└── package.json # Bun workspace configuration
```

The Go modules (`apps/api`, `packages/core`) have no `package.json`. Turborepo reads them from `go.work` and derives their tasks, so you target a module by its directory or by its module path:

```bash
turbo run build --filter=./apps/api
turbo run build --filter=github.com/PunGrumpy/pigo/apps/api
```

`turbo run test` and `turbo run lint` cover every Go module in one pass, through a package Turborepo names `go-workspace`. Filtering to a single module runs `go test ./...` inside that module instead.

Vercel builds both apps without `turbo`. The flag makes Turborepo shell out to `go work edit -json` on every invocation, so a Next.js build image with no Go toolchain can no longer run it. Each app's `vercel.json` sets an explicit `buildCommand` that skips Turborepo, and the Go one writes to `$VERCEL_OUTPUT_FILE` so the platform finds the binary wherever the build runs from.

## Getting started

### Prerequisites
Expand All @@ -39,7 +53,6 @@ Make sure you have the following installed:

- [Go](https://go.dev/doc/install) (1.26 or later)
- [Bun](https://bun.sh) (1.3.14 or later)
- [Air](https://github.com/air-verse/air), optional, for API hot-reloading

### Installation

Expand Down
15 changes: 0 additions & 15 deletions apps/api/package.json

This file was deleted.

36 changes: 0 additions & 36 deletions apps/api/turbo.json

This file was deleted.

1 change: 1 addition & 0 deletions apps/api/vercel.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"framework": "go",
"buildCommand": "go build -o \"$VERCEL_OUTPUT_FILE\" github.com/PunGrumpy/pigo/apps/api",
"redirects": [
{
"source": "/",
Expand Down
5 changes: 5 additions & 0 deletions apps/web/vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"framework": "nextjs",
"buildCommand": "bun run --filter web build"
}
24 changes: 8 additions & 16 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"dev": "turbo run dev",
"typecheck": "turbo run typecheck",
"test": "turbo run test",
"check": "turbo run check && ultracite check",
"fix": "turbo run fix && ultracite fix",
"check": "turbo run lint && ultracite check",
"fix": "turbo run format && ultracite fix",
"changeset": "changeset",
"changeset:version": "changeset version",
"changeset:publish": "turbo run build && changeset publish",
Expand All @@ -26,7 +26,7 @@
"oxfmt": "^0.62.0",
"oxlint": "^1.77.0",
"react-doctor": "^0.9.5",
"turbo": "^2.10.8",
"turbo": "^2.10.13",
"typescript": "^7.0.2",
"ultracite": "7.10.1"
},
Expand Down
8 changes: 1 addition & 7 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,5 @@
"name": "@pigo/core",
"version": "0.1.1",
"private": true,
"description": "Core image processing library for Pigo",
"type": "module",
"scripts": {
"test": "go test ./...",
"check": "go vet ./...",
"typecheck": "go vet ./..."
}
"description": "Core image processing library for Pigo"
}
20 changes: 13 additions & 7 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"$schema": "https://turbo.build/schema.json",
"futureFlags": {
"experimentalGoWorkspaces": true,
"experimentalTaskCommand": true
},
"ui": "tui",
"envMode": "loose",
"tasks": {
Expand All @@ -11,7 +15,7 @@
"VERCEL",
"VERCEL_ENV"
],
"outputs": ["bin/**", "dist/**", ".next/**", "!.next/cache/**"]
"outputs": ["dist/**", ".next/**", "!.next/cache/**"]
},
"dev": {
"cache": false,
Expand All @@ -21,16 +25,18 @@
"dependsOn": ["^build"],
"outputs": []
},
"check": {
"cache": false,
"test": {
"outputs": []
},
"fix": {
"cache": false,
"lint": {
"outputs": []
},
"test": {
"outputs": []
"format": {
"cache": false,
"outputs": [],
"command": {
"go": ["gofmt", "-l", "-w", "."]
}
}
}
}
Loading