Aion is an authenticated AI desktop app backed by a Next.js server. It combines an Electron + React client, Better Auth, PostgreSQL/Drizzle, multi-model chat, and optional web search in a single Turborepo workspace.
- Chat from a desktop UI built with Electron, React 19, and TanStack Router
- Switch between models such as GPT-5, Claude Sonnet 4, and Gemini 2.5 Flash
- Route web-enabled queries through Perplexity Sonar
- Handle sign-up and sign-in with Better Auth
- Persist auth data in PostgreSQL through Drizzle ORM
- Expose a server-side chat API from a Next.js app
- Manage local MCP server config from the app settings screen
apps/
├── desktop/ # Electron renderer + desktop shell
└── server/ # Next.js API, auth, and database layer
- Node.js 20+
- pnpm 10+
- Docker, if you want to run PostgreSQL locally with the included compose file
- Install dependencies:
pnpm install- Create local env files from the examples:
cp apps/server/.env.example apps/server/.env
cp apps/desktop/.env.example apps/desktop/.env- Fill in the required values:
apps/server/.envDATABASE_URLCORS_ORIGINBETTER_AUTH_SECRETBETTER_AUTH_URLAI_GATEWAY_API_KEY
apps/desktop/.envVITE_SERVER_URL
- Start PostgreSQL:
pnpm run db:start- Push the database schema:
pnpm run db:push- Start the workspace:
pnpm run devBy default, the server runs on http://localhost:3000. Point VITE_SERVER_URL at that server for the desktop app.
pnpm run devruns the whole workspacepnpm run dev:desktopstarts only the Electron apppnpm run dev:serverstarts only the Next.js serverpnpm run buildbuilds all appspnpm run check-typesruns TypeScript checks across the monorepopnpm run checkruns Biome checks and formattingpnpm run db:startstarts PostgreSQL with Docker Composepnpm run db:stopstops the database containerpnpm run db:downstops the database container and removes resourcespnpm run db:pushpushes the current Drizzle schemapnpm run db:studioopens Drizzle Studio
- Electron Forge
- React 19
- TanStack Router
- Next.js 15
- Better Auth
- Drizzle ORM
- PostgreSQL
- AI SDK
- Turborepo
- Tailwind CSS
- Biome