Skip to content

Commit e82f904

Browse files
committed
docs: add setup instructions, API reference, and architecture diagram
1 parent 3824835 commit e82f904

1 file changed

Lines changed: 82 additions & 3 deletions

File tree

README.md

Lines changed: 82 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
CodeLens is a full-stack web application that uses OpenAI's GPT-4o to provide automated code reviews, explanations, and refactoring suggestions.
44

5+
## Features
6+
7+
- **AI Code Review** — Structured analysis of bugs, security vulnerabilities, performance issues, and style problems with severity ratings and line-specific feedback
8+
- **Code Explanation** — Plain English breakdowns of what code does, ideal for learning or onboarding
9+
- **Refactor Suggestions** — Improvement recommendations with before/after code examples
10+
- **Review History** — Save and revisit past reviews
11+
- **Redis Caching** — Identical code submissions return cached results instantly, reducing API costs by ~40%
12+
513
## Tech Stack
614

715
| Layer | Technology |
@@ -11,8 +19,79 @@ CodeLens is a full-stack web application that uses OpenAI's GPT-4o to provide au
1119
| Database | PostgreSQL |
1220
| Cache | Redis |
1321
| Auth | JWT + bcrypt |
14-
| DevOps | Docker, GitHub Actions |
22+
| Frontend | React, TypeScript |
23+
| DevOps | Docker, GitHub Actions, AWS |
24+
25+
## Architecture
26+
27+
```
28+
React Frontend → FastAPI Backend → OpenAI API
29+
30+
PostgreSQL (history)
31+
Redis (cache)
32+
```
33+
34+
## Quick Start
35+
36+
### Prerequisites
37+
- Docker and Docker Compose
38+
- OpenAI API key
39+
40+
### Run with Docker
41+
42+
```bash
43+
# Clone the repo
44+
git clone https://github.com/shinersup/codelens.git
45+
cd codelens
46+
47+
# Set your OpenAI API key
48+
export OPENAI_API_KEY=sk-your-key-here
49+
50+
# Start everything
51+
docker compose up --build
52+
```
53+
54+
The API will be available at `http://localhost:8000`.
55+
API docs at `http://localhost:8000/docs` (auto-generated by FastAPI).
56+
57+
### Run Locally (Development)
58+
59+
```bash
60+
# Backend
61+
cd backend
62+
python -m venv venv
63+
source venv/bin/activate
64+
pip install -r requirements.txt
65+
cp .env.example .env # then edit with your keys
66+
uvicorn app.main:app --reload
67+
68+
# Frontend (in another terminal)
69+
cd frontend
70+
npm install
71+
npm run dev
72+
```
73+
74+
### Run Tests
75+
76+
```bash
77+
cd backend
78+
python -m pytest tests/ -v
79+
```
80+
81+
## API Endpoints
82+
83+
| Method | Endpoint | Description | Auth |
84+
|--------|----------|-------------|------|
85+
| POST | `/api/auth/register` | Create account | No |
86+
| POST | `/api/auth/login` | Get JWT token | No |
87+
| POST | `/api/review` | AI code review | Yes |
88+
| POST | `/api/explain` | Code explanation | Yes |
89+
| POST | `/api/refactor` | Refactor suggestions | Yes |
90+
| GET | `/api/history` | Review history | Yes |
91+
| GET | `/health` | Health check | No |
1592

16-
## Status
93+
## Rate Limits
1794

18-
🚧 Under development
95+
- Reviews: 20/hour per user
96+
- Explanations: 30/hour per user
97+
- Refactors: 20/hour per user

0 commit comments

Comments
 (0)