Nova is a production-shaped AI assistant for a digital transformation consultancy. It answers questions, captures qualified leads and books meetings through web chat and Telegram β all through one agent core, one conversation model and one admin dashboard. The core is channel-agnostic, so a WhatsApp adapter can plug into the same runAgent() entry point.
Built with Next.js 15, TypeScript, Tailwind CSS, PostgreSQL and Gemini, with a Persian-first RTL interface, a real tool-calling loop and a booking engine that cannot double-book a slot.
β‘ Portfolio Project β Demonstrates multi-channel AI agents, tool calling, conflict-safe booking, webhook idempotency and RTL product design.
- π¬ One agent core, channel-agnostic β Web chat and Telegram both call the same
runAgent()function, so behaviour, memory and tools stay consistent; a WhatsApp adapter can reuse it as-is - π§ Real tool calling β The model checks availability, creates bookings, cancels appointments and saves leads instead of inventing answers
- π Conflict-safe booking β A partial unique index on confirmed start times plus an atomic insert means two people can never take the same slot
- π Idempotent webhooks β Every Telegram update is stored before processing, so platform retries never create duplicate replies or bookings
- π Persian calendar mapping β The system prompt converts Jalali dates to ISO dates and only allows bookings inside the defined window
- π Owner notifications β Every new booking, cancellation and lead is pushed to the business owner on Telegram
- π‘ Signed webhooks β Telegram updates are rejected unless the
X-Telegram-Bot-Api-Secret-Tokenheader matches the configured secret - π Admin authentication β JWT sessions signed with
jose; the demo build intentionally opens/adminwithout a password - π Admin dashboard β Booking and lead tables, status badges, channel labels, empty states and Persian date formatting
- π¨ RTL design system β Token-based colours, spacing, radii and elevation; Vazirmatn self-hosted through
@fontsourcewith no Google Fonts request - βΏ Accessibility β Skip link, semantic landmarks, table captions, labelled inputs,
aria-livechat log, visible focus rings and reduced-motion support - π± Responsive by default β Mobile-first layout with a 390px-safe chat composer and horizontally scrollable data tables
Hero, consultancy narrative, service cards and the embedded booking assistant.
Bookings, leads, channel labels and status badges β seeded with demo records.
nova-assistant-kappa.vercel.app
Telegram: @assitentnovabot
- Channel entry β
/api/chatand/api/telegramnormalise the incoming message into{ channel, externalId, text } - Conversation memory β
runAgent()upserts the conversation, applies a per-hour rate limit and loads the last 20 messages from Postgres - Prompt β
buildSystemPrompt()injects the live Tehran time, a 14-day Jalali/ISO calendar, services and booking rules - Tool loop β Gemini can call
check_availability,book_appointment,cancel_bookingandsave_leadfor up to six steps - Persistence β Bookings, leads and every message are written to Postgres; confirmed slots are protected by a partial unique index
- Notification β The owner receives a Telegram message for each booking, cancellation and lead
| Path | Description |
|---|---|
src/app/page.tsx |
Persian landing page with hero, approach, services and chat section |
src/components/ChatWidget.tsx |
Streaming-free chat UI, session persistence and error states |
src/app/admin/page.tsx |
Admin dashboard for bookings and leads |
src/app/admin/login/page.tsx |
Password login (kept for non-demo deployments) |
src/middleware.ts |
Admin route guard; open by design in the demo build |
src/app/api/chat/route.ts |
Web channel endpoint |
src/app/api/telegram/route.ts |
Telegram webhook with secret validation and event deduplication |
src/lib/agent.ts |
Conversation loading, rate limiting, model call and persistence |
src/lib/tools.ts |
Availability, booking, cancellation and lead tools |
src/lib/slots.ts |
Working-day grid, free-slot calculation and timezone conversion |
src/lib/prompt.ts |
System prompt with live calendar and service catalogue |
src/lib/notify.ts |
Telegram and WhatsApp delivery helpers |
src/lib/auth.ts |
JWT signing and verification |
src/db/schema.ts |
Conversations, messages, leads, bookings and processed events |
src/app/globals.css |
Design tokens, typography, RTL rules and accessibility primitives |
git clone https://github.com/condev-dev/nova-assistant.git
cd nova-assistant
npm installCreate .env.local from the example and fill in your credentials:
cp .env.example .env.local| Variable | Purpose |
|---|---|
DATABASE_URL |
Neon Postgres connection string |
GOOGLE_GENERATIVE_AI_API_KEY |
Gemini API key |
GEMINI_MODEL |
Model id, e.g. gemini-3-flash-preview |
TELEGRAM_BOT_TOKEN |
Bot token from BotFather |
TELEGRAM_WEBHOOK_SECRET |
Secret sent with every Telegram update |
OWNER_TELEGRAM_CHAT_ID |
Chat that receives booking notifications |
ADMIN_PASSWORD |
Password for the non-demo admin login |
ADMIN_SECRET |
32+ character secret used to sign admin JWTs |
WHATSAPP_* |
Reserved for the optional Meta Cloud API adapter |
Push the schema and start the app:
npm run db:push
npm run devOpen http://localhost:3000 for the product, http://localhost:3000/admin for the dashboard.
cloudflared tunnel --url http://localhost:3000 --protocol http2Then register the tunnel as the bot webhook:
curl "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/setWebhook" \
-d "url=https://YOUR-TUNNEL.trycloudflare.com/api/telegram" \
-d "secret_token=$TELEGRAM_WEBHOOK_SECRET"| Command | Description |
|---|---|
npm run dev |
Start the development server |
npm run build |
Production build |
npm run start |
Serve the production build |
npm run lint |
ESLint checks |
npm run db:push |
Apply the Drizzle schema to Postgres |
/adminis intentionally public in this demo build.- Records shown in the dashboard are a mix of one real test booking and clearly fictional demo entries.
- The assistant never invents prices, clients or metrics; unknown answers fall back to a human follow-up.
- Gemini free-tier quotas are limited, so the demo may show a temporary service message when the daily quota is exhausted.
Β© ConDev β All rights reserved.

