Documentation
Everything you need to build and ship your SaaS with Go.
Introduction
The Go SaaS Kit is a production-ready boilerplate designed to save you weeks of setup time. It combines the performance of Go with the simplicity of HTMX and Tailwind CSS, giving you a powerful stack without the complexity of modern JS frameworks.
Tip: This documentation assumes you have basic familiarity with Go and command-line tools.
Quick Start
1. Prerequisites
- Go 1.22+
- Docker (optional)
- PostgreSQL
- Stripe CLI
2. Installation
Project Structure
- cmd/
- api/main.go // Application entry point
- internal/
- handlers/ // HTTP request handlers
- models/ // Database structs (GORM)
- email/ // Resend integration
- views/
- home/ // Landing page templates
- layout/ // Base HTML structure
- static/ // CSS, JS, Images
- docs/ // Documentation files
- Taskfile.yml // Task runner config
- docker-compose.yml // Local DB setup
- Dockerfile.prod // Production build file
Features Deep Dive
Authentication
Pre-configured Email/Password flow and Google OAuth using Goth. Session management uses secure HTTP-only cookies.
Payments
Full Stripe integration including Subscriptions, Checkout Sessions, Customer Portal, and Webhook handling for status updates.
Email System
Integrated Resend for reliable email delivery. Includes beautiful HTML templates for Welcome emails and Password resets.
AI-Friendly Documentation
The kit includes a specially formatted `README.md` and project structure that is optimized for AI coding assistants (like Cursor, Copilot, or ChatGPT). You can simply paste the README into your AI context to get better, more accurate code generation.
Configuration & Environment Variables
Configure the application using environment variables. Below are guides on how to obtain the critical keys.
Getting your Resend API Key
- Sign up at Resend.com.
- Go to API Keys in the dashboard.
- Create a new API Key (Full Access recommended for dev).
- Copy the key (starts with `re_`) into your `.env` file as `RESEND_API_KEY`.
Setting up Google OAuth
To enable "Continue with Google":
- Go to Google Cloud Console.
- Create a new Project and configure the OAuth Consent Screen (External).
- Go to Credentials → Create Credentials → OAuth Client ID.
- Application Type: Web Application.
- Authorized Redirect URIs: `http://localhost:3000/auth/google/callback` (and your production URL).
- Copy Client ID and Client Secret to your `.env`.
Setting up Stripe Payments
- Register at Stripe.com.
- Go to Developers → API keys.
- Copy `Publishable key` (pk_test_...) and `Secret key` (sk_test_...) to `.env`.
- For Local Development: Use the Stripe CLI to listen for webhooks: `stripe listen --forward-to localhost:3000/webhook`. Copy the signing secret (`whsec_...`) to `.env` as `STRIPE_WEBHOOK_SECRET`.
- For Production: Add a Webhook Endpoint URL (`https://your-domain.com/webhook`) in the dashboard and copy that signing secret.
- Create a Product and Price in the Dashboard, and copy the Price ID to `STRIPE_PRICE_ID`.
Variable Reference
| Variable | Description | Example |
|---|---|---|
| APP_NAME | App name in emails | "Acme Corp" |
| COMPANY_NAME | Legal company name | "Acme Inc." |
| EMAIL_LOGO_URL | Header logo URL | "https://.../logo.png" |
| SUPPORT_EMAIL | Reply-To address | "support@gosaaskit.io" |
Database Schema
The kit uses GORM (Go Object Relational Mapper) with PostgreSQL. Here is the core `User` model structure which handles Auth, Billing, and Admin roles.
type User struct {
gorm.Model
Email string `gorm:"uniqueIndex;not null" json:"email"`
Name string `json:"name"`
Password string `json:"-"` // Hashed
// Email verification
VerificationToken string
IsVerified bool `gorm:"default:false"`
// OAuth social login fields
AvatarURL string `json:"avatar_url"`
Provider string `json:"provider"` // e.g., "google"
ProviderID string `json:"provider_id"`
// Stripe billing integration
StripeCustomerID string `json:"stripe_customer_id"`
SubscriptionID string `json:"subscription_id"`
IsPremium bool `json:"is_premium"`
// Admin privileges
IsAdmin bool `json:"is_admin"`
}Deployment Platforms
We include step-by-step guides for the most popular Go hosting platforms.