Skip to content

dotcommander/gokart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

126 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoKart

GoKart logo

GoKart is a modular Go toolkit for recurring infrastructure setup, safe defaults, and user-owned generated code. Its enforceable boundary is defined in PHILOSOPHY.md.

go install github.com/dotcommander/gokart/cmd/gokart@v0.11.0
gokart new myapp --db sqlite --example
cd myapp
go run ./cmd greet --name World

Packages

  • gokart: typed configuration, platform config directories, and JSON state persistence.
  • gokart/cli: Cobra application construction and process-stream presentation helpers.
  • gokart/web: chi router/server construction, JSON responses, bounded binding, and validation.
  • gokart/postgres: pgx pool setup and transaction helpers.
  • gokart/sqlite: zero-CGO SQLite setup and operations.
  • gokart/migrate: goose migrations.
  • gokart/cache: Redis construction, prefixes, JSON operations, and Remember.
  • gokart/logger: log/slog setup.

All modules isolate their dependencies. Constructors expose real upstream types or an explicit Client escape hatch.

Generator

gokart new creates ordinary Go code. Plain scaffolds are local and unmanaged; selecting --global or an integration adds a manifest so gokart add can safely update generated wiring.

gokart new mycli --global
gokart new service --db postgres --ai --redis
gokart add sqlite --dry-run

Dependencies are pinned for deterministic generation. PostgreSQL uses postgres.Open, SQLite uses sqlite.Open, Redis uses cache.Open, and AI uses the official OpenAI SDK directly.

See the generator reference and documentation index.

v0.11 migration

Removed surface Replacement
ai.NewOpenAIClient(opts...) openai.NewClient(opts...)
ai.NewOpenAIClientWithKey(key) openai.NewClient(option.WithAPIKey(key))
fs.ConfigDir / fs.EnsureConfigDir gokart.ConfigDir / gokart.EnsureConfigDir
fs.WriteFile / fs.ReadOrCreate Standard library; no GoKart replacement
GetString, GetInt, GetFloat, GetBool Typed configuration parsing or caller-owned assertions
Cache command mirrors c.Client().Command(ctx, c.Key(key), ...)
cli.Fatal, cli.FatalErr, cli.Must Return errors; main owns os.Exit
CLI writer overrides Cobra SetOut / SetErr and command writers
Removed web helpers Standard library or the named upstream package directly; see web/README.md

No deprecated aliases or forwarding modules are retained. Historical v0.10.3 tags are the compatibility path.

Removed identifiers

Use this searchable inventory when migrating:

  • Root getters: GetString, GetInt, GetFloat, GetBool.
  • Cache commands: Get, Set, Delete, Exists, Expire, TTL, Incr, IncrBy, SetNX, HGet, HSet, HGetAll, HDel, HIncrBy, ZAdd, ZRange, ZRangeByScore, ZScore, ZRem, ZCard, SAdd, SRem, SMembers, SIsMember, LPush, RPush, LRange, LPop, RPop, Decr, and DecrBy. Call the corresponding go-redis method through Client, applying Key to every logical key.
  • CLI process control and writers: Fatal, FatalErr, Must, SetOutput, SetErrOutput, Output, and ErrOutput.
  • Web assets and auth: NewAssets, AssetConfig, Assets, Assets.Path, Assets.Handler, APIKeyAuth, and BearerAuth.
  • Web CSRF and flash: CSRFProtect, CSRFProtectWithOrigins, SetFlash, GetFlash, FlashFromContext, FlashMiddleware, FlashLevel, FlashMessage, FlashSuccess, FlashError, FlashWarning, and FlashInfo.
  • Web health and clients: HealthHandler, ReadyHandler, HealthCheck, HealthFunc, NewHTTPClient, NewStandardClient, and HTTPConfig.
  • Web negotiation and pagination: WantsJSON, IsHTMX, Negotiate, NegotiateStatus, ParsePage, ParsePageWithConfig, NewPagedResponse, Page, PageConfig, and PagedResponse.
  • Web rate limiting: RateLimit, RateLimitWithKey, RateLimitWithEviction, WithTTL, WithSweepInterval, RateLimiter, RateLimiter.Middleware, RateLimiter.LimiterCount, RateLimiter.Stop, and RateLimitOption.
  • Web templ adapters: Render, RenderCtx, RenderWithStatus, TemplHandler, TemplHandlerFunc, and TemplHandlerFuncE.

Verification

Go 1.26 or later is required.

just verify

License

MIT

About

Opinionated Go service toolkit. Thin wrappers around chi, pgx, redis, viper, cobra, and friends with sensible defaults.

Topics

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages