Skip to content
lucifer-cooksPublic

About

A minimalist, full-stack AI workspace inspired by the simplicity of ChatGPT and the organization of Notion. Featuring real-time AI responses with SSE streaming (Gemini/OpenAI), PDF & TXT document extraction, organized chat folders, pinned conversations, workspace statistics, and a zero-configuration JSON database fallback. Built with Node.js, Expre

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Sage AI — Notion-meets-ChatGPT Workspace

Sage AI is a minimalist, premium full-stack AI-powered chat and document intelligence workspace. Inspired by the visual elegance of Notion combined with the conversational power of ChatGPT, Sage AI features generous white space, rounded corners, subtle glassmorphism, responsive sidebar navigation, folders, and extensive chat and account management options.

It is built as a single-page application (SPA) frontend powered by a robust Express backend. To make running and testing the app seamless, the database layer operates in a dual mode—connecting to MongoDB via Mongoose if configured, or transparently falling back to a local JSON database (server/data/db.json) if MongoDB is unavailable.


📸 Screenshots & Previews

🔐 1. Luxury Login Workspace

Authentic login card showcasing glassmorphism, golden borders, and hover reflections. Login Screen

🎨 2. Dashboard Welcome View

Notion-style workspace slate displaying keyboard shortcuts, document upload badges, and live user statistics. Dashboard Screen

💬 3. Active Chat & Syntax Highlighting

Premium chat rendering with markdown support, code block copy actions, and custom syntax highlighting. Active Chat Screen

⚙️ 4. Profile Settings Panel

Configure user display names, Dark/Light theme values, and font scale factors dynamically. Settings Screen


✨ Features

👤 Authentication

  • Register & Login: Fast session authentication utilizing cryptographically secure passwords hashed with bcryptjs.
  • JWT Protection: Secure API endpoints locked by JSON Web Tokens (JWT) passed in client authorization headers.
  • Forgot Password: Password recovery simulation ready for email-relay setups.

💬 Chat Management

  • Multiple Conversations: Keep separate logs for different context streams.
  • Auto-Save: Messages are saved instantly to the database.
  • Pin / Favorite: Keep critical chats at the top of your sidebar (Pinned) or star them for quick indexing.
  • Folders: Drag or classify conversations into folders to keep the workspace organized.
  • Conversation Search: Live client-side fuzzy searching matches titles instantly.

🤖 AI Engine & Streaming

  • SSE Chunk Streaming: Responses type out in real-time using Server-Sent Events (SSE).
  • Stop Generation: Interrupt active streams immediately.
  • Regenerate & Continue: Restart a response or ask Sage to continue writing.
  • Multi-API Support: Out-of-the-box support for both Google Gemini API (via HTTP endpoints) and OpenAI API.
  • Mock Fallback: Auto-detects if API keys are missing and switches to an interactive local mock generator, rendering clean advice, markdown tables, and copyable code blocks.

📄 Message Features

  • Markdown & Highlighting: Renders markdown blocks, bold/italics, bulleted lists, and tables. Injects language badges and copy-to-clipboard actions on code blocks.
  • Individual Message Actions: Star important messages, edit historical prompts (re-submitting triggers updates), copy individual contents, or delete messages.

📎 Document Processing & Uploads

  • File Uploads: Drag/attach files (PDF, TXT, images) up to 10MB using multer.
  • Text Parser: The backend extracts raw text contents from uploaded PDF documents (using pdf-parse) and text documents, feeding them into the AI prompt context.

⚙️ User Settings & Statistics

  • Theme Picker: Fluid transition between Dark Mode (default slate-navy) and Light Mode (soft grey-white).
  • Font Size Adjuster: Interactive slider toggles small, medium, and large text scales.
  • Display Name: Modify your display name instantly.
  • Detailed Statistics: Open the Statistics panel to view total chats, total messages, estimated word counts, active folder divisions, pinned statuses, and starred messages.

📥 Export Capabilities

  • Markdown (.md): Downloads formatted markdown files.
  • Text (.txt): Downloads neat logs.
  • PDF Print-View: Clean print layouts hide sidebars and inputs, offering direct browser print-to-PDF formatting.

🛠️ Tech Stack

Frontend

  • HTML5 & CSS3: Core semantic structure styled with CSS variables and glassmorphism.
  • JavaScript (Vanilla): Structured client modules managing routing and connection state.
  • Marked.js: Fast markdown translation in browser.
  • Highlight.js: Syntactical highlighting for code segments.
  • Lucide Icons: Crisp vector icons.

Backend

  • Node.js & Express.js: Asynchronous server routing and SSE channels.
  • Multer: Multi-part form parser for file streams.
  • JWT & BcryptJS: Encryption and token security.
  • PDF-Parse: PDF character reader.

Database

  • Mongoose & MongoDB: Production database mapping.
  • JSON File DB (Fallback): Local file engine (server/data/db.json) replicating Mongoose query methods.

⚙️ Installation & Setup

  1. Clone and Install Dependencies:

    npm install
  2. Configure Environment Variables: Copy .env.example to .env and adjust the variables:

    # Create a copy
    copy .env.example .env

    Open .env and fill in:

    • PORT: (Default: 5000)
    • JWT_SECRET: (Set to a secure secret string)
    • MONGODB_URI: (Optional. Leave empty to run the JSON file database fallback)
    • GEMINI_API_KEY or OPENAI_API_KEY: (Optional. Provide a key to call live AI; leave empty for Mock Stream Mode)
  3. Start the Application:

    • Production Start:
      npm start
    • Development Start (with watch-mode):
      npm run dev
  4. Access the App: Open http://localhost:5000 in your web browser.


🏗️ Architecture

                                  +-----------------------+
                                  |      Client SPA       |
                                  |   (HTML / CSS / JS)   |
                                  +-----------+-----------+
                                              |
                                     JSON HTTP/SSE Requests
                                              |
                                              v
                                  +-----------+-----------+
                                  |   Express Web Server  |
                                  +-----------+-----------+
                                              |
                     +------------------------+------------------------+
                     |                                                 |
                     v                                                 v
         +-----------+-----------+                         +-----------+-----------+
         |     AI Service        |                         |    Database Router    |
         | (Gemini/OpenAI/Mock)  |                         |  (config/db / Proxy)  |
         +-----------------------+                         +-----------+-----------+
                                                                       |
                                              +------------------------+------------------------+
                                              |                                                 |
                                              v                                                 v
                                  +-----------+-----------+                         +-----------+-----------+
                                  |  Mongoose DB Adapter  |                         |    JSON File Adapter  |
                                  |   (Remote/Atlas/Local)|                         |  (server/data/db.json)|
                                  +-----------------------+                         +-----------------------+

🚀 Future Improvements

  • WebSockets Collaboration: Multi-user sharing on folder structures.
  • Vector Embeddings (RAG): Index PDF uploads using database vector embeddings (like MongoDB Atlas Vector Search) for semantic indexing on large documents.
  • Custom AI System Prompts: Create adjustable persona profiles inside User Settings.
  • Interactive Graphs: Integrate chart.js to visually graph message frequencies and workspace statistics.

About

A minimalist, full-stack AI workspace inspired by the simplicity of ChatGPT and the organization of Notion. Featuring real-time AI responses with SSE streaming (Gemini/OpenAI), PDF & TXT document extraction, organized chat folders, pinned conversations, workspace statistics, and a zero-configuration JSON database fallback. Built with Node.js, Expre

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages