A Go and React project

One small product, built the way a two-person team would build it: a Go service that keeps notes in SQLite and speaks JSON, and a React frontend that Vite compiles to three static files. In development the two run on different ports and talk through a proxy; in production the built frontend is embedded in the Go binary and the whole product is one file.

The Go side was written, built, run and tested in this container, and the outputs on the pages are those runs. The frontend was built in the node:22-bookworm Docker image with Node v22.23.3 and npm 10.9.9: npm install and npm run build ran there, the bundle is on the frontend page, and its output is the real one. The Dockerfile that would package both is a sketch and is marked as not built.

API The Go backend The router, the SQLite and in-memory stores, CORS, the handlers with their status codes, and the tests, all built and run here. Open API The React frontend Vite, React and TypeScript sources, the dev proxy, and the npm build output with the versions it used. Open API Embed and deploy The built frontend inside the Go binary with go:embed, a file server that falls back to index.html, and the steps the host completes. Open

The layout

notesweb/
go.mod
go.sum
cmd/server/main.go
internal/notes/store.go
internal/notes/handlers.go
internal/notes/handlers_test.go
internal/notes/memory_test.go
web/embed.go
web/dist/ (the built frontend, embedded)
frontend/package.json
frontend/vite.config.ts
frontend/tsconfig.json
frontend/index.html
frontend/src/main.tsx
frontend/src/App.tsx
frontend/src/api.ts
frontend/src/styles.css

How it runs

Step Command Where it ran
Install the frontend dependencies cd frontend && npm install node:22-bookworm: 7 top-level packages
Develop with the proxy npm run dev and go run ./cmd/server Not run: a dev server needs a browser; the proxy is in the config
Build the frontend npm run build node:22-bookworm: 30 modules, 225.46 kB of JS, 0.42 kB of CSS
Build the product go build -o notes ./cmd/server Here, with web/dist
Run it ./notes -addr 127.0.0.1:8080 -db notes.db Here, with curl
Test it go test ./... Here, all tests pass

Read the three pages in order: the backend and its tests, the frontend sources and the commands, and the embed step that turns both into one binary. The Go lessons behind the API are an HTTP server with net/http, a JSON API by hand, database/sql and embed.

The Go side of this project was built and run with go 1.26.10 and modernc.org/sqlite v1.62.0 on Alpine Linux 3.24.3 (x86_64) in a Docker container. The frontend was built in the node:22-bookworm image with Node v22.23.3, npm 10.9.9, vite 6.4.6, react 19.3.1, react-dom 19.3.1, typescript 5.7.3, @vitejs/plugin-react 4.7.0, @types/react 19.3.0 and @types/react-dom 19.3.0, the versions the package.json ranges resolved to at the time of writing.