ExecOS is an autonomous executive assistant built on Next.js and Clerk auth. It connects Gmail and Google Calendar, analyzes unread email using AI, drafts replies, extracts tasks, and manages a user-facing dashboard for agent activity.
- Clerk-based authentication and user onboarding
- Google OAuth integration for Gmail and Google Calendar
- Autonomous agent that:
- fetches unread Gmail messages
- analyzes emails with AI
- creates Gmail drafts for replies
- extracts action items as tasks
- optionally creates Google Calendar events
- User dashboard with agent status, onboarding progress, and recent activity
- Monitoring page with email processing statistics and detail cards
- Drizzle ORM + Neon database schema for users, integrations, tasks, and agent runs
- Encrypted OAuth token storage
- Next.js 16
- React 19
- Clerk for auth
- Drizzle ORM with Neon serverless PostgreSQL
- Google APIs (
googleapis) for Gmail and Calendar - Tailwind CSS / shadcn UI
- Zod for validation patterns
- AES-GCM encryption for sensitive tokens
app/- Next.js App Router pages and API routes(auth)/- sign-in / sign-up UI(main)/dashboard,monitoring,settings- protected app pagesapi/auth/google- Google OAuth initiation routeapi/auth/google/callback- OAuth callback and token persistenceapi/agents/run- manual or cron-triggered agent execution
components/- shared UI and helper componentslib/- core application logicagent.ts- agent run orchestrationgoogle.ts- Google OAuth helpergoogle-client.ts- Gmail / Calendar authenticated clients and token refreshdb/- Drizzle database adapter, schema, and queriesagents/- Gmail and calendar integration helpersencryption.ts- token encryption / decryption
Create a .env.local file at the project root with the following values:
DATABASE_URL=postgresql://user:password@host:port/dbname
ENCRYPTION_KEY=your-super-secret-32-byte-key
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
NEXT_PUBLIC_APP_URL=http://localhost:3000
CRON_SECRET=your-cron-secret
CLERK_PUBLISHABLE_KEY=your-clerk-publishable-key
CLERK_SECRET_KEY=your-clerk-secret-key
CLERK_FRONTEND_API=your-clerk-frontend-apiNote: Clerk-specific env variables are required by
@clerk/nextjsbut are not explicitly referenced in the code snippets. Configure them according to your Clerk application settings.
- Create a Google Cloud project.
- Enable Gmail API and Google Calendar API.
- Create OAuth 2.0 credentials.
- Set the authorized redirect URI to:
http://localhost:3000/api/auth/google/callback
- Set
GOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRETin.env.local.
Install dependencies:
npm installRun the development server:
npm run devOpen http://localhost:3000 in your browser.
This app uses Neon/PostgreSQL with Drizzle ORM.
- The database connection is read from
DATABASE_URL - Tables are defined in
lib/db/schema.ts - Sensitive token data is encrypted before storing in
integrations
/- Landing page and marketing hero/dashboard- Protected dashboard showing agent health and onboarding/settings- Integration setup for Gmail and Google Calendar/monitoring- Agent processing metrics and email detail view
- User connects Gmail and/or Google Calendar via
/settings api/agents/runtriggerslib/agent.ts- The agent:
- loads Gmail and Calendar clients
- fetches unread Gmail messages
- summarizes each email with AI
- creates reply drafts when needed
- extracts tasks into the database
- schedules calendar events if available
- marks emails as read
- The agent stores run history in
agent_runs
- Manual: click
Run Agent Nowfrom the dashboard - Cron/automatic: configure a scheduler to POST to
/api/agents/run
If CRON_SECRET is set, the route will execute the cron-style batch runner for all enabled users.
npm run dev— start development servernpm run build— compile the app for productionnpm run start— run the production servernpm run lint— lint the project
- The app uses encrypted OAuth token storage with
ENCRYPTION_KEY. - The Google callback route stores encrypted tokens via
upsertIntegration. settingspage supports connecting Gmail and Calendar providers.monitoringpage visualizes processed emails, drafts, and tasks.
- add subscriptions and paid plan enforcement
- improve agent error handling and retry behavior
- add task management UI with complete/incomplete state
- support additional providers beyond Google
This repository has no explicit license file. Add one if you plan to publish or share the project.