From e9cd12dda6d679eaf9cd87c22e5c89de089760c3 Mon Sep 17 00:00:00 2001 From: arsam Date: Fri, 18 Sep 2026 23:33:04 +0330 Subject: [PATCH] Import remaining project documentation and reference notes Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality. --- app/AGENTS.md | 336 ++ app/ARCH.md | 155 + app/CLAUDE.md | 176 + app/DEPLOY.md | 1013 ++++ app/DEPLOY_RESPONSIVE_FIX.md | 263 + app/Elsevier-Article.md | 632 ++ app/Elsevier.md | 479 ++ app/F1-P.md | 69 + app/Fonts/Vazirmatn/AUTHORS.txt | 9 + app/Fonts/Vazirmatn/CHANGELOG.md | 1512 +++++ app/Fonts/Vazirmatn/OFL.txt | 93 + app/Fonts/Vazirmatn/README.md | 72 + app/Fonts/Vazirmatn/راهنما.txt | 5 + app/Frontend-6226.md | 5161 +++++++++++++++++ app/GEMINI.md | 103 + app/GLM-5.1-6126.md | 2632 +++++++++ app/IMAGE-GEN.md | 55 + app/International Grand Enter.md | 2717 +++++++++ app/MEMORY.md | 101 + app/MOBILE_FIX_COMPLETE.md | 203 + app/NEXT-PLAN-O8.md | 111 + app/PHASE10.md | 145 + app/PHASE11.md | 363 ++ app/PHASE16.md | 86 + app/PHASE4.md | 55 + app/PHASE7.md | 237 + app/PHASE8.md | 364 ++ app/PHASE9.md | 832 +++ app/PHASES.md | 341 ++ app/README!.md | 31 + app/RESPONSIVE_FIX_SUMMARY.md | 194 + app/SECURITY.md | 186 + app/SEO-ARCH.md | 73 + app/SEO-RECOVERY-PLAN.md | 67 + app/TekRAG-Persian-Article.md | 434 ++ app/article-ai-agents.txt | 82 + app/article-gem.txt | 176 + app/backend/README.md | 68 + app/deep-research-report.md | 742 +++ .../plans/2026-05-02-phase11-track1.md | 159 + app/festival-submission/MANIFEST.md | 47 + app/public/robots.txt | 18 + global/public/robots.txt | 7 + 43 files changed, 20604 insertions(+) create mode 100644 app/AGENTS.md create mode 100644 app/ARCH.md create mode 100644 app/CLAUDE.md create mode 100644 app/DEPLOY.md create mode 100644 app/DEPLOY_RESPONSIVE_FIX.md create mode 100644 app/Elsevier-Article.md create mode 100644 app/Elsevier.md create mode 100644 app/F1-P.md create mode 100644 app/Fonts/Vazirmatn/AUTHORS.txt create mode 100644 app/Fonts/Vazirmatn/CHANGELOG.md create mode 100644 app/Fonts/Vazirmatn/OFL.txt create mode 100644 app/Fonts/Vazirmatn/README.md create mode 100644 app/Fonts/Vazirmatn/راهنما.txt create mode 100644 app/Frontend-6226.md create mode 100644 app/GEMINI.md create mode 100644 app/GLM-5.1-6126.md create mode 100644 app/IMAGE-GEN.md create mode 100644 app/International Grand Enter.md create mode 100644 app/MEMORY.md create mode 100644 app/MOBILE_FIX_COMPLETE.md create mode 100644 app/NEXT-PLAN-O8.md create mode 100644 app/PHASE10.md create mode 100644 app/PHASE11.md create mode 100644 app/PHASE16.md create mode 100644 app/PHASE4.md create mode 100644 app/PHASE7.md create mode 100644 app/PHASE8.md create mode 100644 app/PHASE9.md create mode 100644 app/PHASES.md create mode 100644 app/README!.md create mode 100644 app/RESPONSIVE_FIX_SUMMARY.md create mode 100644 app/SECURITY.md create mode 100644 app/SEO-ARCH.md create mode 100644 app/SEO-RECOVERY-PLAN.md create mode 100644 app/TekRAG-Persian-Article.md create mode 100644 app/article-ai-agents.txt create mode 100644 app/article-gem.txt create mode 100644 app/backend/README.md create mode 100644 app/deep-research-report.md create mode 100644 app/docs/superpowers/plans/2026-05-02-phase11-track1.md create mode 100644 app/festival-submission/MANIFEST.md create mode 100644 app/public/robots.txt create mode 100644 global/public/robots.txt diff --git a/app/AGENTS.md b/app/AGENTS.md new file mode 100644 index 0000000..6392506 --- /dev/null +++ b/app/AGENTS.md @@ -0,0 +1,336 @@ +# Repository Guidelines + +## Project Structure + +Teknav is a Persian RTL React SPA (`teknav.ir`) with a Fastify/PostgreSQL/Redis backend. The Vite entry is `index.html` → `src/main.jsx`. Global styles, fonts, and animation primitives live in `src/styles/global.css`. Main frontend modules at repo root: `teknav-app.jsx`, `teknav-ui.jsx`, `teknav-home.jsx`, `teknav-articles.jsx`, `teknav-pages.jsx`, `teknav-auth.jsx`, `teknav-admin.jsx`, `teknav-profile.jsx`, `teknav-data.js`, `teknav-store.js`. Runtime assets in `public/`; font archives in `Fonts/`. Backend in `backend/` with Fastify sources in `backend/src/` and Prisma in `backend/prisma/`. + +## Dev Commands + +**Frontend** (repo root): +- `npm run dev` — Vite dev server on **port 3009**, proxies `/api` → `http://localhost:3010`. Backend must be running first. +- `npm run build` — runs SEO artifact generation, OG image generation, Vite build, CDN/responsive checks, static article page generation, and gzip/brotli compression. +- `npm run preview` — preview built `dist/` on **port 4173**. +- `npm run preflight:prod` — static production readiness audit for env templates, nginx SSE/credential protection, required scripts, generated-engine safety, and migration/test posture. +- `npm run seo:sitemap` — regenerate `public/sitemap.xml`, `public/robots.txt`, `public/feed.xml` from `teknav-data.js`. +- `npm run og:images` — generate local Open Graph images into `public/images/og/` from article metadata. Run on Linux after dependencies are installed. +- `npm run check:seo` — audit current Persian indexable articles for canonical, meta, OG image, review date, heading structure, entity coverage, and body-depth warnings. + +**Backend** (`backend/`): +- `npm run dev` — `tsx watch src/server.ts` on **port 3010** (env `PORT`, default 3010). +- `npm run build` — `tsc` type-check and compile. +- `npm run prisma:generate` — regenerate Prisma client after schema changes. +- `npm run prisma:apply` — apply schema (migrations if present, else `db push --skip-generate`). +- `npm run seed` — seed Postgres via `tsx prisma/seed.ts`. +- `npm run publish:due` — publish scheduled articles (also runs via systemd timer in prod). + +**Dev startup order**: PostgreSQL + Redis → `cd backend && npm run dev` → `npm run dev`. + +Backend tests are `node:test` smoke/contract checks. `cd backend && npm test` auto-skips endpoint assertions when no backend is reachable; use `TEST_REQUIRE_SERVER=1 npm test` against a running backend for strict validation. + +Validate with `npm run preflight:prod`, `npm run check:seo`, `npm run build` (frontend), `cd backend && npm run build`, and strict backend tests against a running API. + +## Hard Constraints + +- **Zero CDN.** No external JS, CSS, fonts, images. `npm run build` rejects any CDN URL in `dist/`. +- **Persian-first RTL.** All UI copy in Persian. Use logical CSS properties over `left`/`right`. +- **ES modules, named exports.** JSX uses Vite automatic runtime — import hooks directly, not `React`. +- **No mock admin data.** Admin/panel views (`teknav-admin.jsx`) must use backend API only (`src/lib/admin-api.js`). `teknav-data.js` and `teknav-store.js` are seed/reference data, not UI fallbacks. +- **Production is native Linux/systemd + nginx.** No Docker. Deploy docs in `DEPLOY.md`. +- **`ACCOUNTS.md`** is gitignored and nginx-blocked. Never commit or expose it. Seed credentials are in `backend/prisma/credentials.json`. + +## Ports & Proxy + +| Service | Dev Port | Prod | +|---|---|---| +| Frontend (Vite) | 3009 | nginx → +`dist/` | +| Preview (built) | 4173 | — | +| Backend (Fastify) | 3010 | nginx proxy | + +Vite dev proxies `/api` to `http://localhost:3010` for same-origin cookies. Production nginx handles path-based routing. Backend health: `GET /api/v1/health`; strict readiness: `GET /api/v1/ready` returns 503 if PostgreSQL or Redis is unavailable. Frontend clients may call unversioned `/api/*`; `src/lib/api.js` rewrites those calls to `/api/v1/*`. + +## Auth & Accounts + +Argon2id hashing, Redis sessions (`tek_sid`), CSRF double-submit cookie (`tek_csrf`). Login by **email** or **`@username`**. Every seeded account must have a URL-safe username. Writer-admin accounts (آرسام صباغ, رادمان قلیچی, سیداحمدرضا محجوب) in `backend/prisma/credentials.json` use `resetPasswordOnSeed: true` — remove after production password rotation. + +## Schema & Seed Workflow + +When changing `backend/prisma/schema.prisma`: run `prisma:generate` before backend build/type-check, then `prisma:apply`. +For production/Linux deployment, run `cd backend && npm ci && npm run prisma:generate && npm run prisma:apply` on the Linux host after uploading code. Never copy Windows-generated Prisma engine files (`backend/query_engine*.node`, `backend/schema-engine*`) or local `node_modules` into production. +When changing `teknav-data.js` slugs/dates: run `npm run check:seo` and `npm run seo:sitemap`. +When changing article Open Graph metadata: run `npm run og:images`, `npm run check:seo`, and `npm run seo:sitemap` on Linux. +When changing seed logic: run `cd backend && npm run seed` against running PostgreSQL/Redis. + +## Phase 9 Files + +Phase 9 adds real publication features across frontend and backend: + +- `backend/src/routes/public.ts` — related articles, public article SEO fields, public series, newsletter unsubscribe, saved-article default reading-list sync. +- `backend/src/routes/comments.ts` — real comment like/unlike API, like counts, and liked-by-me flags. +- `backend/src/routes/lists.ts` — authenticated reading-list CRUD, add/remove, and reorder. +- `backend/src/routes/analytics.ts` — authenticated writer/editor article analytics. +- `backend/src/routes/admin.ts` — admin analytics, review workflow, newsletter campaigns, article series, and article SEO field writes. +- `backend/prisma/schema.prisma` — `ArticleViewLog`, `CommentLike`, `NewsletterCampaign`, `ArticleSeries`, `ArticleReview`, `ReadingList`, and new article SEO fields. +- `teknav-admin.jsx` — API-backed analytics, review, newsletter, and series panels. +- `teknav-articles.jsx` — comment likes and API-backed related articles. +- `teknav-pages.jsx` / `teknav-app.jsx` — public `/series/:slug` route. +- `scripts/generate-seo.mjs` — canonical/dateModified/metaDescription sitemap and full-content RSS. +- `scripts/generate-og-images.mjs` — local OG image generation. + +## Phase 10 Files + +Phase 10 expands SEO growth, trust, and publication readiness: + +- `PHASE10.md` — active Phase 10 checklist and Linux validation status. +- `teknav-data.js` — topic hub metadata, glossary term data, and SEO seed/reference content. +- `teknav-pages.jsx` — topic hubs, glossary pages, author pages, tag pages, series pages, and newsletter archive pages. +- `src/lib/seo.jsx` — Article, CollectionPage, ProfilePage, DefinedTerm, FAQPage, ItemList, BreadcrumbList, canonical, robots, and Google Discover meta handling. +- `scripts/generate-seo.mjs` — sitemap, robots, global feed, topic feeds, author feeds, and glossary URL generation. +- `teknav-articles.jsx` — public article detail, table of contents, Discover hero image, correction notices, verified author badges, comparison table styles, comments, sharing, and engagement tracking. +- `teknav-admin.jsx` — admin/writer editor, Phase 10 quality metadata, comparison article template, correction submission, verified author management, role dashboards, SEO/analytics panels. +- `teknav-auth.jsx` / `teknav-ui.jsx` — email or `@username` login, Google/GitHub OAuth entry points, and SMS 2FA login completion. +- `teknav-profile.jsx` — profile editing, phone verification, SMS 2FA toggle, public profile trust badges, reading history, and follows. +- `public/manifest.json` / `public/service-worker.js` / `index.html` — PWA manifest, service worker registration, article offline cache, and installability. +- `backend/src/routes/monetization.ts` — job board API, job submissions, and course listing API. +- `backend/src/routes/errors.ts` — first-party client error capture for self-hosted/error-tracking workflows. +- `backend/tests/phase10-smoke.test.mjs` — node:test smoke suite for auth rejection, public article/comments, optional authenticated comment, and optional publish workflow checks. +- `backend/src/routes/auth.ts` — local auth, OAuth callbacks, OTP-backed 2FA, session creation, and current-user API. +- `backend/src/routes/profile.ts` — public profile API, profile edits, verified expert fields for writer profiles, and 2FA-enabled account payloads. +- `backend/src/routes/admin.ts` — article SEO/quality writes, approval workflow, analytics, newsletter, series, author verification, and article corrections. +- `backend/src/routes/comments.ts` — comment/reply APIs, likes, upvotes, flags, best-comment sorting, and bulk moderation. +- `backend/src/routes/public.ts` — public articles/categories/authors/series/newsletter with SEO fields, verified expert fields, and correction notices. +- `backend/prisma/schema.prisma` — Phase 10 persistence including analytics events, topic follows, trust fields, verified experts, 2FA flags, article corrections, sponsored articles, premium memberships/articles, job listings, and courses. + +## Phase 15 Files + +Phase 15 adds viewership and top-of-funnel scaling features: + +- `scripts/generate-web-stories.mjs` — CSS scroll-snap story generator; outputs `dist/stories/{slug}/index.html`; OG + Twitter Card meta, keyboard navigation. +- `scripts/generate-comparison-pages.mjs` — comparison static HTML with ItemList + FAQPage + BreadcrumbList JSON-LD. +- `scripts/generate-company-pages.mjs` — company directory static HTML with Organization JSON-LD. +- `src/components/QuoteSharer.jsx` — Selection API + Canvas 1080×1080 branded quote card; share/copy/download; analytics tracking. +- `embed.html` — second Vite rollup entry for widget iframes. +- `src/embed.jsx` — widget bootstrapper routing by URL path. +- `src/widgets/GlossaryWidget.jsx` / `ArticleCardWidget.jsx` / `CompanyWidget.jsx` — embeddable cards with dark mode and postMessage resize. +- `public/embed-loader.js` — third-party snippet that injects sandboxed `