title: Coding Assistant
emoji: π»
colorFrom: blue
colorTo: indigo
sdk: docker
app_file: app.py
pinned: false
Qwen Coder β Cloud-Native Personal Coding Assistant
A project-aware coding companion powered by Qwen2.5-Coder-1.5B optimized for cloud deployment on Railway.
This assistant provides high-quality coding intelligence within a constrained 2GB RAM environment using llama-cpp-python and GGUF quantization.
β¨ Features
- Cloud-Ready LLM β Optimized Qwen 1.5B model running on CPU-only instances.
- Persistent Storage β Integrated with Railway Volumes for project files and model storage.
- Project-based Context β Automatically injects your uploaded project files into the AI's context.
- Streaming Output β Real-time, token-by-token response streaming.
- Web Search β Integrated DuckDuckGo API for quick information lookup.
- File Uploads β Upload project files directly via the web UI.
- Persistent Chat Memory β Remembers previous interactions per project using SQLite.
- Memory Efficient β Uses Flash Attention and 4-bit quantization to fit coding intelligence into 2GB RAM.
π Project Structure
. βββ backend/ β βββ app.py # Flask backend with Ollama integration βββ static/ β βββ styles.css # Dark mode styling β βββ script.js # Frontend interactivity & streaming βββ templates/ β βββ index.html # Web interface βββ projects/ # Your saved coding projects βββ memory.db # SQLite chat history database βββ README.md
π Security & Authentication
This project incorporates robust security controls tailored for public cloud deployments:
Authentication: Secure Google OAuth 2.0 / OIDC login supporting public multi-user access via JSON Web Token (JWT) verification.
Rate Limiting: Custom IP-based rate tracking returns HTTP 429 (Too Many Requests) status codes if thresholds are exceeded.
Deployment (Railway)
Mount Volumes: Create a volume and mount it to /app/data and /app/models.
Environment Variables:
API_KEY: Your secret key for API verification.PORT: 8080PYTHONUNBUFFERED: 1
Start command:
gunicorn --workers 1 --timeout 300 --bind 0.0.0.0:8080 backend.app:app
Deployment (Hugging Face Spaces)
- Environment Variables / Secrets: Add the following secret keys in your Space settings:
GOOGLE_CLIENT_ID: Your Google OAuth Client ID.TAVILY_API_KEY: Your Tavily search API key.
Privacy
This assistant runs on your private Railway instance. No data is sent to OpenAI, Anthropic, or any other third-party LLM providers.
π§© Technology Stack
Backend
Python 3.9+ β Core backend language.
Flask β Lightweight web framework for handling API routes and serving the web UI.
SQLite β Embedded database for persistent per-project chat history.
Ollama β Local LLM runner for Qwen v3 30B.
Qwen v3 30B β Large Language Model specialized for coding and reasoning.
Requests β HTTP client for DuckDuckGo search API.
Frontend
HTML5 β Web interface structure.
CSS3 β Custom dark mode styling.
JavaScript (ES6+) β Client-side logic for chat interaction & streaming.
Fetch API β Asynchronous communication with the backend.
Marked.js β Client-side Markdown rendering for assistant messages.
Highlight.js β Syntax highlighting for code blocks.
π Privacy
Everything runs entirely locally. No data is sent to external services except optional DuckDuckGo search queries.