Getting Started
gox is a Node-friendly Go toolkit. If you have shipped Express apps, used lodash daily, or configured dotenv and axios — you already know most of the surface area. gox maps those patterns onto typed, idiomatic Go.
Install
go get github.com/sahilkhaire/goxgox is not a framework. Each capability lives in its own import path — pull in only what your service needs:
import (
"github.com/sahilkhaire/gox/cond"
"github.com/sahilkhaire/gox/slice"
)
label := cond.If(age >= 18, "adult", "minor")
adults := slice.Filter(users, func(u User) bool { return u.Age >= 18 })Import paths
Every package is github.com/sahilkhaire/gox/<name>. The time helpers live at gox/time but use the identifier timex to avoid clashing with the standard library.
Your npm stack → gox
| You used in Node.js | gox package | Docs |
|---|---|---|
express, cors, helmet | http | HTTP guide |
axios, fetch | client | client.Fetch |
lodash, Array.* | slice, maputil | slice.Map |
dotenv | env | env.Load |
zod, joi | validate | validate.Object |
knex, pg | db | Migration: Knex |
ioredis | redis | redis.New |
mongoose | mongo | mongo.Connect |
jsonwebtoken | jwt | jwt.Sign |
passport | auth | Migration: Passport |
bull | queue | queue.New |
a ? b : c, ?? | cond | cond.If |
See the full Cheat Sheet for every mapping.
Three-way docs on every API
Each reference page follows the same premium layout:
- Signature — full Go declaration with generics
- Overview — what it does and when to reach for it
- Compare — tabbed Node.js · Standard Go · gox examples
- Tips — migration notes, performance, escape hatches
Example — slice.Map:
const names = users.map(u => u.name);names := make([]string, len(users))
for i, u := range users {
names[i] = u.Name
}names := slice.Map(users, func(u User) string { return u.Name })Recommended learning path
- Architecture — module layout, context-first I/O, dependency policy
- Pick a package group — Utilities → Web → Data
- Migration guide for your heaviest npm dependency
- Browse package APIs — each function has its own page with Node.js vs Go comparisons and examples
Must* helpers
Some packages expose MustOpen, MustParse, MustValidate, etc. These panic on failure — same trade-off as Node's JSON.parse vs try/catch. Prefer explicit error handling in library code.
Next steps
- HTTP Guide — Express → gox/http in one place
- Package reference — all 38 packages, 267+ APIs
- Express migration · axios · Knex
License
MIT