Ayurveda Reader
A web app for reading classical Ayurvedic texts: 9 books, 841 chapters and more than 34,500 verses in the original, transliteration and translation. I designed the interface, built a design system with light and dark themes, drew 91 icons, thought through the mobile version and implemented everything in plain JavaScript
01 / scope and task
A library of primary sources that is comfortable to read on any screen
The original task was to make readable what is usually read in PDFs and scans: Sanskrit text next to scholarly transliteration and translation, commentaries and terms with explanations. Any verse should be found in seconds, and a long chapter should be readable without eye strain
So the interface works as a book and a reference at the same time: contents and sections on the left, a calm text column on the right. Around reading grew an encyclopedia, glossaries, home remedies, a food timing table and a constitution test — and all of it lives in one component system
02 / interface structure
Left navigation, one reading column and nothing extra
The screen is built from two zones. The 280 px left column is navigation: the logo, language and theme switches, search across all books, a book selector, chapters by part (sthana) and ten app sections. The right area is content: a welcome and book cards on the home page, a narrow text column with a comfortable line length in the reader
A thin strip with links to the Telegram channel and bot and a visitor counter is fixed at the bottom, and above it sits a collapsed medical disclaimer that can be closed. On a phone the left column turns into a slide-in menu
Anatomy of a verse card
- Verse number11 px, 700, small caps with 0.88 px tracking, color --verse-num
- DevanagariNoto Sans Devanagari, 18 px, 36 px line height — Sanskrit is read large
- IASTGeorgia italic, 14 px, a calm grey-brown — scholarly transliteration
- TranslationGeorgia, 15.5 px, line height 1.82 — the main layer of meaning
- Actionsshare the verse, read Sanskrit, Russian or English aloud (Web Speech API)
- Commentarya collapsible "Commentary" block with a green bar on the left and the author
03 / screens
Nine sections — one system
The sections differ in content but are built from the same parts: the same cards, chips, search fields, icons and spacing. Thanks to this the user does not learn the interface again on every screen
04 / design system
A full design system: colors, fonts, icons, components and states
The design system lives in CSS variables and one shared set of components — every screen stands on it. Below it is taken apart completely: color tokens for two themes, three font families and a type scale, 91 icons, components live, as well as radii, shadows, layers and animations. All examples on this page are real HTML, not pictures
Colors
A warm "paper" palette, light and dark themesThe palette is built around warm paper and a brown "ink" accent line: a warm cream background, near-black brown text and a dark gold accent. There are no cold colors in the interface — only icon color coding and the three dosha colors in the test use them. All colors are variables on :root, and the dark theme overrides them with the body.dark class
Light theme
Dark theme
Dosha colors in the constitution test
The accent changes between themes: #7a5c2e (dark gold) in light, #c9a96e (light gold) in dark, so the contrast of buttons and links is kept. Interactive states take their color from --bg-hover and --bg-active, and term highlighting from --term-bg and --term-border
Typography
Georgia · system-ui · Noto Sans DevanagariThe system has three font families, each with its own role. Georgia (serif) is for headings, translation and transliteration: it gives a "book" tone. system-ui is for the interface and body text: the native font of the operating system, zero loading. Noto Sans Devanagari is the only loaded font, needed for Sanskrit
| Role | Family | Size / line height | Weight | Style / tracking |
|---|---|---|---|---|
| Headings | Georgia, Times New Roman, serif | 27–32 px / 34–38 px | 700 | normal |
| Body text | system-ui, -apple-system, sans-serif | 15–16 px / 27 px | 400 | normal |
| Sanskrit | Noto Sans Devanagari, serif | 18 px / 36 px | 400 | +0.36 px |
| IAST and translation | Georgia | 14–15.5 px / 25–28 px | 400 | italic for IAST, +0.14 px |
| Labels | system-ui | 9–11 px / 16 px | 700 | small caps, +0.8–1 px |
| Buttons and fields | Arial | 11–13 px | 600 | +0.24–0.33 px |
Four reading sizes
The user picks the text size with the "A" button and it is saved in the browser: the scale applies to body text and all derived sizes
Small
Normal
Large
Extra large
Icons
91 line SVGs, one styleAll icons were redrawn in a single style: a 24×24 grid, a 1.8 px line with rounded ends and a rounded colored backing with a 6.5 radius and 16% opacity. The backing and line color is one and the same, different for each icon. This helps the eye tell sections apart, and the menu comes out even. Icons are stored as a JS dictionary "key → color + outline" and inserted into the interface through one function
- Grid
- 24 × 24 px, viewBox 0 0 24 24
- Backing
- rect 21 × 21, rx 6.5, fill-opacity 0.16
- Line
- stroke 1.8, round caps and joins
- Color
- one color per icon: backing and outline
Section menu · 11
Interface · 17
Books · 9
Food timing · 9
Encyclopedia · 45
Icons look the same in light and dark themes: the backing is translucent, so it "takes color" from the background
Components
Buttons, fields, cards, verse, commentary, testComponents are built live from the same tokens — hover to see the states. Below are the main ones
Buttons, chips and switches
All interactive elements are "pills" or tiles with an 8–20 px radius; the active state is filled with --bg-active, the main action with the accent color
Input fields and book selector
Search the text…CHOOSE A BOOK
Section menu
SECTIONS
Chapter list
VERSE 1
रागादि-रोगान् सततानुषक्तान् अ-शेष-काय-प्रसृतान् अ-शेषान्
rāgādi-rogān satatānuṣaktān a-śeṣa-kāya-prasṛtān a-śeṣān
Now we shall expound the chapter Ayushkamiya (the wish for long life) – so said Atreya and the other sages.
VERSE 1
रागादि-रोगान् सततानुषक्तान् अ-शेष-काय-प्रसृतान् अ-शेषान्
rāgādi-rogān satatānuṣaktān a-śeṣa-kāya-prasṛtān a-śeṣān
Now we shall expound the chapter Ayushkamiya (the wish for long life) – so said Atreya and the other sages.
▸ CommentaryI.I. Vetrov
Term highlighting
…who destroyed diseases such as raga (passion) and moha (delusion)…
Book and section cards
Three constitution types and how to find your own.
Key plants: properties, use and dosage.
Test and timeline
States
- Defaultcalm state
- Hover--bg-hover, accent border, card lifts by 2 px
- Active--bg-active and heavier text
- Focusfocus-visible: an outline; for fields — an accent border
- Disabledopacity 0.4
- Playing--accent-glow on the read-aloud button
Spacing, radii, shadows, layers, animations
The remaining tokens of the systemBesides color and type, the system describes shape and behavior: which elements get which radii, how deep a card "lies", what is above what and how everything animates
| Radii | |
|---|---|
| 2–4 px | term highlighting, small elements |
| 8 px | --radius: buttons, fields, verse cards |
| 10–14 px | book and section cards, action buttons |
| 16–20 px | chips, chapter header buttons |
| 24 px and 999 px | pills, progress and switches |
| 50% | round icons and avatar |
| Shadows | |
|---|---|
| --shadow-sm | 0 1px 3px rgba(0,0,0,.06) |
| --shadow-md | 0 4px 16px rgba(0,0,0,.08) |
| Popover | 0 6px 24px rgba(0,0,0,.25) |
| Modal | 0 12px 48px rgba(0,0,0,.3) |
| Sidebar | 4px 0 32px rgba(0,0,0,.22) |
| Focus ring | 0 0 0 2px var(--accent) |
| z-index layers | |
|---|---|
| 10 | sticky elements |
| 200–300 | left panel and overlay |
| 350–500 | modals and chat |
| 9000–9999 | tooltips and banners |
| Animations and transitions | |
|---|---|
| --transition | 0.18s ease — hover and states |
| versePulse | verse highlight when following a link |
| verseTargetPulse | a soft pulse of the target verse |
| chatDots | typing indicator in the chatbot |
| Breakpoints | |
|---|---|
| ≤ 700 px | main column, lists, cards |
| ≤ 640 px | chapter header, buttons, density |
| ≤ 600 px | the left panel becomes a slide-in menu |
Dark theme
body.dark · token overridesThe dark theme is not an inversion but a separate palette: the background became dark brown, the accent light gold, cards slightly lighter than the background. The switch is in the left panel header and the choice is remembered in the browser. Pictures and icons do not change: the icon backings are transparent
05 / mobile version
The phone is the main reading scenario
People mostly read on the phone, so the mobile version is not a shrunken desktop. The left panel turns into a slide-in menu, the reading interface takes the full width, and long lists collapse
06 / technical description
A static site in plain JavaScript with no bundler
The app is a static single-page site: HTML, one CSS file and ES modules with no frameworks or build step. It opens right in the browser, needs no registration and works offline as a PWA after the first visit
Architecture
- Single-page site with hash routing: a link like
#ashtanga/c0leads to a specific chapter. - ES modules: app.js is the core, books.js the book registry, glossary, diseases, quiz, foodtable, cabinet, chatbot, icons.
- Data: every book is a separate file loaded when opened, so the first screen is light.
- Texts were extracted from printed editions and brought to a single "original → IAST → translation" format.
PWA and offline
- Service worker: Cache First for static files and Network First for data; the cache is versioned (
ayurveda-v565). - Manifest: standalone mode, 192 and 512 px icons, maskable icons and an "Ashtanga Hridaya" shortcut.
- Offline banner says that books already read are available.
- Cache busting: one
?v=NNversion in index.html, app.js, books.js and sw.js.
Browser features
- Search across all books on the client with highlighted matches and a result counter.
- Read aloud for a verse through the Web Speech API: Sanskrit (hi-IN), Russian and English.
- Share API for a link to a verse, and copying the link.
- Settings in localStorage: theme, text size, interface language.
- Bilingual: the interface and data have Russian and English fields (*_en).
Server side
- Expert cabinet: sign-in through the Telegram Login Widget, no passwords; chapter edits and crowd-sourced suggestions.
- Backend: serverless functions on Vercel; if they are unavailable the site stays static.
- AI assistant: search over loaded verses and a Gemini API call.
- Telegram bot and channel: subscription and a daily post with a verse.
- Analytics: a visitor counter and Yandex.Metrica.
| File | Size | Purpose |
|---|---|---|
| style.css | ~92 KB | a single stylesheet: tokens, components, two themes, 3 breakpoints |
| app.js | ~201 KB | core: routing, reading, search, read aloud, settings |
| books.js | ~244 KB | registry of nine books, part and chapter names (RU/EN) |
| glossary.js | ~206 KB | 397 Sanskrit terms and in-text hints |
| quiz.js | ~21 KB | 60 questions and constitution scoring |
| icons.js | ~14 KB | 91 icons and the icon(key) function |
| sw.js | ~3 KB | service worker for offline mode |
Snippet: an icon as a function
// key → color and outline; the backing and the line share one color export function icon(key) { const [c, paths] = G[key]; return `<svg class="app-icon" viewBox="0 0 24 24" fill="none"> <rect x="1.5" y="1.5" width="21" height="21" rx="6.5" fill="${c}" fill-opacity="0.16"/> <g stroke="${c}" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">${paths}</g></svg>`; }
07 / accessibility and details
Attention to detail: from a skip link to read aloud
- A "Skip to content" link at the start of the page and meaningful aria labels on buttons.
- A live region for screen readers and a separate offline banner with role=status.
- Text size in four levels, the choice is saved.
- A dark theme for evening reading.
- Read-aloud for a verse: Sanskrit, Russian, English.
- Visible keyboard focus and tooltips on action icons.
- A medical disclaimer that can be closed but is always available.
- A sources block in every encyclopedia article.
08 / SEO and metadata
What a search engine sees
The page has extended metadata: a title and description with key queries ("classical Ayurveda samhitas", "Ashtanga Hridaya", "Charaka Samhita", "prakriti test"), canonical, Open Graph and Twitter Card with a 1200×630 image, a manifest and home-screen icons. Site search and encyclopedia articles give the text a "long tail" of queries
- Title: "Classical Samhitas of Ayurveda — a free online library"
- A description with numbers: verses, books, glossary, encyclopedia
- Open Graph and Twitter Card, a 1200×630 image
- Canonical, manifest, apple-touch-icon
- Keywords: ayurveda, samhita, Ashtanga Hridaya, Charaka, Sushruta
09 / links
The live project and source code
| Site | ayurvedareader.ru |
| Source code | github.com/maksutovdesign/ayurveda-reader |
| Telegram channel | @AyurvedaReader |
| Telegram bot | @AyurvedaReaderBot |
| Project page | Ayurveda Reader — as a product and a build |
Discuss a project
Need an interface like this?
I will design a web app or site from scratch: structure, design system, responsive layouts and markup. Tell me about your task — I will reply within a day
Order a design
▸ CommentaryI.I. Vetrov