Project · Beginner · about 14 hours

A product catalogue API in Go

Serve a searchable catalogue of real food products from Open Food Facts with Go's standard library, table-driven tests and graceful shutdown.

Skills:Go, REST APIs and HTTP, Automated testing

Part of: Software Engineer (Backend)

Data and licences

Brief

Open Food Facts is an open database of food products from around the world, with barcodes, names, brands, categories, ingredients and nutrition grades, published under the Open Database License. Build a small, fast catalogue API over part of it.

What to build

  1. Download the CSV or JSONL export and import products from one country, keeping barcode, name, brand, categories and Nutri-Score.

  2. GET /products/{barcode} returning 404 for unknown barcodes.

  3. GET /products?q=&brand=&nutriscore=&page= with a maximum page size and a stable sort.

  4. Use an http.Server with read and write timeouts and graceful shutdown on SIGTERM.

  5. Table-driven tests with httptest and go test -race in GitHub Actions.

Deliverables

  • Repository with cmd/, internal/, a loader, tests, a CI workflow and README.md

How it is graded

Reviewers run the loader and the tests, then call the API with odd input: empty queries, huge page sizes, unknown barcodes. Nothing should crash or return unbounded results.

Stretch

Add full-text search with SQLite FTS5 or PostgreSQL tsvector, and compare query times with a LIKE search.

Deliverables

  • A loader that imports a subset (for example 50,000 products from one country) into SQLite or PostgreSQL
  • A Go HTTP service with product lookup by barcode, search with filters and pagination, and health checks
  • Table-driven tests with httptest, run with the race detector in CI
  • A README with setup, example requests and attribution to Open Food Facts

How a reviewer grades it

CriterionWeightWhat good looks like
Idiomatic Go (errors handled, context passed, no data races)25%
Search and pagination are correct and bounded (limits, stable ordering)25%
Tests cover normal, empty, invalid and not-found cases30%
Server has timeouts, graceful shutdown and a clear README20%