Skip to Content
Signet

Deployment

Production checklist for a Go service that embeds Signet.

Signet is a library inside your service — there is no separate auth process to deploy. This page covers the settings that matter in production.

Checklist

  1. Serve HTTPS. Cookies are Secure by default. Behind a TLS-terminating proxy, make sure the application still sees the original scheme so redirects and links are correct.
  2. Start from DefaultConfig(). It sets Secure and HttpOnly cookies. A zero Config{} fails with ErrInsecureConfig; never enable InsecureAllowHTTPCookies or InsecureDisableCSRF in production.
  3. Set a random 32-byte CSRFKey and a 32-byte OAuth.StateKey when OAuth is enabled. Generate them once and store them in your secret manager; rotating them invalidates outstanding CSRF tokens or OAuth state.
  4. Set AppURL to the public origin so verification and reset links point to your frontend. Serve /verify and /reset pages that extract the token and call the API.
  5. Configure a real Mailer. Use mailer/smtp with STARTTLS or implicit TLS; the console mailer is development only.
  6. Connect and migrate your Store. Call Migrate(ctx) from a deployment step or at startup, and own the schema as described in Storage.
  7. Mount Client.Handler() under PathPrefix. The handler serves the prefixed paths itself, so do not wrap it in http.StripPrefix. Protect private routes with RequireAuth.
  8. Use a durable RateLimiter. The interface is a boolean gate; your implementation decides the window, counter store and key policy. The key format is endpoint+"|"+clientIP.

Cookies behind a prefix

The session cookie is named signet_session, prefixed with __Host- when Secure is true, Path is / and Domain is empty. Browsers only accept __Host- cookies over HTTPS with no Domain and a secure origin. If your setup needs a cross-subdomain cookie, set Domain explicitly — the prefix is then omitted.

Trusted proxies are configured as CIDR ranges in Config.TrustedProxies. With none configured, X-Forwarded-For is ignored and the connection address is the rate-limit key. When the immediate peer is trusted, the chain is walked right-to-left to the first untrusted hop; IPv6 addresses are normalized. Never trust a proxy you do not control.

JWT-only services

For API-only deployments set JWTOnly: no session cookies or CSRF key are needed, and clients use POST /token plus the Authorization header. See JWT.

Frontend separation

If the React frontend lives in another repository, publish a versioned SDK from your application's OpenAPI spec and let the frontend install it. Signet's generated client is a base for that SDK; see Frontend client.

Publishing the documentation site

The Fumadocs site is a Next.js app that needs a Node/server runtime: the documentation pages are pre-rendered, but the search and playground-proxy routes and middleware are dynamic. Set NEXT_PUBLIC_SIGNET_API_URL to the public API origin (including the mount prefix, e.g. https://api.example.com/auth), run npm run build in docs-site/, and deploy it to a host that can run the Next.js server. A static-only host would lose the playground proxy and search. The value gives the API playground a real base URL; it is injected at build time only and does not alter the published spec.

On this page