Changelog
Unreleased
Added
- Validation rules:
string,integer,boolean,alpha,alpha_num,alpha_dash,starts_with,ends_withanddate. - Collections: structs in slices, arrays and maps are validated under keys
such as
items.0.sku; rules aftereachapply to every element;MessagesandAttributesaccept*for indexes. - Locales:
AddLocale,WithLocale,MatchLocaleandLocaleMiddleware, with a built-in Turkish catalogue. English stays the default. - Form requests:
c.ValidatecallsAuthorize(deny withhttpcontext.ErrForbidden, rendered as 403) andPrepare;validation.AfterValidatoradds cross-field checks. - API resources (
http/resource):Object,Item,Collection,Paginatedwithmetaandlinks,PageURL, and the conditional helpersWhen,WhenFunc,WhenNotNilandMergeWhen. - Vite integration (
http/vite):Tags,URLandReactRefreshresolve entries through Vite's manifest in production and the dev server in development;FuncMapexposes them to templates asvite,vite_assetandvite_react_refresh.Filesserves the build with immutable caching for hashed assets, andSPAadds theindex.htmlfallback. Builds can be embedded withConfig.FS. - CLI:
golar make:request <name>.golar serverunsnpm run devalongside the server for projects with a frontend (--no-vite,--vite-port);golar buildbuilds the frontend and the server;golar make:frontend react|vue|svelteadds a frontend to an existing project. - Docs: a full-stack guide (
docs/frontend.md).
Changed
- Structs inside slices, arrays and maps are now validated. Requests whose
element structs carry
validatetags can fail validation where v0.5.1 accepted them. integer, likenumeric, makes size rules compare string values as numbers.- Generated Vite configs enable
build.manifestandserver.origin. - Generated Full Stack projects serve
frontend/distwithvite.SPA. Web projects with a frontend now render their pages in Go and load the bundle with{{vite ...}}instead of replacing them withfrontend/dist/index.html.
v0.5.1 — 2026-10-28
Fixed
golar newfrom a CLI installed withgo install ...@v0.5.0treated the module cache as a local Golar checkout and wrote areplacedirective to it, so generated projects did not build on other machines. Installed CLIs now require the published version;--framework-dirstill selects a checkout.- Generated projects default to
github.com/dayanchm/golar v0.5.1, andgolar versionreports0.5.1.
v0.5.0 — 2026-10-28
The first tagged release. Install the CLI with
go install github.com/dayanchm/golar/cmd/golar@v0.5.0; generated projects
require github.com/dayanchm/golar v0.5.0.
Added
- Validation (
validation, #41): struct-tag rules (required,email,url,uuid,regex,numeric,min,max,len,between,in,confirmed,unique,exists), custom rules and messages, and nested structs.c.Validatebinds and validates a request; invalid input becomes422 {"errors": {...}}. - Middleware (
http/middleware, #43):CORS,RequestID,Timeout,BodyLimit,SecureHeadersandCompress.Loggerlogs the request ID. - Request context (
http/context, #42):Bindfor JSON, URL-encoded and multipart bodies;Form,File,SaveFile,QueryDefaultandQueryInt;Cookie,SetCookiewith secure defaults,SetRawCookieandClearCookie;HTML,Render,Blob,NoContent,RedirectandDownload;IPandIsTLS, which trust forwarded headers only from configured proxies;WantsJSONandContext.
- SQL session store (
http/session, #44):SQLStorekeeps sessions in asessionstable keyed by the SHA-256 of their ID, so they survive restarts and are shared between instances.CreateTables,PruneandPruneEverymanage the table. - Mail (
mail, #45): messages with header-injection checks, SMTP (STARTTLS by default), log and fake drivers, templates andFromEnv.auth.PasswordResetMailandauth.VerificationMailsend the auth emails. - Authentication and authorization (
auth): Argon2id passwords, session and API token guards, CSRF, rate limiting, gates, policies, roles, password resets and email verification. - ORM and query builder (
database/orm,database/query): models, CRUD, relationships, eager loading, soft deletes, joins, aggregates, pagination and dialect-aware SQL for SQLite, PostgreSQL and MySQL. - Scaffolding:
golar new --auth token|sessiongenerates user accounts;- projects with authentication get password reset and email verification routes;
- generated projects register RequestID, Logger, Recovery, SecureHeaders, BodyLimit and Compress;
- session projects store sessions in the database unless
SESSION_DRIVER=memory.
Changed
- The default error handler maps oversized bodies to 413, unsupported body types to 415, and undecodable bodies and invalid query parameters to 400.
- Request bodies read through
Contextare limited by default: 4 MiB, or 32 MiB for multipart. Change the limits withapp.SetContextConfig. - Router: HEAD requests are served by GET routes, and
Allowlists HEAD. golar versionreports0.5.0.
Fixed
- Password reset times are stored in whole seconds, so MySQL compares them correctly.