π¨ 2026 Premium Redesign β minimal yet premium (Notion Β· Linear Β· Vercel Β· Raycast Β· Stripe)
Learn smarter. Explore deeper. Grow faster.
π€ Multi-Provider AI Β· π Study Tools Β· π± Installable PWA Β· π Web + Telegram
- Name: AI Notebook
- Goal: An AI-powered study assistant that works as a modern installable web app (PWA), the original Telegram bot, sharing the same FastAPI backend and SQLite database.
- AI: Multi-provider with automatic fallback β Kimi (Moonshot) β Google Gemini β Groq. If one provider fails or is unconfigured, the next is tried automatically; if all fail, a graceful error is returned.
The original Telegram bot is fully preserved β it now benefits from the same multi-provider fallback automatically. A complete web interface (landing page, auth, dashboard, ChatGPT-style chat, 6 study tools, settings) is provided alongside it, now as a Progressive Web App that installs to Android/desktop.
- Providers: Kimi (primary), Gemini (secondary), Groq (tertiary) β all free-tier compatible, OpenAI-style chat APIs.
- Auto fallback chain:
Kimi β Gemini β Groq β graceful error. - Model selector: choose Auto / Kimi / Gemini / Groq in the chat header and in Settings; the choice is saved per user.
- Active model display: the chat shows which provider actually answered (badge next to the assistant name).
- Response caching (in-process, TTL configurable via
AI_CACHE_TTL), streaming (SSE), conversation memory, Markdown + code highlighting. - Status monitoring:
GET /api/ai/statusand/api/healthreport which providers are configured. - Security: API keys (
KIMI_API_KEY,GEMINI_API_KEY,GROQ_API_KEY) are read only from environment variables and never exposed to the frontend β all AI calls go through server-side routes.
manifest.json(icons, shortcuts, standalone display, theme/splash colors)- Service worker (
/sw.js) β app-shell caching, offline page (/offline.html), update notifications, background-sync hook - Install app button, standalone app mode, adaptive/maskable icons, network status banners
- Compatible with PWABuilder for Android APK generation
The project was fully renamed from βAI Notebookβ to βAI Notebookβ across every surface (dashboard, navbar, sidebar, login, signup, guest mode, metadata, titles, SEO, footer, settings, mobile UI, docs, loading screens). The JWT-salt constant and legacy deploy URL strings were intentionally left untouched so existing sessions and deployments keep working.
Sidebar β premium glass redesign (js/sidebar.js + css/sidebar.css)
- Expanded: floating glassmorphism panel (22px radius, blur + saturation, layered shadows) detached from the viewport edge, grouped navigation β Workspace / Study / Library / Account / Support β with meaningful Font Awesome icons per feature, gradient active pill + accent bar, smooth hover micro-interactions.
- Collapsed: not a shrunk sidebar but a macOS-Dock-style floating vertical glass rail (~76px) β centered 46px icon tiles, active-item glow ring, section dividers as hairlines, hover scale + tooltips, profile dropdown opens as a floating panel to the right.
- Expand/collapse button moved directly below the logo (Logo β toggle β nav β footer), full-width pill when expanded, square icon button in dock mode.
- Logo & avatar: circular glass container with a conic-gradient glow ring and spring hover animation; avatar is a circular gradient-ring badge with status dot.
- Accessibility:
aria-current,aria-expanded, focus-visible outlines, 44px+ touch targets, keyboard navigation,prefers-reduced-motionsupport. Mobile keeps the slide-in drawer with full labels.
Onboarding wizard (js/onboarding.js + css/onboarding.css)
- Shown once after every auth method (login / signup / guest) on the dashboard; a glass modal with animated step progress bar, emoji step headers, auto-advancing single-choice steps and multi-select chips.
- Steps: Education level β Primary study goal (14 options incl. UPSC/JEE/NEET/GATE) β Study interests (21 multi-select chips) β Daily study time β Preferred learning style β Experience level β Account & security preferences (display name, optional recovery email/phone, 2FA toggle, data-sync consent, notification + privacy preferences). No passwords, banking details or IDs are ever requested.
- Answers persist to the backend via a new
onboardingcategory onPUT /api/auth/settings(idempotentALTER TABLE user_settings ADD COLUMN onboardingmigration) and mirror tolocalStorage; the dashboard greeting personalizes to the chosen goal. Skippable at any point; confetti finish screen with a summary of picks.
A full premium UI/UX overhaul giving the app the look & feel of Notion / Linear / Vercel / Raycast / Stripe Dashboard β minimal yet premium. No functionality, auth, API, or Android code was removed; existing features were redesigned, not replaced.
Design system & theming
css/theme.cssβ premium design-token layer (loaded last so it overrides legacy tokens). Glassmorphism, soft shadows, consistent radius/spacing/typography scales, dark + light themes.- HSL accent system β 8 selectable accent colors (
data-accent="violet|indigo|blue|cyan|emerald|amber|rose|pink"); a single--accent-hhue drives the entire palette and updates instantly & globally. - Adaptive prefs via
<html data-*>: font scaling (data-font), density (data-density), high contrast (data-contrast), reduced motion (data-motion).
Animation (vanilla, no framework)
js/motion.jsβwindow.SSMotionβ the best motion approach for this vanilla multi-page app (Framer Motion is React-only). Provides scroll reveal (IntersectionObserver), universal click ripple, tilt, count-up numbers, staggered lists, page-transition feel, and persisted-preference application (applyPreferences/setPreference).- Respects
prefers-reduced-motionand the Accessibility βReduce motionβ toggle.
Component library
css/components.cssβ one consistent design system: buttons (primary/ghost/subtle/outline/danger/icon), inputs, toggle switches, segmented controls, chips/badges, tooltips, dropdowns, modals, progress bars, skeletons, alerts, tabs, breadcrumbs, empty states, upgraded toasts.
Command palette (Raycast-style)
css/command-palette.css+js/command-palette.jsβwindow.SSCommandβ instant search popup via Ctrl/β + K (or/). Pages + actions catalogue, filter chips (All / Pages / Actions / Recent), recent searches & recent chats, match highlighting, full keyboard navigation, empty-state. A.search-triggerpill is in every app topbar.
Sidebar redesign
js/sidebar.js+css/sidebar.cssβ grouped nav (Workspace / Insights) with a modern active indicator & hover effects. Profile card footer: expanded shows avatar + name + email + dropdown (View profile / Settings / Analytics / Logout); collapsed shows avatar + status dot + settings shortcut. Animated collapse/expand, persisted state, mobile drawer preserved.
Dashboard redesign
dashboard.html+css/dashboard-premium.css+js/dashboard.jsβ Linear/Vercel-style: stat cards with count-up, quick-action cards, weekly activity chart (Chart.js, accent-aware), study-progress ring (conic-gradient), AI usage panel, recent chats with empty state, and 4 derived achievement cards. All widgets derived client-side from the existing/api/statsβ no backend changes.
Settings expansion (/settings)
profile.html+js/profile.js+css/settings-premium.cssβ sticky vertical nav with 8 sections: Profile (photo, bio, education, goals), Security (password, 2FA UI, connected devices/sessions, danger zone), Privacy (visibility, activity, data download, clear history, login history), Appearance (theme light/dark/system, accent swatches, font size, density), Dashboard (default page, sidebar behavior, widget toggles), Notifications (email/push/AI/reminders/weekly summary), AI Preferences (model, length, creativity, difficulty, language), Accessibility (reduce motion, high contrast, keyboard nav, screen-reader).- Persists the 4 existing backend categories (
appearance/dashboard/notifications/ai_settings) as JSON blobs (no schema change); extended fields nest inside these blobs + mirror tolocalStorageand apply instantly viaSSMotion.
Responsive & accessible
- Verified across desktop / laptop / tablet / large monitor and mobile (390px) β no broken or overflowing layouts. Focus rings, keyboard shortcuts, reduced-motion and high-contrast support throughout.
Verified: all routes return
200; dashboard renders 4 stat cards, 4 quick actions, profile card, 4 achievements, chart + progress ring; Ctrl+K palette opens; settings shows 8 nav sections / 8 panels / 18 toggles / 5 segmented controls / 8 accent swatches; selecting an accent applies it globally & instantly; zero JS errors (only harmless Vercel Speed-Insights 404 locally).
The app is now a full AI-powered Learning Operating System: every topic you type opens a complete, cached, AI-generated learning workspace.
One page, 12 AI-powered tabs β each section is generated once, cached server-side in SQLite (topic_artifacts), and instantly re-served; βRegenerateβ (?refresh=1) creates a fresh version:
| Tab | What it does |
|---|---|
| π§ Overview | Auto-generated intro (definition, importance, applications, misconceptions) |
| π Summary | Deep structured summary with sections & key takeaways |
| π Notes | Exam-ready study notes (definitions, formulas, mnemonics) |
| πΈ Mind Map | Interactive SVG mind map β custom tidy-tree layout, pan/zoom (wheel + drag), expand/collapse nodes, click a node for an explanation popover |
| π£ Roadmap | Beginner β Intermediate β Advanced β Expert learning path with checkbox progress tracking (autosaved via PUT /api/topics/{id}/progress) |
| π° Timeline | Historical evolution of the topic (8β14 milestones) |
| β Quiz | MCQ / True-False / Fill-in questions across 4 difficulties (easy/medium/hard/expert, cached per difficulty), scoring + explanations |
| π Flashcards | 3D flip cards, prev/next, keyboard (Space/β/β), bookmarkable |
| βοΈ Compare | AI comparison table vs any other topic (cached per pair) |
| ποΈ Practice | Worked problems & exercises |
| π¬ AI Chat | Topic-aware SSE streaming tutor with suggested prompts |
| π Resources | Curated books/courses/videos/communities |
Plus: pin/favorite topics, emoji headers, and Export (Markdown / HTML / Word / PDF-via-print) of all generated content.
- Learn-anything launcher β type any topic β instant AI workspace
- AI Workspace grid β 10 tool cards (Notes, Summary, Mind Map, Roadmap, Quiz, Flashcards, Chat, Practice, Compare, Timeline) that deep-link into the matching workspace tab
- My Topics β resume any previously opened workspace
- Trending Topics β 9 curated one-click starters (AI, ML, Quantum Computing, Blockchain, Cybersecurity, Physics, Mathematics, Biology, History)
- Recent Notes with hover actions: π Pin Β· β Favorite Β· π Duplicate Β· π Share Β· π Delete
- Updated stats: Topics started Β· Notes & quizzes Β· AI generations Β· Total chats
The command palette now performs debounced server-side search (GET /api/search?q=) across topics, notes, saved chats, and quizzes, merged with pages/actions β plus a βLearn ββ with AIβ fallback action that opens a new workspace for anything you type.
- Tables:
topics(pin/favorite/progress JSON) &topic_artifacts(UNIQUE(topic_id, kind, variant)upsert cache);notesgainedpinned/favoritecolumns (idempotent migration) - Routes (
backend/routes/topics.py): topics CRUD,POST /api/topics/{id}/generate/{kind}(overview/summary/notes/practice/resources/mindmap/roadmap/timeline/quiz/flashcards/compare),POST /api/topics/{id}/chat(SSE),GET /api/search, note pin/favorite/duplicate endpoints - AI (
backend/ai.py): per-section prompts, strict-JSON generators for mind map / roadmap / timeline / quiz, comparison generator, topic-tutor system prompt β all through the existing multi-provider fallback chain
Animated hero, typing text effect, particles.js background, GSAP entrance animations, AOS scroll reveals, glassmorphism cards, animated counters, feature showcase, testimonials, FAQ accordion, CTA band, footer.
- Sign up (
/signup), Log in (/login), Forgot/Reset password (/forgot) - PBKDF2-SHA256 password hashing (standard library β Vercel-safe)
- JWT session tokens (HS256, stdlib implementation)
- Profile page (
/profile) β edit name, change password - Secure logout
Modern sidebar, user statistics (chats, messages, AI responses, notes/quizzes), recent chats, daily activity line graph (Chart.js), skeleton loaders.
ChatGPT-style UI, streaming responses (SSE), Markdown rendering, code syntax highlighting (highlight.js) with copy button, download chat (Markdown), chat history sidebar, new chat, delete chat, auto-titling.
- Notes Generator (saved & re-viewable)
- Quiz Generator (interactive MCQ with scoring & explanations)
- Flashcards (3D flip animation)
- Study Planner (day-by-day plan)
- PDF Summarizer (upload PDF/DOCX/TXT or paste text)
- Homework Helper (step-by-step explanations)
PDF (pypdf), DOCX (python-docx), TXT, and image storage β with server-side text extraction and AI summarisation.
JWT auth Β· password hashing Β· Pydantic input validation Β· in-memory rate limiting Β· secret webhook verification Β· all secrets from environment variables.
/start, /help, /add, /list, /delete + AI fallback. Shares the same DB questions table and the same Groq client.
| Path | Description |
|---|---|
/ |
Landing page |
/login, /signup, /forgot |
Authentication |
/dashboard |
User dashboard |
/chat, /chat?id=<id> |
AI chat interface |
/tools, /tools#<tab> |
Study tools |
/profile |
Profile & settings |
/telegram |
Telegram bot info & integration page |
| Method | Path | Body |
|---|---|---|
| POST | /signup |
{name,email,password} |
| POST | /login |
{email,password} |
| POST | /forgot-password |
{email} |
| POST | /reset-password |
{token,password} |
| GET | /me |
β (Bearer) |
| PUT | /profile |
{name} (Bearer) |
| PUT | /change-password |
{current_password,new_password} (Bearer) |
| Method | Path | Notes |
|---|---|---|
| GET/POST | /chats |
list / create |
| GET/PUT/DELETE | /chats/{id} |
fetch / rename / delete |
| POST | /chats/{id}/stream |
{content} β SSE token stream |
| GET | /stats |
dashboard statistics |
POST /notes, GET /notes, DELETE /notes/{id} Β· POST /quiz, GET /quiz, DELETE /quiz/{id} Β· POST /flashcards Β· POST /plan Β· POST /summarize Β· POST /homework
POST /upload Β· GET / Β· POST /{id}/summarize
POST /api/webhook Β· GET /api/set-webhook Β· GET /api/health
- Storage: SQLite (single shared file). Path auto-switches to
/tmpon Vercel. - Tables:
questionsβ bot's personal Q&A library (unchanged)usersβ web accounts (telegram_idlinks bot β web)chats,messagesβ AI conversationsnotes,quizzesβ saved study artefactsuploadsβ file metadata + extracted text
- Data flow: Browser β Hono/FastAPI API (JWT) β shared
backend.databaseβ SQLite; AI requests βbackend.aiβ Groq. The Telegram bot uses the same modules.
Note: Vercel's
/tmpis ephemeral. For persistent production storage, setDB_PATHto a mounted volume or a hosted SQLite service (e.g. Turso).
AINotebook/ (repo root)
βββ api/
β βββ index.py # Vercel entry β backend.main:app
β βββ main.py # Compatibility shim (old webhook path still works)
βββ backend/
β βββ main.py # FastAPI app: web API + bot webhook + static frontend
β βββ database.py # Shared SQLite layer (bot + web)
β βββ auth.py # PBKDF2 hashing + JWT + FastAPI dependency
β βββ ai.py # Study logic (notes/quiz/flashcards/plan/summary/hw)
β βββ groq_client.py # Groq API (complete + streaming)
β βββ ratelimit.py # In-memory rate limiter
β βββ routes/
β βββ users.py # Auth & profile
β βββ chat.py # Chat, stats, study tools
β βββ files.py # Uploads & extraction
βββ telegram_bot/
β βββ bot.py # The Telegram bot (shared backend, unchanged behaviour)
βββ frontend/
β βββ index.html login.html signup.html forgot.html
β βββ dashboard.html chat.html tools.html analytics.html profile.html telegram.html
β βββ css/ (style, auth, dashboard, chat, tools, analytics, responsive,
β β premium-design-system, sidebar-mobile,
β β βββ 2026 Premium layer (loaded last to override legacy) βββ
β β theme, components, sidebar, command-palette,
β β dashboard-premium, settings-premium, auth-premium)
β βββ js/ (app, main, auth, sidebar, dashboard, chat, tools, profile,
β config, analytics-tracker, analytics-dashboard, pwa, confetti,
β βββ 2026 Premium layer βββ
β motion β window.SSMotion,
β command-palette β window.SSCommand)
βββ requirements.txt
βββ vercel.json
βββ .env.example
- Open
/β Get started β create an account. - Land on the Dashboard to see your stats.
- Open AI Chat to ask questions (streaming, Markdown, code copy, download).
- Open Study Tools to generate notes, quizzes, flashcards, plans, summaries or homework help.
- Upload a PDF/DOCX/TXT in the Summarizer for an instant summary.
- Manage your account in Profile.
pip install -r requirements.txt
cp .env.example .env # fill in GROQ_API_KEY (and TELEGRAM_BOT_TOKEN if using the bot)
uvicorn backend.main:app --reload --port 3000
# open http://localhost:3000| Variable | Required | Purpose |
|---|---|---|
GROQ_API_KEY |
yes (for AI) | Groq API key |
GROQ_MODEL |
no | defaults to llama-3.3-70b-versatile |
JWT_SECRET |
recommended | stable token signing secret (set in prod) |
TELEGRAM_BOT_TOKEN |
bot only | Telegram bot token |
WEBHOOK_SECRET |
optional | verifies Telegram webhook calls |
The frontend stays on Vercel. The backend (this FastAPI app) is now a standalone API deployed to Render or Railway. See
DEPLOYMENT.mdfor full step-by-step instructions.
- Backend β deploy this repo to Render (
render.yaml) or Railway (railway.json).- Build command:
pip install -r requirements.txt - Start command:
gunicorn backend.main:app -k uvicorn.workers.UvicornWorker -w 2 -b 0.0.0.0:$PORT --timeout 120 - Health check:
/api/health
- Build command:
- Copy the backend URL (e.g.
https://ai-notebook.onrender.com). - Frontend β edit
frontend/js/config.js, setwindow.SS_API_BASE = "https://ai-notebook.onrender.com";and redeploy on Vercel. - On the backend, set
ALLOWED_ORIGINS=https://<your-app>.vercel.app. - Telegram bot (optional): visit
https://<backend-url>/api/set-webhookonce.
- Platform: Vercel (frontend) + Render/Railway (backend API) Β· Status: β Ready
- Tech: FastAPI + Gunicorn/Uvicorn + Vanilla JS + Chart.js + Groq + MongoDB Atlas (analytics)
- Last Updated: 2026-06-21
- Sidebar layout root-cause fix:
sidebar-mobile.csspreviously set.sidebar { position: fixed }as a base rule (all widths) and only restoredstickyat β₯1025px, while the mobile breakpoint was 880px. This pulled the sidebar out of flow on desktop/tablet, so the flex shell stopped reserving its column and the dashboard content collapsed / appeared pushed down (most visible in guest mode). Sidebar layout is now consolidated into a single source of truth (sidebar-mobile.css) with one consistent 880px breakpoint: sticky/in-flow on desktop, fixed off-canvas drawer on mobile. Duplicate.sidebar/.side-*/.side-overlayrules were removed fromdashboard.css. - Mobile sidebar now works in guest mode:
sidebar.jsno longer bails out (if (!SS.requireAuth()) return;) before wiring the hamburger. It renders + wires the drawer immediately and performs guest login in the background, refreshing the footer in place (no reload loop). - Drawer UX: open/close via hamburger, backdrop tap, ESC, nav-item tap; backdrop blur; slide animations; safe-area padding; β₯48px tap targets;
aria-expanded/aria-hiddenhandled per breakpoint. - Telegram page added: new
/telegrampage + sidebar nav item + backend route (no more 404). - Branding: removed gradient/badge boxes painted behind the official logo (sidebar header on app pages and the offline page). The uploaded logo (
/assets/logo.png) is now shown cleanly with preserved proportions everywhere.
- Email delivery for password-reset tokens (currently returned directly for the demo flow).
- Optional OCR for uploaded images.
- Linking a Telegram account to a web account via
telegram_idin the UI. - Migrating from ephemeral SQLite to a hosted DB (Turso) for durable Vercel storage.
