PDF Summarizer is a web application that allows users to upload PDF files and generate concise text summaries. Users can also view previously generated summaries and access their uploaded PDF files. The project consists of two main components:
- Frontend: A user-friendly interface built with modern web technologies.
- Backend: A server that processes PDF files and generates summaries.
- Node.js
18.18.0
-
Navigate to the
frontend
directory: -
Install dependencies:
npm install
-
Create a
.env
file in the/frontend
directory and copy the contents from.env-example
.Configure the following environment variables:
Variable Description Required Default Value VITE_API_URL
Backend API URL Yes http://localhost:3000 -
Run the application (by default is accessible at
http://localhost:5173
):-
Development mode:
npm run dev
-
Production build:
npm run build npm run serve
-
-
Navigate to the
backend
directory; -
Install dependencies:
npm install
-
Create a
.env
file in the/backend
directory and copy the contents from.env-example
. Configure the following environment variables:Variable Description Required Default Value OPENAI_API_KEY
OpenAI API key Yes - OPENAI_MODEL
OpenAI model used for processing No "gpt-3.5-turbo-0125"
PORT
Port on which the backend server runs No 3000
FRONTEND_APP_URL
Frontend origin URL (used for CORS configuration) No "http://localhost:5173"
-
Run the application (by default is accessible at
http://localhost:3000
):-
Development mode:
npm run start:dev
-
Production build:
npm run build npm run start:prod
-
The project includes a docker-compose.yml
file for easy containerization. You can run both frontend and backend services together or separately.
docker-compose up
-
Frontend only:
docker-compose up frontend
-
Backend only:
docker-compose up backend
- Frontend:
http://localhost:5173
- Backend:
http://localhost:3000
http://localhost:3000/summaries
- Description: Get all summaries
- Query Parameters:
take
(optional): Limit number of results
- Response:
[ { "id": 1, "title": "Generated summary title", "text": "Generated summary text...", "file": "generated-file-name.pdf" } ]
- Description: Get a single summary by ID
- Response:
{ "id": 1, "title": "Generated summary title", "text": "Generated summary text...", "file": "generated-file-name.pdf" }
-
Description: Upload a PDF file and generate summary
-
Content-Type:
multipart/form-data
-
Request Body:
file
: PDF file to upload
-
Success Response:
{ "id": 1, "title": "Generated summary title", "text": "Generated summary text...", "file": "generated-file-name.pdf" }
-
Error Responses:
400 Bad Request
if no file uploaded415 Unsupported Media Type
if file is not PDF
- Description: Delete a summary by ID
- Success Response:
204 No Content
- Description: Access previously uploaded PDF files
- Response:
- Returns the PDF file as a downloadable attachment
- If the file doesn't exist, returns
404 Not Found
Example Request:
GET /public/files/document.pdf
Notes:
- Files are stored in the backend's
public/files
directory - Filenames should match exactly (case-sensitive)