Skip to content

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.

38
Packages
267+
Documented APIs
10
Migration guides
Go 1.25
Generics & context-first

Install

bash
go get github.com/sahilkhaire/gox

gox is not a framework. Each capability lives in its own import path — pull in only what your service needs:

go
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.jsgox packageDocs
express, cors, helmethttpHTTP guide
axios, fetchclientclient.Fetch
lodash, Array.*slice, maputilslice.Map
dotenvenvenv.Load
zod, joivalidatevalidate.Object
knex, pgdbMigration: Knex
ioredisredisredis.New
mongoosemongomongo.Connect
jsonwebtokenjwtjwt.Sign
passportauthMigration: Passport
bullqueuequeue.New
a ? b : c, ??condcond.If

See the full Cheat Sheet for every mapping.

Three-way docs on every API

Each reference page follows the same premium layout:

  1. Signature — full Go declaration with generics
  2. Overview — what it does and when to reach for it
  3. Compare — tabbed Node.js · Standard Go · gox examples
  4. Tips — migration notes, performance, escape hatches

Example — slice.Map:

js
const names = users.map(u => u.name);
go
names := make([]string, len(users))
for i, u := range users {
    names[i] = u.Name
}
go
names := slice.Map(users, func(u User) string { return u.Name })
  1. Architecture — module layout, context-first I/O, dependency policy
  2. Pick a package groupUtilitiesWebData
  3. Migration guide for your heaviest npm dependency
  4. 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

License

MIT

MIT Licensed · Built for Node.js developers moving to Go