A production-grade AI engine that automatically generates high-quality, professional LeetCode discussion posts from accepted solutions.
[ INTERACTIVE: SYSTEM DIAGNOSTICS ]
Welcome to the LeetWrite diagnostic shell.
> run analyze_workflow.sh
Analyzing algorithmic complexity...<br/>
Validating temporal constraints...<br/>
Optimization patterns detected.<br/><br/>
<details>
<summary><b>> run generate_documentation.sh</b></summary>
<br/>
Success. Output generated in 0.42s.<br/>
Proceed to <b>Getting Started</b> to deploy your instance.
</details>
LeetWrite AI functions as an automated senior engineering proxy. It intercepts raw, accepted algorithm solutions and orchestrates a highly-structured, markdown-formatted technical write-up. The system automatically performs static analysis to deduce time and space complexities, extracts core takeaways, and crafts professional Intuition and Approach documentation.
This project is built to production-ready SaaS standards, featuring a strict brutalist UI constructed with Next.js and a modular, decoupled Spring Boot backend.
- Instant Generation: Transforms raw code into meticulously crafted technical documentation with sub-second latency.
- Dynamic Theming Engine: Built-in Light/Dark mode with a customizable 5-color accent system utilizing dynamic CSS variables.
- Markdown Synchronization: Features a seamless, dual-pane architecture where raw Markdown edits instantly reflect in the visual rendering.
- Robust Validation: Frontend strict schema validation via Zod ensures only sanitized payloads reach the backend infrastructure.
- Resilient Backend: Modular AI Service integration featuring graceful exponential backoff and strict JSON parsing logic.
- Stateless Architecture: Operates with zero persistent database dependencies; a pure, lightning-fast stateless API proxy.
Frontend Infrastructure
- Framework: Next.js (App Router)
- Styling Engine: Tailwind CSS v4
- Language: TypeScript
- Validation: Zod
Backend Infrastructure
- Framework: Spring Boot 3
- Runtime: Java 21+
- Containerization: Docker (Multi-stage build)
- AI Integration: OpenRouter API Proxy
The following instructions detail the local development setup for both the frontend and backend services.
- Node.js (v18 or higher)
- Java 21 (or higher)
- Active OpenRouter API Key
git clone https://github.com/mxoizzz/LeetWrite-AI.git
cd LeetWrite-AI- Navigate to the backend directory:
cd backend - Create the environment configuration:
cp .env.example .env
- Populate
.envwith the required credentials:OPENROUTER_API_KEY=your_actual_api_key_here OPENROUTER_BASE_URL=https://openrouter.ai/api/v1 OPENROUTER_MODEL=deepseek/deepseek-chat SERVER_PORT=8081
- Initialize the Spring Boot server:
The backend will initialize and bind to
./mvnw spring-boot:run
http://localhost:8081.
- Open a secondary terminal and navigate to the frontend directory:
cd frontend - Install dependencies:
npm install
- Initialize the Next.js development server:
The frontend will compile and bind to
npm run dev
http://localhost:3000.
This repository is pre-configured for immediate deployment to modern cloud infrastructure.
Backend (Render)
The backend includes a highly-optimized, multi-stage Dockerfile and dynamic port binding logic. Import the repository into Render as a Docker Web Service, specify the root directory as backend, and provide the OPENROUTER_API_KEY environment variable.
Frontend (Vercel)
The frontend is built for Vercel. Import the repository, set the Root Directory to frontend, ensure the Framework Preset is set to Next.js, and inject the backend URL via the NEXT_PUBLIC_API_URL environment variable.
The project strictly adheres to Separation of Concerns (SoC) principles:
- Frontend (
/frontend): Exclusively handles UI state, client-side validation, theme management, and dynamic markdown rendering. - Backend (
/backend): Functions as a secure, stateless proxy layer. It sanitizes prompts, orchestrates communication with the LLM provider, and standardizes payload structures.
Modular AI Strategy
The core AI integration is abstracted behind a primary AIService interface. Migrating execution from OpenRouter to alternatives such as OpenAI, Anthropic, or Gemini requires solely injecting a new interface implementation, leaving the core application logic untouched.
Moiz Shaikh (@mxoizzz)
- GitHub: github.com/mxoizzz
- LinkedIn: in/moizshaikh007
Distributed under the MIT License. See LICENSE for more information.
Crafted with precision for competitive engineers.