|
1 | | -# 🚀 CodeScribeAI |
| 1 | +# CodeScribeAI |
| 2 | + |
| 3 | +CodeScribeAI is a local-first coding assistant with: |
| 4 | +- FastAPI backend |
| 5 | +- React + Vite frontend |
| 6 | +- GitHub repository analysis |
| 7 | +- Ollama-powered AI responses |
| 8 | + |
| 9 | +## Current Architecture |
| 10 | +- Backend: `main.py` (FastAPI) |
| 11 | +- Frontend: `frontend/` (React, Vite) |
| 12 | +- Session store: SQLite (`sessions.db`) |
| 13 | +- Optional async workers: Celery + Redis |
| 14 | + |
| 15 | +## Prerequisites |
| 16 | +- Python 3.10+ |
| 17 | +- Node.js 18+ |
| 18 | +- Ollama installed and running |
| 19 | +- (Optional) Redis for async chat endpoints |
| 20 | + |
| 21 | +## Environment Setup |
| 22 | +1. Copy `.env.example` to `.env` |
| 23 | +2. Fill real credentials and secrets |
2 | 24 |
|
3 | | -🚧 Note: The Project is in development |
4 | | -<br> |
5 | | -**CodeScribeAI** is an AI-powered coding assistant that helps you **explore, debug, and understand code** effortlessly. |
6 | | -Built with **React**, **Node.js**, and **Ollama LLM**, it’s designed to boost developer productivity and make coding more intuitive. |
7 | | - |
8 | | ---- |
9 | | - |
10 | | -## ✨ Features |
11 | | - |
12 | | -- 🤖 **AI-Powered Assistance** – Get instant explanations, debugging help, and code insights. |
13 | | -- 📂 **File Analysis** – Upload or select files for detailed breakdowns. |
14 | | -- 💡 **Smart Suggestions** – Improve your code with AI-driven recommendations. |
15 | | -- 🎨 **Clean UI** – Minimal and distraction-free interface built with React + Tailwind. |
16 | | -- ðŸ› ï¸ **Extensible Backend** – Node.js + Express API with modular routes. |
17 | | -- 🔒 **In Progress** – Actively being developed with new features coming soon! |
18 | | - |
19 | | ---- |
20 | | - |
21 | | -## ðŸ› ï¸ Tech Stack |
22 | | - |
23 | | -**Frontend** |
24 | | -- âš›ï¸ React |
25 | | -- 🎨 Tailwind CSS |
26 | | -- 🔄 React Router |
27 | | -- ✨ GSAP (animations) |
28 | | - |
29 | | -**Backend** |
30 | | -- 🟢 Node.js + Express |
31 | | -- ðŸ—„ï¸ MySQL2 (with SSL for DigitalOcean) |
32 | | -- 📦 Multer (file uploads) |
33 | | -- 📧 Nodemailer (email handling) |
34 | | - |
35 | | -**AI** |
36 | | -- 🧠[Ollama](https://ollama.ai) – Local LLM integration |
37 | | - |
38 | | ---- |
| 25 | +```bash |
| 26 | +cp .env.example .env |
| 27 | +``` |
39 | 28 |
|
40 | | -## 🚀 Getting Started |
| 29 | +Required keys: |
| 30 | +```env |
| 31 | +APP_ENV=development |
| 32 | +SECRET_KEY=replace-with-a-long-random-string |
| 33 | +FRONTEND_URL=http://localhost:5173 |
| 34 | +SESSION_TTL_SECONDS=3600 |
| 35 | +SESSIONS_DB_PATH=sessions.db |
| 36 | +GITHUB_CLIENT_ID=your_github_client_id |
| 37 | +GITHUB_CLIENT_SECRET=your_github_client_secret |
| 38 | +GITHUB_TOKEN=your_github_token |
| 39 | +OLLAMA_URL=http://127.0.0.1:11434 |
| 40 | +OLLAMA_MODEL=phi3:mini |
| 41 | +OLLAMA_FALLBACK_MODELS= |
| 42 | +``` |
41 | 43 |
|
42 | | -Follow these steps to set up CodeScribeAI locally: |
| 44 | +Optional async keys: |
| 45 | +```env |
| 46 | +CELERY_BROKER_URL=redis://localhost:6379/0 |
| 47 | +CELERY_RESULT_BACKEND=redis://localhost:6379/0 |
| 48 | +``` |
43 | 49 |
|
44 | | -### 1ï¸âƒ£ Clone the Repository |
| 50 | +## Install |
| 51 | +### Backend |
45 | 52 | ```bash |
46 | | -git clone https://github.com/your-username/codescribeAI.git |
47 | | -cd codescribeAI |
| 53 | +# from repo root |
| 54 | +python -m venv venv |
| 55 | +# Windows PowerShell |
| 56 | +.\venv\Scripts\Activate.ps1 |
| 57 | +pip install fastapi uvicorn httpx python-dotenv itsdangerous pydantic celery |
48 | 58 | ``` |
49 | | -### 2ï¸âƒ£ Install Dependencies |
| 59 | + |
| 60 | +### Frontend |
50 | 61 | ```bash |
51 | | -Frontend: |
52 | 62 | cd frontend |
53 | 63 | npm install |
54 | | -Backend: |
55 | | -cd backend |
56 | | -npm install |
57 | 64 | ``` |
58 | | -### 3️⃣ Configure Environment |
59 | | -Copy `.env.example` to `.env` and fill values: |
| 65 | + |
| 66 | +## Run Locally |
| 67 | +### 1) Start Ollama |
60 | 68 | ```bash |
61 | | -cp .env.example .env |
| 69 | +ollama serve |
| 70 | +ollama pull phi3:mini |
62 | 71 | ``` |
63 | | -Required values: |
| 72 | + |
| 73 | +### 2) Start backend |
64 | 74 | ```bash |
65 | | -APP_ENV=development |
66 | | -SECRET_KEY=replace-with-a-long-random-string |
67 | | -GITHUB_CLIENT_ID=your_github_client_id |
68 | | -GITHUB_CLIENT_SECRET=your_github_client_secret |
69 | | -GITHUB_TOKEN=your_github_token |
70 | | -OLLAMA_URL=http://127.0.0.1:11434 |
| 75 | +# from repo root |
| 76 | +.\venv\Scripts\Activate.ps1 |
| 77 | +uvicorn main:app --reload --host 127.0.0.1 --port 8000 |
71 | 78 | ``` |
72 | | -Security notes: |
73 | | -- Never commit `.env` to git. |
74 | | -- Rotate secrets immediately if they were ever shared. |
75 | | -### 4ï¸âƒ£ Run the Project |
76 | | -Start backend: |
| 79 | + |
| 80 | +### 3) Start frontend |
77 | 81 | ```bash |
78 | | -cd backend |
79 | | -npm run dev |
80 | | -Start frontend: |
81 | 82 | cd frontend |
82 | 83 | npm run dev |
83 | 84 | ``` |
84 | 85 |
|
85 | | ---- |
86 | | - |
87 | | -## 📌 Roadmap |
88 | | - AI-powered debugging suggestions |
89 | | - |
90 | | - Multi-file context awareness |
91 | | - |
92 | | - Chat-like interface for conversations with AI |
93 | | - |
94 | | - Cloud deployment (Vercel + DigitalOcean) |
95 | | - |
96 | | - Authentication & user profiles |
97 | | - |
98 | | -## 🤠Contributing |
99 | | -Contributions are welcome! |
| 86 | +Open: `http://localhost:5173` |
100 | 87 |
|
101 | | -Fork the repo |
| 88 | +## Optional: Async Worker (Celery) |
| 89 | +Only needed if you use async task endpoints. |
102 | 90 |
|
103 | | -Create a feature branch (git checkout -b feature-name) |
104 | | - |
105 | | -Commit changes (git commit -m "Add feature") |
106 | | - |
107 | | -Push to your branch (git push origin feature-name) |
108 | | - |
109 | | -Open a Pull Request 🎉 |
110 | | - |
111 | | -## 📜 License |
112 | | -This project is licensed under the MIT License. |
113 | | -See the LICENSE file for details. |
114 | | - |
115 | | -## 🌟 Support |
116 | | -If you like this project, please consider giving it a â on GitHub – it helps a lot! |
| 91 | +```bash |
| 92 | +# requires Redis running |
| 93 | +.\venv\Scripts\Activate.ps1 |
| 94 | +celery -A main:celery_app worker --loglevel=info --pool=solo |
| 95 | +``` |
117 | 96 |
|
118 | | -## 📸 Screenshots (Coming Soon) |
| 97 | +## Testing and Quality |
| 98 | +### Backend tests |
| 99 | +```bash |
| 100 | +python -m unittest discover -s tests -v |
| 101 | +``` |
119 | 102 |
|
| 103 | +### Frontend lint |
| 104 | +```bash |
| 105 | +cd frontend |
| 106 | +npm run lint |
| 107 | +``` |
120 | 108 |
|
| 109 | +## Key API Endpoints |
| 110 | +- `GET /health` |
| 111 | +- `GET /api/ai-status` |
| 112 | +- `POST /api/chat` |
| 113 | +- `POST /api/chat-async` (optional, Celery) |
| 114 | +- `GET /repos/{username}` |
| 115 | +- `GET /repos/{owner}/{repo}/files?recursive=true` |
| 116 | +- `GET /repos/{owner}/{repo}/file-content?path=...` |
| 117 | + |
| 118 | +## Security Notes |
| 119 | +- Never commit `.env`. |
| 120 | +- Rotate any leaked credentials immediately. |
| 121 | +- For non-development environments: |
| 122 | + - set a strong `SECRET_KEY` |
| 123 | + - use secure deployment secrets management |
| 124 | + |
| 125 | +## Production Readiness |
| 126 | +See `PRODUCTION_READINESS.md` for checklist and current status. |
0 commit comments