You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+97-42Lines changed: 97 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
-
# LayerZero
1
+
# Layerzero
2
2
3
3
AI-powered content summarization platform built with React, Express.js, MongoDB, and a hybrid LLM architecture.
4
4
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.
6
6
7
7
---
8
8
9
9
## Overview
10
10
11
11
Most content summarization tools force users into a single AI provider.
12
12
13
-
LayerZero takes a different approach.
13
+
Layerzero takes a different approach.
14
14
15
15
Users can choose between:
16
16
@@ -19,7 +19,7 @@ Users can choose between:
19
19
***Gemma 4 via Ollama** for local inference and privacy-focused workflows*
20
20
***Sarvam 30B** for Hinglish and multilingual conversational workflows*
21
21
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.
23
23
24
24
---
25
25
@@ -48,8 +48,8 @@ Whether you're summarizing a research paper, technical documentation, blog post,
@@ -98,15 +99,22 @@ Whether you're summarizing a research paper, technical documentation, blog post,
98
99
* Strict payload validation using Zod schemas
99
100
* Secure password hashing with bcrypt
100
101
* 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
102
109
103
110
### Infrastructure
104
111
112
+
* One-command startup script (`start.sh`) for Docker Compose
105
113
* 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)
107
115
* 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
110
118
* SHA-256 content hashing for cache deduplication
111
119
* Cache-first retrieval strategy with automatic TTL expiration
112
120
* Local Ollama support via `host.docker.internal`
@@ -118,7 +126,7 @@ Whether you're summarizing a research paper, technical documentation, blog post,
118
126
119
127
### Multilingual Support
120
128
121
-
LayerZero includes Sarvam 30B support for Hinglish and multilingual interactions.
129
+
Layerzero includes Sarvam 30B support for Hinglish and multilingual interactions.
122
130
123
131
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.
124
132
@@ -216,7 +224,7 @@ PDF / DOCX Upload
216
224
│
217
225
┌───┴───┐
218
226
▼ ▼
219
-
pdf-parse mammoth
227
+
pdfjs-dist mammoth
220
228
│ │
221
229
└───┬───┘
222
230
▼
@@ -232,11 +240,12 @@ pdf-parse mammoth
232
240
### Technologies Used
233
241
234
242
* Multer
235
-
*pdf-parse
243
+
*pdfjs-dist
236
244
* mammoth
237
245
* Gemini API
238
246
* Cerebras API
239
247
* Gemma 4
248
+
* Sarvam AI
240
249
241
250
---
242
251
@@ -249,15 +258,22 @@ pdf-parse mammoth
249
258
* Tailwind CSS
250
259
* shadcn/ui
251
260
* jsPDF
261
+
* remark-gfm & rehype-raw
252
262
253
263
### Backend
254
264
255
265
* Node.js
256
-
* Express.js
266
+
* Express.js v5
267
+
* morgan (HTTP Logger)
257
268
258
269
### Database
259
270
260
-
* MongoDB
271
+
* MongoDB via Mongoose
272
+
273
+
### Caching & Rate Limiting
274
+
275
+
* Upstash Redis (`@upstash/redis`)
276
+
* Upstash Ratelimit (`@upstash/ratelimit`)
261
277
262
278
### Authentication & Security
263
279
@@ -269,19 +285,23 @@ pdf-parse mammoth
269
285
270
286
* Axios
271
287
* JSDOM
272
-
* Mozilla Readability
288
+
* Mozilla Readability (`@mozilla/readability`)
273
289
* Multer
274
-
*pdf-parse
290
+
*pdfjs-dist
275
291
* mammoth
276
292
293
+
### Testing
294
+
295
+
* Jest
296
+
* Supertest
297
+
* mongodb-memory-server
298
+
277
299
### Infrastructure
278
300
279
-
* Docker
280
-
* Docker Compose
301
+
* Docker & Docker Compose
281
302
* AWS EC2
282
303
* GitHub Actions
283
304
* Redis
284
-
*@upstash/ratelimit
285
305
286
306
### AI Models
287
307
@@ -301,6 +321,7 @@ pdf-parse mammoth
301
321
```http
302
322
POST /api/auth/user/register
303
323
```
324
+
*Returns `201 Created` with user object and sets `jwt` httpOnly cookie.*
304
325
305
326
#### Login
306
327
@@ -324,7 +345,7 @@ GET /api/auth/user/check
324
345
325
346
### Protected Routes
326
347
327
-
Authentication required.
348
+
Authentication required. All endpoints support both standard JSON responses and real-time Server-Sent Events (SSE) streaming.
328
349
329
350
#### Website Summarization
330
351
@@ -337,7 +358,8 @@ Request Body
337
358
```json
338
359
{
339
360
"url": "https://example.com/article",
340
-
"client": "gemini"
361
+
"client": "gemini",
362
+
"stream": true
341
363
}
342
364
```
343
365
@@ -348,6 +370,8 @@ Request Body
348
370
*`gemma`
349
371
*`sarvam`
350
372
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
+
351
375
---
352
376
353
377
#### Document Summarization (PDF / DOCX)
@@ -367,16 +391,21 @@ Fields
367
391
```text
368
392
document: file.pdf or file.docx
369
393
client: gemini or cerebras or gemma or sarvam
394
+
stream: true (optional)
370
395
```
371
396
397
+
*Optional*: Include `stream: true` to receive a real-time SSE token stream (`text/event-stream`).
398
+
372
399
---
373
400
374
401
## Project Structure
375
402
376
403
```bash
377
-
LayerZero/
404
+
Layerzero/
378
405
│
379
406
├── docker-compose.yml
407
+
├── start.sh
408
+
├── README.md
380
409
│
381
410
├── client/
382
411
│ ├── Dockerfile
@@ -387,17 +416,24 @@ LayerZero/
387
416
│ ├── layouts/
388
417
│ └── lib/
389
418
│
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
401
437
```
402
438
403
439
## Deployment
@@ -406,10 +442,18 @@ The backend server is deployed on an **AWS EC2 instance**, managed through a ful
406
442
407
443
---
408
444
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:
410
448
411
449
```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
413
457
```
414
458
415
459
This starts the client, server, and Redis containers together.
@@ -418,6 +462,17 @@ This starts the client, server, and Redis containers together.
418
462
419
463
---
420
464
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
+
421
476
## Running Locally (without Docker)
422
477
423
478
### Clone Repository
@@ -474,17 +529,18 @@ npm run dev
474
529
475
530
---
476
531
477
-
## Why LayerZero?
532
+
## Why Layerzero?
478
533
479
534
Most summarization platforms rely entirely on cloud-hosted AI.
480
535
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.
482
537
483
538
Benefits include:
484
539
485
540
* Reduced API dependency
486
541
* Local AI execution
487
542
* Four selectable AI models
543
+
* Real-time streaming support
488
544
* Improved privacy via local inference
489
545
* Hybrid cloud/local architecture
490
546
@@ -502,7 +558,6 @@ Because sometimes you want the power of a cloud model, and sometimes you want yo
502
558
503
559
## Coming Soon
504
560
505
-
* Streaming responses
506
561
* Summary history and persistence
507
562
* Multi-document summarization
508
563
* Background processing for large documents
@@ -515,4 +570,4 @@ MIT License
515
570
516
571
---
517
572
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