A small, standalone Zig project that depends on serpapi the same way
any downstream user project would — it is not part of the parent
serpapi-zig repo's build. It uses serpapi.Client.searchAs against the
Google Flights API to track a
round trip from Austin (AUS) to Paris (CDG), and prints the best
itineraries: price, total duration, stops, and each flight segment.
cd demo/flight_tracker
export SERPAPI_KEY=<secret_serpapi_key>
zig build runOverride the route or dates with environment variables:
DEPARTURE_ID=AUS ARRIVAL_ID=CDG \
OUTBOUND_DATE=2026-10-15 RETURN_DATE=2026-10-22 \
SERPAPI_KEY=<secret_serpapi_key> zig build runbuild.zig.zon and build.zig show the two pieces every user project needs:
- A
serpapientry under.dependenciesinbuild.zig.zon. This demo points it at the parent directory with.path = "../.."since it lives inside the serpapi-zig repo itself — an external project instead runszig fetch --save 'git+https://github.com/serpapi/serpapi-zig#v1.0.0', which writes aurl+hashpair there. See the main README's "Installation" section. b.dependency("serpapi", .{...}).module("serpapi")inbuild.zig, wired into the executable withaddImport/imports.
main.zig decodes the response into a small typed struct
(FlightResults) covering just the fields the demo prints, following the
pattern documented in the main
README's "Search API — typed results" section.