Skip to content

Commit a9e1184

Browse files
committed
feat: implement global theme system with light/dark mode support and refactor styling to use CSS variables
1 parent 9384312 commit a9e1184

37 files changed

Lines changed: 1490 additions & 630 deletions

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Contributing to LayerZero
1+
# Contributing to Layerzero
22

3-
Thanks for checking out LayerZero! This is an actively maintained personal project, and contributions, bug reports, and suggestions are welcome.
3+
Thanks for checking out Layerzero! This is an actively maintained personal project, and contributions, bug reports, and suggestions are welcome.
44

55
## Tech Stack
66

README.md

Lines changed: 97 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# LayerZero
1+
# Layerzero
22

33
AI-powered content summarization platform built with React, Express.js, MongoDB, and a hybrid LLM architecture.
44

5-
LayerZero allows users to summarize PDFs, DOCX files, and web content using cloud-based or locally hosted language models. The platform focuses on simplicity, speed, and flexibility while providing a secure authentication layer and a clean content-processing pipeline.
5+
Layerzero allows users to summarize PDFs, DOCX files, and web content using cloud-based or locally hosted language models. The platform focuses on simplicity, speed, and flexibility while providing a secure authentication layer and a clean content-processing pipeline.
66

77
---
88

99
## Overview
1010

1111
Most content summarization tools force users into a single AI provider.
1212

13-
LayerZero takes a different approach.
13+
Layerzero takes a different approach.
1414

1515
Users can choose between:
1616

@@ -19,7 +19,7 @@ Users can choose between:
1919
* **Gemma 4 via Ollama** for local inference and privacy-focused workflows*
2020
* **Sarvam 30B** for Hinglish and multilingual conversational workflows*
2121

22-
Whether you're summarizing a research paper, technical documentation, blog post, or an article you definitely intended to read later, LayerZero extracts the content and generates concise summaries within seconds.
22+
Whether you're summarizing a research paper, technical documentation, blog post, or an article you definitely intended to read later, Layerzero extracts the content and generates concise summaries within seconds.
2323

2424
---
2525

@@ -48,8 +48,8 @@ Whether you're summarizing a research paper, technical documentation, blog post,
4848
</tr>
4949
<tr>
5050
<td align="center">
51-
<strong>URL Summarizer</strong><br>
52-
<img src="client/screenshots/url.png" width="400">
51+
<strong>Doc Summarizer</strong><br>
52+
<img src="client/screenshots/doc.png" width="400">
5353
</td>
5454
<td align="center">
5555
<strong>Response</strong><br>
@@ -64,7 +64,7 @@ Whether you're summarizing a research paper, technical documentation, blog post,
6464

6565
### Content Ingestion
6666

67-
* PDF document uploads
67+
* PDF document uploads (parsed via `pdfjs-dist`)
6868
* DOCX document uploads
6969
* Website URL summarization
7070
* Automatic text extraction
@@ -80,8 +80,9 @@ Whether you're summarizing a research paper, technical documentation, blog post,
8080
* Eliminates redundant LLM inference for identical requests
8181
* Reduced repeated summary latency from ~8.5s to ~150ms (~98% improvement)
8282

83-
### AI-Powered Summarization
83+
### AI-Powered Summarization & Streaming
8484

85+
* Real-Time Token Streaming (Server-Sent Events / SSE)
8586
* Gemini 2.5 Flash integration
8687
* GPT OSS 120B integration via Cerebras
8788
* Gemma 4 integration via Ollama
@@ -98,15 +99,22 @@ Whether you're summarizing a research paper, technical documentation, blog post,
9899
* Strict payload validation using Zod schemas
99100
* Secure password hashing with bcrypt
100101
* Middleware-based authorization
101-
* Rate limiting on auth and LLM routes via Upstash Redis
102+
* Custom Upstash Redis sliding window rate limiting (`@upstash/ratelimit`) on auth and LLM routes
103+
104+
### Testing & Reliability
105+
106+
* Automated unit and integration testing suite via Jest & Supertest
107+
* In-memory MongoDB (`mongodb-memory-server`) for fast, isolated test runs
108+
* Automated test coverage for authentication flows and health checks
102109

