๐ Live App ย ยทย ๐ Professor Demo ย ยทย ๐ Architecture ย ยทย ๐ง LSTM Deep Dive ย ยทย ๐ Quick Start
"A notebook would have been sufficient to pass. TextForge AI is what happens when a developer refuses to do the minimum." โ The Developer
This project was born from a single college assignment brief:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ASSIGNMENT BRIEF โ
โ "Create a text generation model using GPT or LSTM to generate โ
โ coherent paragraphs on specific topics." โ
โ Deliverable: A notebook demonstrating generated text. โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
A notebook would have satisfied the requirement. TextForge AI v2.0 is what happens when a developer asks "what if we built the real thing?"
| Academic Requirement | Minimum | TextForge AI v2.0 |
|---|---|---|
| Text generation | โ Notebook | โ Gemini 2.5 Flash + PyTorch LSTM |
| Coherent paragraphs | โ Basic | โ Prompt-engineered, structured output |
| Topic-based generation | โ | โ Tone ยท Length ยท Language ยท SEO |
| User interface | โ | โ Full Next.js 14 production app |
| Real-time streaming | โ | โ Server-Sent Events, first token <200ms |
| Authentication | โ | โ Google + GitHub OAuth via NextAuth v4 |
| Cloud database | โ | โ MongoDB Atlas per-user isolation |
| Domain expertise | โ | โ 6 domains ยท 70+ params ยท 25 output types |
| AI Detection | โ | โ 5-dimension linguistic scoring |
| Humaniser | โ | โ One-click AI score reducer |
| Academic citations | โ | โ 200M+ real papers ยท APA/MLA/IEEE |
| Indian languages | โ | โ 6 languages ยท cultural idioms ยท native script |
| Professor demo mode | โ | โ /demo โ guided 6-step walkthrough |
| Export system | โ | โ PDF ยท DOCX ยท Markdown ยท TXT |
| Analytics dashboard | โ | โ MongoDB aggregations + Recharts |
| Public API | โ | โ API key management system |
| Live deployment | โ | โ Vercel + Railway production |
TextForge AI is a production-grade, full-stack AI writing platform that goes far beyond generic text generation. It combines domain expertise, linguistic analysis, real academic sources, and cultural authenticity into one application.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ TEXTFORGE AI v2.0 โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ
โ "Why use yours over ChatGPT?" โ
โ โ
โ โฆ Mine asks 14 questions before writing a legal contract. โ
โ โฆ Mine scores your text for AI detection and rewrites โ
โ it to pass detectors in one click. โ
โ โฆ Mine generates academic articles with REAL verifiable โ
โ citations from 200 million papers. โ
โ โฆ Mine writes natively in Hindi, Marathi, Tamil, and โ
โ Telugu โ not translation, but cultural expression. โ
โ โ
โ ChatGPT does none of these things in one place. โ
โ TextForge AI does all of them. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ PRODUCTION URLs โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ ๐ App โ https://textforge-ai-sable.vercel.app โ
โ ๐ Demo โ https://textforge-ai-sable.vercel.app/demo โ
โ โ๏ธ Domains โ https://textforge-ai-sable.vercel.app/domain โ
โ ๐ Citations โ https://textforge-ai-sable.vercel.app/citations โ
โ ๐ฎ๐ณ Bharat AI โ https://textforge-ai-sable.vercel.app/vernacular โ
โ ๐ง Backend โ https://textforge-ai-production.up.railway.app โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Frontend โโ Vercel (Next.js CDN, global edge network)
Backend โโ Railway (Node.js container, auto-deploys from GitHub)
Database โโ MongoDB Atlas M0 (512MB, cloud-hosted)
AI โโ Google Gemini 2.5 Flash (free tier)
| Feature | Implementation | Detail |
|---|---|---|
| SSE Streaming | generateContentStream() |
First token < 200ms |
| 8 Templates | lib/templates.ts |
Blog ยท Email ยท Essay ยท Cover Letter ยท Product ยท Social ยท Summary ยท Story |
| 4 Tones | Prompt injection | Formal ยท Casual ยท Creative ยท Academic |
| 3 Lengths | Word count targeting | Short ~150 ยท Medium ~350 ยท Long ~700 |
| 8 Languages | Gemini prompt | EN ยท HI ยท ES ยท FR ยท DE ยท JA ยท AR ยท ZH |
| SEO Keywords | Natural weaving | Up to 10 terms |
| Refine System | buildRefinementPrompt() |
Shorter ยท Longer ยท Formal ยท Simpler |
| Domain | Parameters | Output Types |
|---|---|---|
| Legal | 14 | NDA ยท Service Agreement ยท Employment ยท Freelance ยท Partnership |
| Medical | 12 | Case Study ยท SOAP Note ยท Research Abstract ยท Discharge Summary |
| Startup | 13 | Executive Summary ยท Problem Statement ยท Value Prop ยท Pitch ยท Investor Email |
| Research | 11 | Abstract ยท Literature Review ยท Methodology ยท Discussion ยท Conclusion |
| Grant | 10 | Project Proposal ยท Impact Statement ยท Budget Justification ยท Objectives |
| HR | 10 | Job Description ยท Performance Review ยท Offer Letter ยท Policy ยท Interview Qs |
| Total | 70+ | 25 output types |
| Dimension | Weight | What It Measures |
|---|---|---|
| Burstiness | 25% | Sentence length variance โ humans write with more rhythm |
| AI Phrase Density | 40% | 45+ known AI signature phrases detected |
| Vocabulary Diversity | 15% | Sliding window type-token ratio |
| Sentence Openings | 10% | Repetitive starts = AI pattern |
| Punctuation Pattern | 10% | AI overuses commas and semicolons |
| Feature | Detail |
|---|---|
| Semantic Scholar | 200M+ papers, free, no API key |
| CrossRef | 130M+ works, DOI lookup |
| Citation Styles | APA 7th ยท MLA 9th ยท IEEE |
| Quality Filter | Sorted by citation count โ most cited = most relevant |
| In-text highlighting | (Author, Year) rendered in brand orange |
| References section | Auto-generated, properly formatted |
| Language | Script | Cultural Context |
|---|---|---|
| Hindi เคนเคฟเคจเฅเคฆเฅ | Devanagari | North Indian culture, Bollywood, cricket, Diwali |
| Marathi เคฎเคฐเคพเค เฅ | Devanagari | Maharashtra, Shivaji, Ganesh Chaturthi, Mumbai |
| Tamil เฎคเฎฎเฎฟเฎดเฏ | Tamil | Sangam literature, Kollywood, AR Rahman |
| Telugu เฐคเฑเฐฒเฑเฐเฑ | Telugu | Tollywood, Hyderabad IT, Kuchipudi |
| Bengali เฆฌเฆพเฆเฆฒเฆพ | Bengali | Tagore, Durga Puja, intellectual tradition |
| Gujarati เชเซเชเชฐเชพเชคเซ | Gujarati | Navratri, Gandhi, entrepreneurial culture |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ TEXTFORGE AI v2.0 โ FULL STACK โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ PRESENTATION LAYER โ โ
โ โ Next.js 14 โ Vercel CDN โ โ
โ โ โ โ
โ โ /workspace /domain /citations /vernacular /demo /stats โ โ
โ โ โ โ
โ โ Zustand ยท NextAuth ยท Tailwind ยท SSE ReadableStream โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ HTTP/SSE + x-user-id header โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ APPLICATION LAYER โ โ
โ โ Express 4 + TypeScript โ Railway โ โ
โ โ โ โ
โ โ /api/generate โ SSE streaming + refine + humanise โ โ
โ โ /api/domain โ 6 domains, 70+ parameters, expert prompts โ โ
โ โ /api/citations โ Semantic Scholar + CrossRef + Gemini โ โ
โ โ /api/vernacular โ 6 Indian languages + cultural profiles โ โ
โ โ /api/history โ CRUD + paginated + userId scoped โ โ
โ โ /api/stats โ 4 MongoDB aggregation pipelines โ โ
โ โ /api/keys โ API key management (tf_live_ prefix) โ โ
โ โโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ โ
โ โโโโโโโโโโโโผโโโโโโโโโโโ โโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Google Gemini โ โ MongoDB Atlas โ โ
โ โ 2.5 Flash โ โ โ โ
โ โ โ โ generations collection โ โ
โ โ generateContent โ โ โโ topic, tone, length, language โ โ
โ โ Stream() โ โ โโ citations[], citationStyle โ โ
โ โ โ โ โโ templateId (domain tracking) โ โ
โ โ Semantic Scholar โ โ โโ userId (per-user isolation) โ โ
โ โ CrossRef APIs โ โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The core insight: ChatGPT asks 0 questions before writing a legal contract. TextForge AI asks 14.
User selects domain โ Legal
โ
โผ
Dynamic form renders 14 fields:
Party 1 name + role ยท Party 2 name + role
Jurisdiction (India/US/UK/Singapore)
Duration ยท Contract value
Confidentiality level ยท Liability limit
Dispute resolution ยท IP ownership
Non-compete ยท Special clauses
โ
โผ
buildLegalPrompt() constructs expert-level prompt:
"You are a senior corporate lawyer with 20+ years experience...
PARTY 1: TextForge AI (Disclosing Party)
JURISDICTION: Indian Contract Act 1872
LIABILITY: Limited to contract value
DISPUTE: Arbitration under Arbitration Act 1996..."
โ
โผ
Gemini generates jurisdiction-specific, properly structured document
โ
โผ
Export as PDF ยท DOCX ยท with correct legal formatting
Why this is exceptional: The depth of domain knowledge embedded in the prompts took weeks to build. Anyone can call the Gemini API. Nobody can copy the 70+ parameters of domain-specific prompt engineering without the same research.
// 5 dimensions, client-side โ no external API needed
export function detectAI(text: string): DetectionResult {
const burstiness = measureBurstiness(sentences); // 25% weight
const aiPhrases = measureAIPhraseDensity(text); // 40% weight
const vocabulary = measureVocabularyDiversity(words); // 15% weight
const sentenceStarts = measureSentenceStartDiversity(); // 10% weight
const punctuation = measurePunctuationPattern(text); // 10% weight
const score = burstiness*0.25 + aiPhrases*0.40 + vocabulary*0.15
+ sentenceStarts*0.10 + punctuation*0.10;
// โ Risk level: low (<35) | medium (35-65) | high (>65)
}Includes Gemini-specific patterns: "remains a", "serves as", "shaping the", "landscape of", "a wide range of" โ plus universal markers: "furthermore", "it is worth noting", "delve into", "tapestry", "nuanced", "multifaceted"
Specific instructions target exactly what the detector measures:
1. VARY sentence lengths dramatically
2. REMOVE all 45 AI signature phrases
3. ADD natural rhetorical questions and asides
4. VARY sentence openings
5. USE contractions appropriately
6. REPLACE generic adjectives with specific ones
7. ADD one concrete analogy
8. REDUCE comma density
Result: Score typically drops from 55-75% โ 10-20% after one humanisation pass.
User enters topic: "Deep learning in medical imaging"
โ
โผ
Promise.all([
fetchSemanticScholar(topic, 4), โ 200M+ papers
fetchCrossRef(topic, 3) โ 130M+ works
])
โ
โผ
Merge + deduplicate by title similarity
Sort by citation count (most cited = most important)
โ
โผ
formatCitations(papers, style: "apa" | "mla" | "ieee")
โ APA: (Litjens et al., 2017)
โ MLA: (Litjens 2017)
โ IEEE: [1]
โ
โผ
buildCitedPrompt() โ instructs Gemini to weave citations naturally
โ
โผ
Generated text with (Author, Year) highlighted in orange
Full References section auto-generated at bottom
Saved to MongoDB with citationCount badge in history
Deep learning has fundamentally transformed medical image
classification. A comprehensive survey by (Litjens et al., 2017)
catalogued over 300 applications across imaging modalities...
Landmark studies demonstrated human-competitive performance.
(Esteva et al., 2017) achieved dermatologist-level accuracy...
References:
Litjens, G., et al. (2017). A survey on deep learning in medical
image analysis. Medical Image Analysis, 42, 60โ88.
Every AI tool treats Indian language content as an afterthought โ translated from English. Bharat AI generates content that was written in Hindi, not translated from English.
Generic AI approach:
English prompt โ English output โ Google Translate โ Hindi
Result: Grammatically correct but culturally hollow
Bharat AI approach:
Prompt engineering with:
โฆ Language profile (cultural context, idioms, references)
โฆ Regional specificity
โฆ Native sentence structure
โฆ Indian cultural references
Result: Content a native speaker would recognise as authentic
Each language has a dedicated profile with:
- Cultural context (festivals, icons, traditions)
- Idiom instructions (specific proverbs and expressions)
- Reference instructions (historical figures, contemporary icons)
- Regional variants (Mumbai Marathi vs Pune Marathi)
Hindi speakers: 530M+ โ more than the entire EU population
Tamil speakers: 80M+
Telugu speakers: 85M+
Bengali speakers: 230M+
Marathi speakers: 95M+
Gujarati speakers: 60M+
โโโโโโโโโโโโโโโโโโโโโโโโโ
Total addressable: 1.08 BILLION people
SSE: Server โ Client (unidirectional, HTTP/1.1, auto-reconnect)
WebSockets: Bidirectional (custom protocol, overkill for streaming)
For text generation: data flows in ONE direction.
SSE is the architecturally correct choice.
// Without buffer โ breaks on TCP packet splits:
// Packet 1: "data: {"text":"Hello ","don"
// Packet 2: "e":false}\n\n..."
// JSON.parse("{"text":"Hello ","don") โ โ SyntaxError
// With buffer โ production-correct:
buffer += decoder.decode(value, { stream: true });
const lines = buffer.split("\n\n");
buffer = lines.pop() || ""; // โ retain incomplete message
for (const line of lines) {
const payload = JSON.parse(line.slice(6)); // โ
always complete
}If
Forget gate: f_t = ฯ(W_f ยท [h_{t-1}, x_t] + b_f)
Input gate: i_t = ฯ(W_i ยท [h_{t-1}, x_t] + b_i)
Candidate: Cฬ_t = tanh(W_C ยท [h_{t-1}, x_t] + b_C)
Cell update: C_t = f_t โ C_{t-1} + i_t โ Cฬ_t
Output gate: o_t = ฯ(W_o ยท [h_{t-1}, x_t] + b_o)
Hidden: h_t = o_t โ tanh(C_t)
Input Character
โ
Embedding Layer (vocab_size โ embed_dim=128)
โ
LSTM Layer 1 (128 โ 256, dropout=0.3)
โ
LSTM Layer 2 (256 โ 256)
โ
Dropout (p=0.3)
โ
Linear (256 โ vocab_size)
โ
Temperature Sampling โ Next Character
Total trainable parameters: ~500,000
| Hyperparameter | Value | Rationale |
|---|---|---|
| Sequence length | 80 chars | Medium-range syntactic dependencies |
| Batch size | 32 | Gradient quality vs memory balance |
| Epochs | 30 | Loss plateau at ~25 epochs |
| Learning rate | 0.002 | Adam default, ร0.5 every 10 epochs |
| Gradient clipping | 5.0 | Critical for RNNs โ prevents explosion |
| Dropout | 0.3 | Srivastava et al. (2014) |
| Hidden dims | 256 | Sufficient character-level capacity |
| LSTM layers | 2 | Syntax (L1) + semantics (L2) |
| Dimension | LSTM (Notebook) | Transformer (Gemini) |
|---|---|---|
| Architecture | Recurrent (sequential) | Self-attention (parallel) |
| Complexity | O(n) | O(nยฒ) attention |
| Long-range deps | Cell state gating | Direct attention |
| Parallelisation | Sequential โ slow | Fully parallel โ fast |
| Parameters | ~500K | Billions |
| Seminal paper | Hochreiter & Schmidhuber (1997) | Vaswani et al. (2017) |
| Technology | Version | Role |
|---|---|---|
| Next.js | 14.2 | React framework, App Router, SSR |
| TypeScript | 5.4 | End-to-end type safety |
| Tailwind CSS | 3.4 | JIT utility-first styling |
| NextAuth.js | 4.24 | Google + GitHub OAuth |
| Zustand | 4.5 | Zero-boilerplate global state |
| Recharts | 2.x | Analytics dashboard charts |
| Lucide React | 0.383 | Tree-shakeable icon system |
| jsPDF | 2.x | Client-side PDF export |
| docx | 8.x | DOCX generation |
| Technology | Version | Role |
|---|---|---|
| Node.js | 18+ | Non-blocking I/O runtime |
| Express | 4.19 | REST API framework |
| TypeScript | 5.4 | Type safety across 15+ route files |
| @google/generative-ai | 0.15 | Gemini SDK with streaming |
| Mongoose | 8.4 | MongoDB ODM + aggregations |
| Zod | 3.23 | Runtime validation + TypeScript inference |
| Helmet | 7.1 | 11 HTTP security headers |
| express-rate-limit | 7.3 | Per-IP sliding window protection |
| Service | Purpose | Cost |
|---|---|---|
| Google Gemini 2.5 Flash | AI generation | Free (1,500 req/day) |
| Semantic Scholar API | Academic citations | Free, no key needed |
| CrossRef API | Academic citations | Free, no key needed |
| MongoDB Atlas | Database | Free (M0 512MB) |
| Vercel | Frontend hosting | Free (hobby tier) |
| Railway | Backend hosting | Free tier |
textforge-ai/
โ
โโโ ๐ README.md
โโโ ๐ LICENSE
โ
โโโ ๐ backend/
โ โโโ src/
โ โโโ index.ts โ Express server + all route registration
โ โโโ config/index.ts โ Env validation, CORS regex, model config
โ โโโ models/
โ โ โโโ Generation.ts โ Schema (citations, citationStyle, templateId)
โ โ โโโ ApiKey.ts
โ โโโ services/
โ โ โโโ geminiService.ts โ All prompt builders (domain, vernacular, humanise)
โ โ โโโ citationService.ts โ Semantic Scholar + CrossRef + formatters
โ โ โโโ historyService.ts โ CRUD + 4 aggregation pipelines
โ โโโ routes/
โ โ โโโ generate.ts โ /generate + /refine + /humanise
โ โ โโโ domain.ts โ 6 domain templates
โ โ โโโ citations.ts โ Academic citations with real APIs
โ โ โโโ vernacular.ts โ 6 Indian language generation
โ โ โโโ history.ts โ Paginated history
โ โ โโโ share.ts โ Public share links
โ โ โโโ stats.ts โ Analytics aggregations
โ โ โโโ apiKeys.ts โ Key management
โ โโโ middleware/
โ โโโ rateLimiter.ts โ Dual-layer sliding window
โ โโโ errorHandler.ts โ Global boundary + AppError
โ โโโ apiKeyAuth.ts โ tf_live_ prefix validation
โ
โโโ ๐ frontend/
โ โโโ app/
โ โโโ page.tsx โ Landing page (animated hero, 8 feature cards)
โ โโโ workspace/page.tsx โ Main app (sidebar + chat + refine + detection)
โ โโโ domain/
โ โ โโโ page.tsx โ 3-step domain flow
โ โ โโโ showcase/page.tsx โ Pre-generated sample outputs
โ โโโ citations/page.tsx โ Citations generator with highlighted output
โ โโโ vernacular/page.tsx โ Bharat AI โ 6 Indian languages
โ โโโ demo/page.tsx โ Professor demo mode (6 steps, auto-play)
โ โโโ stats/page.tsx โ Recharts analytics dashboard
โ โโโ history/page.tsx โ Full history with search + filter
โ โโโ api-keys/page.tsx โ API key management
โ โโโ components/
โ โโโ AIDetectionPanel.tsx โ Risk score + dimension bars + humanise button
โ โโโ MadeBy.tsx โ Animated "Made with โค๏ธ by Tushar Tamrakar"
โ โโโ Navbar.tsx โ Context-aware navigation
โ โโโ PromptBuilder.tsx โ Full panel + compact bottom-bar mode
โ โโโ UserMenu.tsx โ Avatar dropdown + userId injection
โ โโโ lib/
โ โโโ aiDetector.ts โ 5-dimension AI detection algorithm
โ โโโ domainTemplates.ts โ 6 domain definitions (759 lines)
โ โโโ citationService.ts โ Citation fetching + formatting
โ โโโ api.ts โ Axios client + x-user-id interceptor
โ โโโ store.ts โ Zustand state management
โ
โโโ ๐ notebook/
โโโ lstm_text_generation.ipynb โ 13-cell PyTorch LSTM (upgraded v2.0)
interface IGeneration {
userId?: string; // OAuth provider UID โ scopes ALL queries
topic: string; // 3-500 chars
tone: Tone; // formal | casual | creative | academic
length: Length; // short | medium | long
language: string; // en | hi | es | fr...
output: string; // Generated text
wordCount: number; // Pre-calculated in Mongoose hook
modelName: string; // gemini-2.5-flash (not "model" โ Mongoose conflict)
templateId?: string; // domain_legal_nda | vernacular_hi | citation_apa
citations?: any[]; // Full citation objects for cited generations
citationStyle?: string; // apa | mla | ieee
citationCount?: number; // Badge display in sidebar
isFavourite: boolean;
isShared: boolean;
createdAt: Date;
}
// 3 compound indexes for common query patterns
GenerationSchema.index({ createdAt: -1 });
GenerationSchema.index({ userId: 1, createdAt: -1 });
GenerationSchema.index({ isFavourite: 1, createdAt: -1 });Request arrives
โ
โผ Helmet.js โ 11 security headers (X-Frame, MIME sniff, fingerprint)
โผ CORS โ regex /^https:\/\/textforge-.*\.vercel\.app$/
โผ Rate Limiting โ 50/15min global ยท 5/min on AI endpoints
โผ Zod Validation โ rejects bad data before AI or database
โผ Body Size โ express.json({ limit: "10kb" })
โผ Error Handler โ stack traces only in development
โ
Route Handler
Base URL: https://textforge-ai-production.up.railway.app
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/generate |
Stream text via SSE |
POST |
/api/generate/refine |
Refine existing output |
POST |
/api/generate/humanise |
Reduce AI detection score |
POST |
/api/domain/generate |
Domain template generation |
POST |
/api/citations/generate |
Generate with real citations |
GET |
/api/citations/search |
Search academic papers |
POST |
/api/vernacular/generate |
Indian language generation |
GET |
/api/history |
Paginated generation history |
PATCH |
/api/history/:id/favourite |
Toggle star |
PATCH |
/api/history/:id/share |
Toggle public share |
GET |
/api/share/:id |
Public share (no auth) |
GET |
/api/stats |
Analytics aggregations |
POST |
/v1/generate |
Public API (API key auth) |
GET |
/health |
Health check |
# 1. Clone
git clone https://github.com/TUSHARTAMRAKAR/textforge-ai.git
cd textforge-ai
# 2. Backend
cd backend && npm install
cp .env.example .env
# Fill: GEMINI_API_KEY, MONGODB_URI
npm run dev # http://localhost:5000/health
# 3. Frontend (new terminal)
cd frontend && npm install
cp .env.local.example .env.local
# Fill: OAuth credentials, NEXTAUTH_SECRET
npm run dev # http://localhost:3000
# 4. LSTM Notebook (optional)
cd notebook
pip install torch numpy matplotlib tqdm
jupyter notebook lstm_text_generation.ipynb
# Or open in Google Colab (free T4 GPU)PORT=5000
NODE_ENV=development
GEMINI_API_KEY=your_gemini_key # aistudio.google.com โ free
MONGODB_URI=mongodb+srv://... # mongodb.com/atlas โ free M0
CLIENT_URL=http://localhost:3000
GEMINI_MODEL=gemini-1.5-flash # 1,500 req/day freeNEXT_PUBLIC_API_URL=http://localhost:5000
NEXTAUTH_SECRET=your_32_byte_hex_secret
NEXTAUTH_URL=http://localhost:3000
GOOGLE_CLIENT_ID=... # console.cloud.google.com
GOOGLE_CLIENT_SECRET=...
GITHUB_CLIENT_ID=... # github.com/settings/developers
GITHUB_CLIENT_SECRET=...1. Import repo โ Root: frontend โ Framework: Next.js
2. Add all env vars (production URLs)
3. Deploy
Rules:
โ
next.config.js: typescript.ignoreBuildErrors: true
โ
Route handlers export ONLY { GET, POST }
โ
NEXTAUTH_URL must match exact domain
1. Deploy from GitHub โ Root: /backend
2. Build: npm run build (tsc --skipLibCheck)
3. Start: npm start (node dist/index.js)
4. Health: /health
Rules:
โ
typescript in dependencies (not devDependencies)
โ
tsconfig: skipLibCheck: true
โ
No "model" field in Mongoose schema (conflicts with Document.model())
โ
CORS regex allows all *.vercel.app preview URLs
- Next.js 14 frontend ยท Express backend ยท MongoDB Atlas
- Gemini SSE streaming ยท PyTorch LSTM notebook
- OAuth ยท History ยท Export ยท Stats ยท Public API
- Deep Domain Templates (6 domains ยท 70+ params)
- AI Detection + Humaniser (5-dimension algorithm)
- Academic Citations (Semantic Scholar + CrossRef)
- Bharat AI (6 Indian languages + cultural profiles)
- Professor Demo Mode (/demo auto-play)
- Landing page upgrade (8 feature cards)
- LSTM notebook upgraded (13 cells, v2.0 docs)
- Multi-Model Comparison Engine โ One prompt โ Gemini + GPT + Claude side-by-side. Community leaderboard of best model per use case and tone.
- Writing Coach โ The ANTI-ChatGPT. Analyses YOUR writing, gives specific feedback, tracks vocabulary growth and improvement over time. Gamified streaks.
- UI Internationalisation (i18n) โ Full interface translation via
next-intl. Note: AI content in 8 languages already works โ this covers UI strings.
- Mobile Application โ React Native iOS + Android
- Browser Extension โ One-click generation from any webpage
- Fine-tuned Domain Models โ Custom models trained on legal/medical corporates
git clone https://github.com/TUSHARTAMRAKAR/textforge-ai.git
git checkout -b feat/your-feature
git commit -m "feat: your feature description"
git push origin feat/your-feature
# Open Pull RequestCommit types: feat ยท fix ยท docs ยท refactor ยท perf ยท test
MIT License โ Free to use, modify, and distribute. Copyright (c) 2026 Tushar Tamrakar
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ "A notebook would have been sufficient to pass. โ
โ TextForge AI is what happens when a developer โ
โ refuses to do the minimum." โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Built with ๐ฅ ยท Deployed with โก ยท Documented with ๐
Made with โค๏ธ by Tushar Tamrakar
B.Tech Student ยท Full-Stack Developer ยท AI Engineer
If this project helped you, consider giving it a โญ on GitHub