Skip to content

rkriad585/LocalNeural

LocalNeural Logo

LocalNeural

The Ultimate Private AI Interface. Local. Fast. Beautiful. Multi-Provider.

License: MIT Python Flask Socket.IO

Explore the Code Β· Report Bug Β· Request Feature


Overview

LocalNeural is a self-hosted, multi-provider AI chat interface with a stunning "Nothing OS" inspired UI. It supports local models via Ollama and cloud providers like OpenAI, Anthropic, Google Gemini, OpenRouter, and Groq β€” all behind a single, consistent interface.

Built with privacy-first principles: your data stays on your server. Features include real-time streaming, file RAG, multimodal vision, conversation branching, token tracking, admin controls, and more.


Key Features

  • Multi-Provider AI β€” Ollama (local), OpenAI, Anthropic, Google Gemini, OpenRouter, Groq
  • Real-Time Streaming β€” Word-by-word responses via WebSockets (Socket.IO)
  • Dark/Light Theme β€” CSS custom properties, persists across sessions
  • Session Branching β€” Fork conversations into new branches
  • Token Tracking β€” Per-session token counts displayed in history
  • Markdown Toggle β€” Render messages as plain text or formatted markdown
  • Message Export β€” Export individual messages as markdown
  • File RAG β€” Upload PDFs, code files, markdown notes as project knowledge bases
  • Multimodal Vision β€” Drag & drop or paste images for AI analysis (vision models)
  • Conversation Management β€” Pin, archive, tag, search, and organize sessions
  • Prompt Library β€” Save and inject system prompt templates
  • Prompt Variables β€” {date}, {time}, {datetime}, {user} auto-substitution
  • Admin Controls β€” User management, global settings, global tools, user blocking
  • User Settings β€” Per-user provider, model, temperature, system prompt
  • Tools System β€” Define custom function-calling tools (global and per-user)
  • Data Export β€” Export chats as Markdown, JSON, or HTML/PDF
  • Account Management β€” Profile editing, password change, self-deletion
  • Security Hardened β€” CSRF protection, rate limiting, 72h sessions, password min 8

Screenshots

Coming soon β€” see the live demo or run locally.


Quick Start

Prerequisites

  • Python 3.8+
  • Ollama (for local models) β€” Download
  • Pull a model: ollama pull llama3

Install & Run

git clone https://github.com/rkriad585/LocalNeural.git
cd LocalNeural
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt
python app.py

Open http://localhost:59869 in your browser.

Note: Default port is 59869. Set LOCALNEURAL_PORT env var to change it.

Docker

docker build -t localneural .
docker run -p 59869:59869 localneural

Or use docker-compose:

docker-compose up

Configuration

Copy .env.example to .env and configure:

SECRET_KEY=your-strong-random-secret-key
LOCALNEURAL_HOST=0.0.0.0
LOCALNEURAL_PORT=59869

# Optional: SMTP for password reset emails
LOCALNEURAL_SMTP_HOST=smtp.gmail.com
LOCALNEURAL_SMTP_PORT=587
LOCALNEURAL_SMTP_USER=your@email.com
LOCALNEURAL_SMTP_PASSWORD=your-app-password
LOCALNEURAL_SMTP_FROM=your@email.com

# Optional: Auto-create super admin on first run
LOCALNEURAL_ADMIN_EMAIL=admin@example.com
LOCALNEURAL_ADMIN_PASSWORD=your-admin-password

All settings are documented in docs/CONFIGURATION.md.


Documentation

Document Description
Architecture System architecture, design decisions, data flow
API Reference Full API endpoint documentation
Setup Guide Detailed installation and configuration
User Guide How to use all features
Deployment Docker, production deployment
Configuration All environment variables and settings
Features Detailed feature documentation
Security Security model, CSRF, rate limiting
Development Contributing, code style, testing

Tech Stack

  • Backend: Python, Flask, Flask-SocketIO, Flask-Limiter
  • Database: SQLite (via sqlite3)
  • Frontend: HTML5, TailwindCSS (CDN), jQuery, Socket.IO Client
  • AI Providers: Ollama API, OpenAI API, Anthropic API, Google Gemini API, OpenRouter API, Groq API
  • Markdown: marked.js, highlight.js
  • Auth: Session-based with werkzeug password hashing
  • Deployment: Docker, docker-compose

Project Structure

LocalNeural/
β”œβ”€β”€ app.py                 # Main Flask app (routes, auth, admin, tools, chat)
β”œβ”€β”€ config.py              # Configuration class (env vars, defaults)
β”œβ”€β”€ database.py            # SQLite database operations
β”œβ”€β”€ requirements.txt       # Python dependencies
β”œβ”€β”€ Dockerfile             # Docker build
β”œβ”€β”€ docker-compose.yml     # Docker compose
β”œβ”€β”€ .env.example           # Environment template
β”œβ”€β”€ LICENSE                # MIT License
β”œβ”€β”€ README.md
β”œβ”€β”€ CODE_OF_CONDUCT.md
β”œβ”€β”€ CONTRIBUTING.md
β”œβ”€β”€ .data/
β”‚   └── neural_memory.db   # SQLite database file
β”œβ”€β”€ docs/                  # Documentation
β”‚   β”œβ”€β”€ ARCHITECTURE.md
β”‚   β”œβ”€β”€ API.md
β”‚   β”œβ”€β”€ CONFIGURATION.md
β”‚   β”œβ”€β”€ DEPLOYMENT.md
β”‚   β”œβ”€β”€ DEVELOPMENT.md
β”‚   β”œβ”€β”€ FEATURES.md
β”‚   β”œβ”€β”€ SECURITY.md
β”‚   β”œβ”€β”€ SETUP.md
β”‚   └── USER_GUIDE.md
β”œβ”€β”€ static/
β”‚   β”œβ”€β”€ css/
β”‚   β”‚   └── style.css
β”‚   β”œβ”€β”€ images/
β”‚   β”‚   └── logo.svg
β”‚   β”œβ”€β”€ js/
β”‚   β”‚   └── main.js
β”‚   └── uploads/
β”‚       └── profiles/
β”œβ”€β”€ templates/
β”‚   β”œβ”€β”€ base.html
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ login.html
β”‚   β”œβ”€β”€ settings.html
β”‚   β”œβ”€β”€ settings_page.html
β”‚   β”œβ”€β”€ profile.html
β”‚   β”œβ”€β”€ admin.html
β”‚   β”œβ”€β”€ admin_dashboard.html
β”‚   β”œβ”€β”€ user_view.html
β”‚   └── reset_password.html
└── utilities/
    β”œβ”€β”€ chat_logic.py      # Session context, title generation
    β”œβ”€β”€ email.py            # SMTP email sending
    β”œβ”€β”€ embeddings.py       # Document embeddings
    β”œβ”€β”€ file_parser.py      # PDF/code file parsing
    β”œβ”€β”€ providers.py        # Multi-AI provider abstraction
    β”œβ”€β”€ tools.py            # Function calling tools
    └── web_search.py       # Web search tool

License

Distributed under the MIT License. See LICENSE for more information.


Made with ❀️ by rkriad585

About

LocalNeural is a stunning, self-hosted AI interface like Ollama. It features a modern "Nothing UI" style, real-time streaming, chat memory, multimodal support, and Project Workspaces (RAG) to chat with your PDFs and code files locally. Secure, private, fast, and Try it out. πŸš€

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors