xiaohongshu
xiaohongshu
dashboard-mail
V1.0 - Expert guidance for the Dashboard Mail module supporting Outlook, Gmail, and custom IMAP providers.
Full skill instructions
After completing work using this skill, append to History/{YYYY-MM-DD}.md:
## {HH:MM} - {Action Taken}
{One-line summary of what was done}
Mail integration module for aggregating multiple email accounts into a unified dashboard widget and page.
src/modules/mail/
├── actions.ts # Server actions (CRUD for accounts)
├── types.ts # TypeScript types and utilities
├── index.ts # Module exports
├── components/
│ ├── mail-widget.tsx # Dashboard widget (compact)
│ ├── mail-list.tsx # Message list view
│ ├── mail-item.tsx # Individual message row
│ ├── account-tabs.tsx # Account switcher tabs
│ ├── account-card.tsx # Account display card
│ └── bulk-action-bar.tsx # Bulk action toolbar
└── lib/
├── outlook-client.ts # Microsoft Graph API client
├── gmail-client.ts # Gmail API client (placeholder)
├── imap-client.ts # Custom IMAP client (placeholder)
├── token-manager.ts # Encrypted credential storage
├── cache.ts # Redis caching layer
└── rate-limiter.ts # API rate limiting
src/app/mail/
├── page.tsx # Full mail page
└── settings/
└── page.tsx # Account management UI
mail_account_settings - Per-user account configurations
| Column | Type | Description |
|---|---|---|
| id | uuid | Primary key |
| user_id | uuid | FK to auth.users |
| provider | text | outlook, gmail, or imap |
| account_name | text | Display name (e.g., "Work Gmail") |
| email_address | text | Account email |
| is_enabled | boolean | Active flag |
| sync_frequency_minutes | integer | Polling interval (min 1) |
mail_oauth_tokens - Encrypted credentials (AES-256-GCM)
| Column | Type | Description |
|---|---|---|
| account_id | uuid | FK to mail_account_settings |
| encrypted_access_token | text | Encrypted OAuth/IMAP password |
| encrypted_refresh_token | text | OAuth refresh token (nullable) |
| iv | text | Initialization vector |
| auth_tag | text | GCM authentication tag |
| token_expires_at | timestamptz | Token expiry (OAuth only) |
IMAP needs additional columns for custom server settings:
imap_host (text) - Server hostnameimap_port (integer) - Server port (default 993)Currently IMAP falls back to env vars IMAP_HOST, IMAP_PORT which is a placeholder workaround.
| Provider | Status | Auth Method | API |
|---|---|---|---|
| Outlook | Implemented | OAuth 2.0 | Microsoft Graph |
| Gmail | Placeholder | OAuth 2.0 | Gmail API |
| IMAP | Placeholder | Password | IMAP protocol |
Required env vars:
GRAPH_CLIENT_ID=
GRAPH_CLIENT_SECRET=
GRAPH_REDIRECT_URI=
Required env vars:
GMAIL_CLIENT_ID=
GMAIL_CLIENT_SECRET=
GMAIL_REDIRECT_URI=
Current env vars (temporary until DB columns added):
IMAP_HOST=
IMAP_USER=
IMAP_PASS=
IMAP_PORT=993
type MailProvider = "outlook" | "gmail" | "imap";
interface MailAccount {
id: string;
provider: MailProvider;
accountName: string;
emailAddress: string;
isEnabled: boolean;
syncFrequencyMinutes: number;
}
interface MailMessage {
id: string;
subject: string;
from: MailAddress;
receivedAt: Date;
isRead: boolean;
preview: string;
}
type BulkActionType = "markRead" | "markUnread" | "moveToJunk" | "delete";
| Action | Description |
|---|---|
getMailAccounts() | List user's configured accounts |
createMailAccount(input) | Add new account |
updateMailAccount(id, input) | Modify account settings |
deleteMailAccount(id) | Remove account and tokens |
getMailSummary() | Aggregated unread counts |
getMailMessages(accountId) | Fetch messages for account |
performBulkAction(request) | Execute bulk operations |
Redis caching via Upstash with keys:
mail:summary:{userId} - Account summariesmail:messages:{accountId}:{folder} - Message listsmail:account:{accountId} - Account detailsMAIL_ENCRYPTION_KEYLocated at /mail/settings:
imap_host and imap_port columns to mail_account_settingsimap npm packagexiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience