Skip to content
/ maple Public

A new AI model based on SmolLM2 135M that can be fine tuned in real time and locally hosted on the web using WebContainers.

Notifications You must be signed in to change notification settings

xtoazt/maple

Repository files navigation

🍁 Maple

🔒 100% PRIVATE • UNRESTRICTED AI - A beautiful, privacy-first AI chat interface with real-time training and optional cloud sync powered by Llama-3.2-1B. Runs completely in your browser with no data leaving your device unless you choose to enable cloud storage. Built with MLC WebLLM for secure, high-performance local inference. Features complete freedom of expression while maintaining absolute privacy.

🚀 Quick Start

  1. Open the site - Just go to the URL
  2. Accept terms - Click "Accept" for license
  3. Wait for model - Downloads automatically (2-3 min first time)
  4. Enable real-time training - Toggle on to learn as you chat
  5. Upload training data (optional) - Use .txt file or add examples manually
  6. Start chatting - Your AI improves with every conversation!

That's it! No setup, no accounts, no waiting.

✨ Features

🔒 Privacy-First AI

  • 🔒 100% Local Processing - All AI inference happens in your browser
  • 🚫 Zero Data Collection - No tracking, analytics, or external servers
  • ✨ Open Source - Fully transparent and auditable
  • 🔥 Real-time Training - AI learns from your conversations automatically
  • ☁️ Optional Cloud Sync - Enable MapleDB for cross-device access
  • 💡 Multiple Models - Switch between Maple (Llama-3.2-1B), Maple Pro (Llama-3.2-1B), Maple Large (Llama-3.2-1B), and Maple Lite (TinyLlama)
  • 🎨 Beautiful Interface - Modern, minimal design
  • ⚡ Instant Deployment - Ready for Vercel in minutes

Real-Time Training Mode

  • Auto-Capture: Every conversation is saved as training data
  • Auto-Retrain: Model retrains every 5 new conversations
  • Smart Learning: AI adapts to your communication style
  • Live Counter: See how many new examples have been captured
  • Toggle Control: Turn on/off anytime with one click

MapleDB Integration

  • Automatic Sync: Chat history saved to secure MongoDB
  • Anonymous Users: No email required, privacy-first
  • Session Management: Multiple chat sessions per user
  • Training Backup: All your training data backed up to cloud
  • Cross-Device: Access your history from any device (coming soon)
  • Offline-First: Works perfectly without MapleDB

🛡️ How Maple Protects Your Privacy

  • Browser-Only AI: All processing happens locally using WebGPU/WebAssembly
  • No Server Requests: Models cached in IndexedDB, conversations stored locally
  • No Tracking: Zero analytics, cookies, or fingerprinting
  • No Accounts: Anonymous by default, optional cloud sync
  • Open Source: Audit the entire codebase on GitHub
  • WebLLM Technology: Powered by Apache TVM for optimized in-browser inference

🗄️ MapleDB Setup (Optional)

MapleDB provides secure cloud storage for chat history and training data.

Quick Setup

  1. Create free MongoDB Atlas account
  2. Get your connection string
  3. Add to Vercel environment variables:
    MAPLEDB_URI=mongodb+srv://user:pass@cluster.mongodb.net/maple
    
  4. Deploy - MapleDB activates automatically!

See MAPLEDB_SETUP.md for detailed instructions

Note: Maple works perfectly without MapleDB! It uses localStorage as fallback.

🛠️ Development

Frontend

cd web
npm install
npm run dev

Backend API (MapleDB)

cd api
npm install
npm run dev

📁 Project Structure

maple/
├── web/                    # Frontend web app
│   ├── src/
│   │   ├── components/     # UI components
│   │   ├── services/       # MapleDB client
│   │   ├── App.tsx         # Main app
│   │   └── main.tsx        # Entry point
│   ├── public/             # Static assets
│   └── package.json        # Frontend dependencies
│
├── api/                    # MapleDB Backend
│   ├── lib/
│   │   ├── mapledb.ts      # MongoDB connection
│   │   └── models.ts       # Data schemas
│   ├── routes/
│   │   ├── users.ts        # User management
│   │   └── history.ts      # Chat history
│   ├── user.ts             # /api/user endpoint
│   ├── history.ts          # /api/history endpoint
│   ├── health.ts           # /api/health endpoint
│   └── package.json        # Backend dependencies
│
├── vercel.json             # Vercel deployment config
├── MAPLEDB_SETUP.md        # MapleDB setup guide
└── README.md               # This file

🚀 Deployment

Deploy to Vercel

  1. Push to GitHub
  2. Import to Vercel
  3. (Optional) Add MAPLEDB_URI environment variable
  4. Deploy!

Vercel automatically:

  • Builds the frontend
  • Deploys API endpoints
  • Configures routing
  • Enables CORS headers

🔧 Tech Stack

  • Frontend: React 18, TypeScript, Vite
  • AI: @huggingface/transformers (Transformers.js)
  • Model: SmolLM2-135M-Instruct from HuggingFace
  • Backend: Node.js, TypeScript, Vercel Serverless
  • Database: MongoDB Atlas (MapleDB)
  • Icons: Lucide React
  • Design: Pine-inspired dark gaming aesthetic
  • Deployment: Vercel

🎯 API Endpoints

  • GET /api/health - Check MapleDB status
  • POST /api/user - Create/get user
  • GET /api/user?userId=xxx - Get user info
  • PUT /api/user?userId=xxx - Update preferences
  • POST /api/history - Save chat history
  • GET /api/history?userId=xxx&sessionId=xxx - Get chat history
  • GET /api/history?userId=xxx - List all sessions
  • DELETE /api/history?userId=xxx&sessionId=xxx - Delete session

📝 Training Data Format

Maple supports multiple training data formats:

Q: What is machine learning?
A: Machine learning is a subset of AI...

---

Instruction: Explain photosynthesis
Response: Photosynthesis is the process...

---

https://example.com/article
(URLs are automatically fetched and processed)

🔒 Privacy & Security

  • 🚫 UNRESTRICTED: No censorship, no safety filters, no content restrictions
  • 🔒 100% Local: Everything runs in your browser, nothing sent to external servers
  • 🚫 No Data Collection: Zero tracking, analytics, or data mining whatsoever
  • 🔒 Anonymous: No accounts, no emails, no personal information required
  • 🔒 Open Source: Full transparency, inspect every line of code
  • ⚠️ Warning: Unrestricted AI may generate harmful, illegal, or dangerous content

🌟 Coming Soon

  • Multi-model support (GPT, Claude, Llama)
  • Cross-device sync
  • Advanced training modes
  • Export/import conversations
  • Voice input/output
  • Mobile app

📄 License

MIT License - Use freely!

About

A new AI model based on SmolLM2 135M that can be fine tuned in real time and locally hosted on the web using WebContainers.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published