Extend Grit

Plugins

Grit plugins are standalone Go packages that add specific functionality to your project. Each plugin is a drop-in module with Gin handlers, GORM models, and a Claude Code skill file so AI assistants know how to use it.

How Plugins Work

Grit plugins follow a consistent pattern: install the Go module, run the GORM auto-migration, configure with environment variables, and register routes. Each plugin includes a .claude/skills/ directory with a skill file that teaches AI assistants how to integrate and use the plugin.

Integration Pattern
// 1. Install
// go get github.com/gritframework/grit-<plugin>
// 2. Import and configure
import plugin "github.com/gritframework/grit-<plugin>"
// 3. Run migrations
plugin.AutoMigrate(db)
// 4. Create service
svc := plugin.NewService(db, plugin.Config{...})
// 5. Register routes
plugin.RegisterRoutes(router.Group("/api"), svc)

Source Code: All plugins are open source at github.com/MUKE-coder/grit-plugins

WebSockets

grit-websockets

GitHub

Real-time communication with hub pattern, rooms, broadcast, and auth middleware.

Features

  • WebSocket hub with connection management
  • Room-based messaging and broadcast
  • Auth middleware via query param token
  • Client read/write pump goroutines

Use Cases

Live chat and messagingReal-time notificationsCollaborative editingLive dashboards and feedsMultiplayer game state sync
Install
go get github.com/gritframework/grit-websockets
Quick Start
import ws "github.com/gritframework/grit-websockets"
hub := ws.NewHub()
go hub.Run()
r.GET("/ws", ws.AuthWebSocketHandler(hub, validateToken))

Stripe Payments

grit-stripe

GitHub

Stripe integration for checkout sessions, subscriptions, customer portal, and webhook handling.

Features

  • Checkout sessions (one-time and recurring)
  • Subscription management (create, cancel, list)
  • Customer portal sessions
  • Webhook signature verification and routing
  • GORM models for payment tracking

Use Cases

SaaS subscription billingE-commerce checkoutMarketplace paymentsUsage-based billingFreemium to paid conversion

Environment Variables

STRIPE_SECRET_KEYSTRIPE_WEBHOOK_SECRETSTRIPE_SUCCESS_URLSTRIPE_CANCEL_URL
Install
go get github.com/gritframework/grit-stripe
Quick Start
import gritstripe "github.com/gritframework/grit-stripe"
client := gritstripe.NewClient(gritstripe.Config{
SecretKey: os.Getenv("STRIPE_SECRET_KEY"),
WebhookSecret: os.Getenv("STRIPE_WEBHOOK_SECRET"),
SuccessURL: os.Getenv("STRIPE_SUCCESS_URL"),
CancelURL: os.Getenv("STRIPE_CANCEL_URL"),
})
r.POST("/webhooks/stripe", gritstripe.WebhookHandler(handlers))

OAuth / Social Login

grit-oauth

GitHub

OAuth2 social login with pre-configured providers for Google, GitHub, and Discord.

Features

  • Google, GitHub, Discord providers built-in
  • State parameter CSRF protection
  • OAuth account linking to existing users
  • Extensible for custom providers
  • GORM models for OAuth accounts

Use Cases

Social login (Sign in with Google)SSO for enterprise appsGitHub login for developer toolsDiscord login for community appsMulti-provider auth

Environment Variables

GOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRETGITHUB_CLIENT_IDGITHUB_CLIENT_SECRET
Install
go get github.com/gritframework/grit-oauth
Quick Start
import oauth "github.com/gritframework/grit-oauth"
mgr := oauth.NewManager(oauth.Config{
RedirectBaseURL: os.Getenv("OAUTH_REDIRECT_BASE"),
})
mgr.RegisterProvider("google", oauth.GoogleProvider(clientID, clientSecret))
r.GET("/auth/:provider", mgr.RedirectHandler())
r.GET("/auth/:provider/callback", mgr.CallbackHandler(onSuccess))

Notifications

grit-notifications

GitHub

Multi-channel notification system: in-app, push (FCM), SMS (Twilio), and email digest.

Features

  • In-app notifications with read/unread tracking
  • Push notifications via Firebase Cloud Messaging
  • SMS via Twilio
  • Multi-channel send (same notification to multiple channels)
  • REST API for frontend notification bell

Use Cases

In-app notification centerOrder status push notificationsSMS verification codesActivity feed alertsMulti-channel user messaging

Environment Variables

FCM_SERVER_KEYTWILIO_ACCOUNT_SIDTWILIO_AUTH_TOKENTWILIO_FROM_NUMBER
Install
go get github.com/gritframework/grit-notifications
Quick Start
import notify "github.com/gritframework/grit-notifications"
svc := notify.NewService(db, notify.Config{
FCMServerKey: os.Getenv("FCM_SERVER_KEY"),
})
notify.RegisterRoutes(api, svc)
svc.Send(ctx, notify.Notification{
UserID: userID, Channel: notify.InApp,
Title: "New Comment", Body: "Someone commented on your post.",
})

