GoFr mascot: a gopher in a ninja outfit

Aryan Mehrotra

gofr.dev

Open Source India 2026

Services an AI can write and a team can run

GoFr: An Opinionated Go Framework
For accelerated microservice development

Where we are

AI already writes the code

75%

of Google's new code is AI-generated

Up from 25% in 2024. Sundar Pichai, April 2026.

84%

of developers use or plan to use AI tools

Stack Overflow Developer Survey 2025, 49,000+ respondents.

53%

of Go developers use AI tools every day

Go Developer Survey 2025, published January 2026.

Sources: Semafor, Stack Overflow, go.dev/blog/survey2025

gofr.dev

What it costs

The bill arrives after the merge

56%

of AI-written code passes security tests

No better than a year ago. It compiles almost every time.

5x

longer median review time

Pull requests are 51% larger on high-AI teams.

3x

more incidents per pull request

Against 34% more tasks delivered.

46%

of developers distrust AI accuracy

33% trust it. 3% trust it highly.

Sources: Veracode 2026, Faros AI 2026 (22,000 developers), Stack Overflow 2025

gofr.dev

The idea

Put the production parts in the framework, where no prompt has to remember them.

Don't manually wire OpenTelemetry, Prometheus, or structured logging. gofr.New() does it.

Rule 4 of GoFr's guide for AI coding assistants, gofr.dev/AGENTS.md

GoFr v1.62.0

gofr.dev

The whole service

One handler shape, the rest included

func main() {

    app := gofr.New()

    app.GET("/orders/{id}", getOrder)

    app.Run()

}

 

func getOrder(c *gofr.Context) (any, error) {

    var status string

    err := c.SQL.QueryRowContext(c,

        "SELECT status FROM orders WHERE id=?",

        c.PathParam("id")).Scan(&status)

    return status, err

}

Running, and nobody wrote it

Traces. OpenTelemetry spans for the request and the query; one env var ships them.

Metrics. Prometheus at /metrics on port 2121.

Logs. JSON lines carrying the trace_id.

Health. /.well-known/health and /.well-known/alive.

Profiling. pprof on the metrics port.

Shutdown. Graceful on SIGTERM, 30 seconds by default.

The same signature serves HTTP, gRPC, GraphQL, WebSocket, cron and CLI

gofr.dev

AI inside the service

The LLM is one more datasource

app.AddLLM(&llm.Client{

    Provider: llm.Groq,

    Model:    "llama-3.3-70b-versatile",

})

 

func ask(c *gofr.Context) (any, error) {

    return c.LLM().Generate(c, prompt)

}

Traced

Every call is a span in the request's trace.

Metered

Requests and tokens per request are Prometheus metrics.

Health-checked

The model counts toward service health, like the database.

OpenAI, Groq, DeepSeek, Together, Ollama, or your own ai.Model. Chat, stream, embed, tools.

gofr.dev

Agents as clients

One line makes your API agent tools

Agent

Any MCP client

app.EnableMCP()

MCP server on 127.0.0.1:8200

Your handlers

Same router, same middleware

Read-only

Only GET, HEAD, OPTIONS and QUERY routes become tools. Writes are never exposed.

Local by default

It listens on loopback, on its own port, and you can exclude routes.

Same rules

Tool calls run through the real router, with the caller's headers forwarded.

MCP is a Linux Foundation project (Agentic AI Foundation) since December 2025

gofr.dev

Live demo

One service, three requests

1

curl localhost:8000/inventory/A1

A trace and a metric appear. Nobody asked for them.

2

curl -X POST localhost:8000/ask -d '{"prompt":"..."}'

The LLM call is a span in the same trace, tokens counted.

3

MCP client -> localhost:8200

The agent finds /inventory as a tool and calls it.

Code: examples/using-ai in github.com/gofr-dev/gofr

gofr.dev

For the company

What a team gets back

PressureWithout a frameworkWith GoFr
Review loadEach generated service is wired its own wayOne handler signature for HTTP, gRPC, cron and CLI
IncidentsTracing and health checks added after the outageTraces, metrics, logs and health from gofr.New()
AI spendToken use is invisible until the invoiceTokens per request is a metric from the first call
IntegrationsA different client and setup per store30+ datasources and brokers through one context
Lock-inA vendor SDK in every serviceApache-2.0, standard net/http, OpenTelemetry

20,800+ GitHub stars, 160+ contributors, a release every two to three weeks

gofr.dev

The takeaway

Everything in the box

Serve

HTTP, gRPC, GraphQL, WebSocket, cron jobs, CLI apps, CRUD from a struct

Data

MySQL, Postgres, SQLite, Redis, Mongo, Cassandra, ClickHouse and more, with migrations

Messaging

Kafka, NATS, Google Pub/Sub, MQTT, SQS, Event Hubs, Redis

Files

Local disk, S3, GCS, Azure, FTP and SFTP behind one file API

Observe

Traces, metrics, JSON logs, health endpoints, pprof, live log-level change

Secure

Basic auth, API keys, OAuth with JWT, RBAC, rate limiting, CORS

Call out

HTTP client with circuit breaker, retry, rate limit and health checks

AI

LLM datasource, streaming, embeddings, tool calls, MCP server

Also: graceful shutdown, Swagger UI, test mocks. All in GoFr v1.62.0, Apache-2.0.

gofr.dev

Start tonight

Give your agent a framework, then review less

gofr.dev: docs and quick start

github.com/gofr-dev/gofr: the code, Apache-2.0

gofr.dev/AGENTS.md: hand this to your coding assistant

GoFr mascot: a gopher in a ninja outfit

Aryan Mehrotra · x.com/_aryanmehrotra

Open Source India 2026