better-auth-electron
Better Auth integration for Electron desktop apps with secure IPC, context isolation, and encrypted session storage
Skill by 5DLabsInc
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/5dlabsinc-better-auth-electron
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: security
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/better-auth-electron
What's inside
- Skill name
better-auth-electron- Description
- Better Auth integration for Electron desktop apps with secure IPC, context isolation, and encrypted session storage
- License
- AGPL-3.0
- Instructions
- 451 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Better Auth - Electron Desktop Integration
**Better Auth** works seamlessly with Electron using the React client in the renderer process with secure IPC patterns.
## AI Tooling
**IMPORTANT**: Before implementing Better Auth in Electron, consult:
- **AI Documentation**: `https://better-auth.com/llms.txt`
- **MCP Server**: `https://mcp.chonkie.ai/better-auth/better-auth-builder/mcp`
Use Context7 to look up Better Auth patterns:
```
get_library_docs({ libraryName: "better-auth", topic: "react client" })
get_library_docs({ libraryName: "better-auth", topic: "session management" })
```
---
## Installation
```bash
# Install Better Auth and electron-store for session persistence
npm install better-auth electron-store
```
## Architecture
```
┌─────────────────────────────────────────────────────┐
│ Main Process │
│ - Session validation via IPC │
│ - Secure token storage (electron-store) │
│ - Auth state management │
└───────────────────┬─────────────────────────────────┘
│ IPC (contextBridge)
┌───────────────────▼─────────────────────────────────┐
│ Preload Script │
│ - Expose safe auth APIs to renderer │
│ - No direct Node.js access │
└───────────────────┬─────────────────────────────────┘
│
┌───────────────────▼─────────────────────────────────┐
│ Renderer Process │
│ - Better Auth React client │
│ - UI components (React/shadcn) │
│ - Uses window.authApi from preload │
└─────────────────────────────────────────────────────┘
```
---
## Backend Configuration
Your Electron app needs a Better Auth backend (can be local or remote):
**Backend (`server/auth.ts`):**
```typescript
import { betterAuth } from "better-auth"
import { drizzleAdapter } from "better-auth/adapters/drizzle"
import { db } from "./db"
export const auth = betterAuth({
database: drizzleAdapter(db, { provider: "sqlite" }),
emailAndPassword: {
enabled: true,
},
socialProviders: {
github: {
clientId: process.env.GITHUB_CLIENT_ID!,
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
},
},
// Trust Electron app origin
trustedOrigins: [
"app://.", // Electron custom protocol
"file://", // File protocol
"http://localhost", // Dev server
],
})
```
---
## Main Process
**`main.ts`:**
```typescript
import { app, BrowserWindow, ipcMain, shell } from "electron"
import Store from "electron-store"
import path from "path"
// Secure persistent storage for auth state
const store = new Store({
name: "auth",
encryptionKey: "your-encryption-key", // Use secure key management
})
function createWindow() {
const win = new BrowserWindow({
width: 1200,
height: 800,
webPreferences: {
preload: path.join(__dirname, "preload.js"),
contextIsolation: true, // REQUIRED - security
nodeIntegration: false, // REQUIRED - security
sandbox: true, // RECOMMENDED
},
})
// Open OAuth callbacks in external browser
win.webContents.setWindowOpenHandler(({ url }) => {
if (url.startsWith("http")) {
shell.openExternal(url)
return { action: "deny" }
}From 5DLabsInc/cto, AGPL-3.0.
More from 5DLabsInc/cto
- 0.474score
linear-agent-api
5DLabsInc
Linear Agent API expertise - sessions, activities, signals, and best practices.
SkillCFreshness: CClaude Code +9 - 0.474score
telemetry
5DLabsInc
CTO observability stack expertise - Prometheus metrics, Loki logs, Grafana dashboards.
SkillCFreshness: CClaude Code +9 - 0.474score
systematic-debugging
5DLabsInc
Systematic debugging expertise - 4-phase root cause process, evidence gathering, and hypothesis testing.
SkillCFreshness: CClaude Code +9 - 0.474score
ci-remediation
5DLabsInc
CI remediation and PR health monitoring.
SkillCFreshness: CClaude Code +9 - 0.474score
cto-platform
5DLabsInc
CTO Platform lifecycle expertise - Play workflow orchestration, intake processing, MCP tools, and agent sequencing.
SkillCFreshness: CClaude Code +9 - 0.474score
healer
5DLabsInc
Healer monitoring expertise - detection patterns, API endpoints, dual-model architecture, and remediation workflows.
SkillCFreshness: CClaude Code +9 - 0.471score
colosseum-copilot
colosseum
Research Solana/crypto startup opportunities using builder project history, crypto archives, investor theses, and market signals.
SkillCFreshness: CClaude Code +9 - 0.471score
verification-before-completion
5DLabsInc
Verification discipline - evidence-based completion claims, running verification commands before asserting success.
SkillCFreshness: CClaude Code +9 - 0.469score
anime-js
5DLabsInc
Anime.js animation patterns for web interfaces including timelines, staggering, and motion design.
SkillCFreshness: CClaude Code +9 - 0.466score
react-best-practices
5DLabsInc
React and Next.js performance optimization guidelines.
SkillCFreshness: CClaude Code +9 - 0.445score
test-driven-development
5DLabsInc
Test-driven development discipline - RED-GREEN-REFACTOR cycle with strict enforcement.
SkillCFreshness: CClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Apr 11, 2026 (6 months ago)
- Last release
- May 31, 2026 (5 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- AGPL-3.0
- Repository
- github.com/5DLabsInc/cto
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from 5DLabsInc
- 0.474score
telemetry
5DLabsInc
CTO observability stack expertise - Prometheus metrics, Loki logs, Grafana dashboards.
SkillCFreshness: CClaude Code +9 - 0.474score
cto-platform
5DLabsInc
CTO Platform lifecycle expertise - Play workflow orchestration, intake processing, MCP tools, and agent sequencing.
SkillCFreshness: CClaude Code +9 - 0.474score
healer
5DLabsInc
Healer monitoring expertise - detection patterns, API endpoints, dual-model architecture, and remediation workflows.
SkillCFreshness: CClaude Code +9 - 0.474score
linear-agent-api
5DLabsInc
Linear Agent API expertise - sessions, activities, signals, and best practices.
SkillCFreshness: CClaude Code +9 - 0.474score
systematic-debugging
5DLabsInc
Systematic debugging expertise - 4-phase root cause process, evidence gathering, and hypothesis testing.
SkillCFreshness: CClaude Code +9 - 0.474score
ci-remediation
5DLabsInc
CI remediation and PR health monitoring.
SkillCFreshness: CClaude Code +9
Cite this page
better-auth-electron skill. Agent Mart. https://agentmart.dev/skills/5dlabsinc-better-auth-electron (last updated 2026-10-24)