103110
### Infrastructure
104111

112+
* One-command startup script (`start.sh`) for Docker Compose
105113
* Docker Compose setup for client, server, and Redis
106-
* AWS EC2 deployment for backend services
114+
* AWS EC2 deployment for backend services (HTTP / HTTPS with SSL support)
107115
* Automated CI/CD pipeline via GitHub Actions
108-
* Separate Dockerfiles for frontend and backend
109-
* Upstash Redis integration for intelligent summary caching
116+
* Centralized server source directory (`server/src/`) with `app.js` and `server.js` separation
117+
* Upstash Redis integration for intelligent summary caching and rate limiting
110118
* SHA-256 content hashing for cache deduplication
111119
* Cache-first retrieval strategy with automatic TTL expiration
112120
* Local Ollama support via `host.docker.internal`
@@ -118,7 +126,7 @@ Whether you're summarizing a research paper, technical documentation, blog post,
118126

119127
### Multilingual Support
120128

121-
LayerZero includes Sarvam 30B support for Hinglish and multilingual interactions.
129+
Layerzero includes Sarvam 30B support for Hinglish and multilingual interactions.
122130

123131
This enables more natural summarization and conversational workflows for users who frequently switch between English and Indian languages, while maintaining the same unified processing pipeline used across all supported models.
124132

@@ -216,7 +224,7 @@ PDF / DOCX Upload
216224
217225
┌───┴───┐
218226
▼ ▼
219-
pdf-parse mammoth
227+
pdfjs-dist mammoth
220228
│ │
221229
└───┬───┘
222230
@@ -232,11 +240,12 @@ pdf-parse mammoth
232240
### Technologies Used
233241

234242
* Multer
235-
* pdf-parse
243+
* pdfjs-dist
236244
* mammoth
237245
* Gemini API
238246
* Cerebras API
239247
* Gemma 4
248+
* Sarvam AI
240249

241250
---
242251

@@ -249,15 +258,22 @@ pdf-parse mammoth
249258
* Tailwind CSS
250259
* shadcn/ui
251260
* jsPDF
261+
* remark-gfm & rehype-raw
252262

253263
### Backend
254264

255265
* Node.js
256-
* Express.js
266+
* Express.js v5
267+
* morgan (HTTP Logger)
257268

258269
### Database
259270

260-
* MongoDB
271+
* MongoDB via Mongoose
272+
273+
### Caching & Rate Limiting
274+
275+
* Upstash Redis (`@upstash/redis`)
276+
* Upstash Ratelimit (`@upstash/ratelimit`)
261277

262278
### Authentication & Security
263279

@@ -269,19 +285,23 @@ pdf-parse mammoth
269285

270286
* Axios
271287
* JSDOM
272-
* Mozilla Readability
288+
* Mozilla Readability (`@mozilla/readability`)
273289
* Multer
274-
* pdf-parse
290+
* pdfjs-dist
275291
* mammoth
276292

293+
### Testing
294+
295+
* Jest
296+
* Supertest
297+
* mongodb-memory-server
298+
277299
### Infrastructure
278300

279-
* Docker
280-
* Docker Compose
301+
* Docker & Docker Compose
281302
* AWS EC2
282303
* GitHub Actions
283304
* Redis
284-
* @upstash/ratelimit
285305

286306
### AI Models
287307

@@ -301,6 +321,7 @@ pdf-parse mammoth
301321
```http
302322
POST /api/auth/user/register
303323
```
324+
*Returns `201 Created` with user object and sets `jwt` httpOnly cookie.*
304325

305326
#### Login
306327

@@ -324,7 +345,7 @@ GET /api/auth/user/check
324345

325346
### Protected Routes
326347

327-
Authentication required.
348+
Authentication required. All endpoints support both standard JSON responses and real-time Server-Sent Events (SSE) streaming.
328349

329350
#### Website Summarization
330351

@@ -337,7 +358,8 @@ Request Body
337358
```json
338359
{
339360
"url": "https://example.com/article",
340-
"client": "gemini"
361+
"client": "gemini",
362+
"stream": true
341363
}
342364
```
343365

@@ -348,6 +370,8 @@ Request Body
348370
* `gemma`
349371
* `sarvam`
350372

373+
*Optional*: Send `stream: true` in JSON body or pass `?stream=true` as a query parameter to enable real-time SSE token streaming (`text/event-stream`).
374+
351375
---
352376

353377
#### Document Summarization (PDF / DOCX)
@@ -367,16 +391,21 @@ Fields
367391
```text
368392
document: file.pdf or file.docx
369393
client: gemini or cerebras or gemma or sarvam
394+
stream: true (optional)
370395
```
371396

397+
*Optional*: Include `stream: true` to receive a real-time SSE token stream (`text/event-stream`).
398+
372399
---
373400

374401
## Project Structure
375402

376403
```bash
377-
LayerZero/
404+
Layerzero/
378405
379406
├── docker-compose.yml
407+
├── start.sh
408+
├── README.md
380409
381410
├── client/
382411
│ ├── Dockerfile
@@ -387,17 +416,24 @@ LayerZero/
387416
│ ├── layouts/
388417
│ └── lib/
389418
390-
├── server/
391-
│ ├── Dockerfile
392-
│ ├── app.js
393-
│ ├── controllers/
394-
│ ├── middlewares/
395-
│ ├── routes/
396-
│ ├── models/
397-
│ ├── services/
398-
│ └── config/
399-
400-
└── README.md
419+
└── server/
420+
├── Dockerfile
421+
├── jest.config.js
422+
├── src/
423+
│ ├── app.js
424+
│ ├── server.js
425+
│ ├── config/
426+
│ ├── controllers/
427+
│ ├── middlewares/
428+
│ ├── models/
429+
│ ├── routes/
430+
│ ├── services/
431+
│ ├── utils/
432+
│ └── validators/
433+
└── tests/
434+
├── setup.js
435+
├── auth.test.js
436+
└── health.test.js
401437
```
402438

403439
## Deployment
@@ -406,10 +442,18 @@ The backend server is deployed on an **AWS EC2 instance**, managed through a ful
406442

407443
---
408444

409-
## Running with Docker
445+
## Quick Startup (with Docker)
446+
447+
Run the convenient startup script to build and launch all services in detached mode:
410448

411449
```bash
412-
docker-compose up --build
450+
./start.sh
451+
```
452+
453+
Or manually using Docker Compose:
454+
455+
```bash
456+
docker compose up --build -d
413457
```
414458

415459
This starts the client, server, and Redis containers together.
@@ -418,6 +462,17 @@ This starts the client, server, and Redis containers together.
418462
419463
---
420464

465+
## Running Backend Tests
466+
467+
Layerzero features an automated testing suite using Jest, Supertest, and an in-memory MongoDB server.
468+
469+
```bash
470+
cd server
471+
npm test
472+
```
473+
474+
---
475+
421476
## Running Locally (without Docker)
422477

423478
### Clone Repository
@@ -474,17 +529,18 @@ npm run dev
474529

475530
---
476531

477-
## Why LayerZero?
532+
## Why Layerzero?
478533

479534
Most summarization platforms rely entirely on cloud-hosted AI.
480535

481-
LayerZero combines cloud and local inference, giving users more control over privacy, performance, and operational costs.
536+
Layerzero combines cloud and local inference, giving users more control over privacy, performance, and operational costs.
482537

483538
Benefits include:
484539

485540
* Reduced API dependency
486541
* Local AI execution
487542
* Four selectable AI models
543+
* Real-time streaming support
488544
* Improved privacy via local inference
489545
* Hybrid cloud/local architecture
490546

@@ -502,7 +558,6 @@ Because sometimes you want the power of a cloud model, and sometimes you want yo
502558

503559
## Coming Soon
504560

505-
* Streaming responses
506561
* Summary history and persistence
507562
* Multi-document summarization
508563
* Background processing for large documents
@@ -515,4 +570,4 @@ MIT License
515570

516571
---
517572

518-
Built with React, Node(Express), MongoDB, Redis and a stubborn refusal to choose between cloud AI and local AI.
573+
Built with React, Node (Express), MongoDB, Redis and a stubborn refusal to choose between cloud AI and local AI.

0 commit comments

Comments
 (0)