Video Processing

grit-video

GitHub

Video upload, FFmpeg transcoding, thumbnail generation, and HLS adaptive streaming.

Features

  • Video upload with validation
  • FFmpeg transcoding to HLS (360p-1080p)
  • Adaptive bitrate master playlist
  • Thumbnail generation
  • Video info extraction (duration, resolution)
  • GORM models with processing status

Use Cases

Video course platformsUser-generated contentMedia streaming servicesVideo portfoliosInternal training videos

Environment Variables

FFMPEG_PATHVIDEO_STORAGE_PATHVIDEO_MAX_UPLOAD_SIZE
Install
go get github.com/gritframework/grit-video
Quick Start
import video "github.com/gritframework/grit-video"
svc := video.NewService(db, video.Config{
StoragePath: "./storage/videos",
MaxUploadSize: 500 * 1024 * 1024,
FFmpegPath: "ffmpeg",
})
video.RegisterRoutes(api, svc)

Video Conferencing

grit-conference

GitHub

WebRTC signaling server with room management, participant tracking, and screen sharing support.

Features

  • WebRTC signaling via WebSocket
  • Room creation with participant limits
  • Screen sharing signals
  • Mute/unmute and video on/off controls
  • ICE/STUN/TURN server configuration
  • Room locking

Use Cases

Video meetings and callsTelehealth consultationsLive tutoring sessionsPair programmingVirtual office rooms
Install
go get github.com/gritframework/grit-conference
Quick Start
import conference "github.com/gritframework/grit-conference"
svc := conference.NewService(conference.Config{
MaxParticipants: 10,
ICEServers: []conference.ICEServer{
{URLs: []string{"stun:stun.l.google.com:19302"}},
},
})
conference.RegisterRoutes(api, svc)

Outgoing Webhooks

grit-webhooks

GitHub

Webhook subscription management, event dispatching, HMAC-SHA256 signing, and retry with exponential backoff.

Features

  • Webhook subscriptions with event filtering
  • HMAC-SHA256 signature headers
  • Exponential backoff retry (up to 5 attempts)
  • Background delivery workers
  • Delivery log with status tracking
  • Test and manual retry endpoints

Use Cases

API platform integrationsEvent-driven architecturesThird-party notification deliveryCI/CD pipeline triggersPayment status callbacks

Environment Variables

WEBHOOK_SIGNING_SECRET
Install
go get github.com/gritframework/grit-webhooks
Quick Start
import webhooks "github.com/gritframework/grit-webhooks"
svc := webhooks.NewService(db, webhooks.Config{
SigningSecret: os.Getenv("WEBHOOK_SIGNING_SECRET"),
MaxRetries: 5, WorkerCount: 4,
})
svc.Start()
webhooks.RegisterRoutes(api, svc)
// Dispatch from anywhere:
svc.Dispatch("user.created", map[string]interface{}{"id": user.ID})

Internationalization

grit-i18n

GitHub

Translation loading, locale detection middleware, pluralization, and API endpoints for frontend translation fetching.

Features

  • File-based translations (JSON/TOML)
  • Locale detection from headers, query params
  • String interpolation and pluralization
  • API endpoints for frontend translation fetching
  • DB-backed translation overrides
  • Gin middleware for locale context

Use Cases

Multi-language websitesGlobal SaaS applicationsAdmin-editable translationsLocalized email templatesRegional content delivery
Install
go get github.com/gritframework/grit-i18n
Quick Start
import i18n "github.com/gritframework/grit-i18n"
svc, _ := i18n.NewService(i18n.Config{
DefaultLocale: "en",
SupportedLocales: []string{"en", "fr", "es"},
TranslationsDir: "./translations",
})
r.Use(i18n.LocaleMiddleware(svc))
i18n.RegisterRoutes(api, svc)

Data Export

grit-export

GitHub

PDF reports, Excel spreadsheets, and CSV exports with builder-pattern APIs and GORM integration.

Features

  • PDF generation with tables, headers, footers
  • Excel export with styling and multiple sheets
  • CSV generation
  • Builder pattern for all formats
  • GORM query to export bridge
  • Gin handler with format negotiation (?format=pdf|excel|csv)

Use Cases

Admin data exportsInvoice PDF generationReport downloadsData migration exportsScheduled report delivery
Install
go get github.com/gritframework/grit-export
Quick Start
import export "github.com/gritframework/grit-export"
svc := export.NewService(export.Config{CompanyName: "Acme Inc"})
queryFn := export.GORMExportHandler(db, &[]User{}, columns)
r.GET("/api/users/export", export.ExportHandler(svc, queryFn))