CoolFace
Apppublic

akhaliq/anycoder

sourceHugging Faceupdated 5mo agoView on Hugging Face
3.3klikes
App README

AnyCoder - AI Code Generator with React Frontend

AnyCoder is a full-stack AI-powered code generator with a modern React/TypeScript frontend and FastAPI backend. Generate applications by describing them in plain English, with support for multiple AI models and one-click deployment to Hugging Face Spaces.

๐ŸŽจ Features

  • โ€”Modern React UI: Apple-inspired design with VS Code layout
  • โ€”Real-time Streaming: Server-Sent Events for live code generation
  • โ€”Multi-Model Support: MiniMax M2, DeepSeek V3, and more via HuggingFace InferenceClient
  • โ€”Multiple Languages: HTML, Gradio, Streamlit, React, Transformers.js, ComfyUI
  • โ€”Authentication: HuggingFace OAuth + Dev mode for local testing
  • โ€”One-Click Deployment: Deploy generated apps directly to HF Spaces

๐Ÿ—๏ธ Architecture

anycoder/
โ”œโ”€โ”€ backend_api.py           # FastAPI backend with streaming
โ”œโ”€โ”€ frontend/                # Next.js React frontend
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ app/            # Pages (page.tsx, layout.tsx, globals.css)
โ”‚   โ”‚   โ”œโ”€โ”€ components/     # React components
โ”‚   โ”‚   โ”œโ”€โ”€ lib/            # API client, auth utilities
โ”‚   โ”‚   โ””โ”€โ”€ types/          # TypeScript types
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ requirements.txt        # Python dependencies
โ”œโ”€โ”€ Dockerfile              # Docker Space configuration
โ””โ”€โ”€ start_fullstack.sh      # Local development script

๐Ÿš€ Quick Start

Local Development

  1. 1.Backend:
bash
export HF_TOKEN="your_huggingface_token"
export GEMINI_API_KEY="your_gemini_api_key"
python backend_api.py
  1. 1.Frontend (new terminal):
bash
cd frontend
npm install
npm run dev
  1. 1.Open http://localhost:3000

Using start script:

bash
export HF_TOKEN="your_token"
export GEMINI_API_KEY="your_gemini_api_key"
./start_fullstack.sh

๐Ÿณ Docker Space Deployment

This app runs as a Docker Space on HuggingFace. The Dockerfile:

  • โ€”Builds the Next.js frontend
  • โ€”Runs FastAPI backend on port 7860
  • โ€”Uses proper user permissions (UID 1000)
  • โ€”Handles environment variables securely

๐Ÿ”‘ Authentication

  • โ€”Dev Mode (localhost): Mock login for testing
  • โ€”Production: HuggingFace OAuth with manage-repos scope

๐Ÿ“ Supported Languages

  • โ€”html - Static HTML pages
  • โ€”gradio - Python Gradio apps
  • โ€”streamlit - Python Streamlit apps
  • โ€”react - React/Next.js apps
  • โ€”transformers.js - Browser ML apps
  • โ€”comfyui - ComfyUI workflows

๐Ÿค– Available Models

The following models are currently supported and used by AnyCoder:

models:

  • โ€”MiniMaxAI/MiniMax-M2.5
  • โ€”zai-org/GLM-5
  • โ€”Qwen/Qwen3-Coder-Next
  • โ€”moonshotai/Kimi-K2.5
  • โ€”zai-org/GLM-4.7-Flash
  • โ€”zai-org/GLM-4.7
  • โ€”MiniMaxAI/MiniMax-M2.1
  • โ€”zai-org/GLM-4.6
  • โ€”zai-org/GLM-4.6V
  • โ€”deepseek-ai/DeepSeek-V3
  • โ€”deepseek-ai/DeepSeek-R1
  • โ€”MiniMaxAI/MiniMax-M2
  • โ€”moonshotai/Kimi-K2-Thinking

๐ŸŽฏ Usage

  1. 1.Sign in with HuggingFace (or use Dev Login locally)
  2. 2.Select a language and AI model
  3. 3.Describe your app in the chat
  4. 4.Watch code generate in real-time
  5. 5.Click ๐Ÿš€ Deploy to publish to HF Spaces

๐Ÿ› ๏ธ Environment Variables

  • โ€”HF_TOKEN - HuggingFace API token (required)
  • โ€”GEMINI_API_KEY - Google Gemini API key (required for Gemini 3 Pro Preview)
  • โ€”POE_API_KEY - Poe API key (optional, for GPT-5 and Claude models)
  • โ€”DASHSCOPE_API_KEY - DashScope API key (optional, for Qwen models)
  • โ€”OPENROUTER_API_KEY - OpenRouter API key (optional, for Sherlock models)
  • โ€”MISTRAL_API_KEY - Mistral API key (optional, for Mistral models)

๐Ÿ“ฆ Tech Stack

Frontend:

  • โ€”Next.js 14
  • โ€”TypeScript
  • โ€”Tailwind CSS
  • โ€”Monaco Editor

Backend:

  • โ€”FastAPI
  • โ€”HuggingFace Hub
  • โ€”Server-Sent Events (SSE)

๐Ÿ“„ License

MIT