Skip to main content

goclarc

NestJS-style scaffolding for Go Clean Architecture APIs

go install github.com/deBilla/goclarc@latest
📋

Schema-Driven

Define your domain once in a simple YAML file. goclarc reads your field definitions and generates fully typed Go structs, DTOs, and database params — no hand-writing boilerplate ever again.

🗄️

Multi-Database

One schema, any backend. Generate PostgreSQL (sqlc + pgx), MongoDB (mongo-driver/v2), or Firebase RTDB repositories from the same YAML. Mix adapters across modules in a single project.

🏛️

Clean Architecture

Every generated module follows strict Handler → Service → Repository layering with interface-first design. Drop the generated code into production and start adding real business logic immediately.

Up and running in 30 seconds

1
goclarc new my-api \
  --module-path github.com/you/my-api

Scaffold a full project skeleton with Gin, config, middleware, and error handling.

2
# schemas/user.yaml
module: user
fields:
  - name: id
    type: uuid
    primary: true
    auto: true
  - name: email
    type: string
    required: true

Write a concise YAML schema defining your domain fields and types.

3
goclarc module user \
  --db postgres \
  --schema schemas/user.yaml

Get entity, DTO, repository, service, handler, and routes — all typed and wired.