Skip to content

ScholarLensAI/scholarlensAI-FE

Repository files navigation

ScholarLens Frontend

Frontend web application for ScholarLens, a paper reading assistant service

Overview

  • Provides UI for paper upload/analysis/viewing based on Next.js (App Router)
  • Visualizes summary/Q&A/translation/highlight results by integrating with ScholarLens backend API

Tech Stack

Category Technology
Framework Next.js (App Router)
Language TypeScript
Styling Tailwind CSS
UI Components shadcn/ui
Deployment Docker, Docker Compose

Key Features

1. Document Upload and Viewer

  • Drag & Drop Upload: Easy PDF file upload
  • PDF Viewer: Renders uploaded papers page by page
  • Interactive UI: Section-wise summaries, translation, and highlight display

2. AI-Powered Analysis

  • Summary: Section-wise key content summarization
  • Q&A: Context-based conversational questions and answers
  • Translation: Korean translation of selected sections or text
  • Highlights: Automatic extraction and display of important sentences

Quick Start

Requirements

  • Node.js 18+
  • npm or pnpm
  • Backend server running (http://localhost:8000)

How to Run

🐳 Option 1: Docker Compose (Recommended)

# Clone repository
git clone https://github.com/ScholarLensAI/scholarlensAI-FE.git
cd scholarlensAI-FE

# Run with Docker Compose
docker compose up --build

# Run in background
docker compose up -d

# Stop
docker compose down

πŸ’» Option 2: Local Development Mode

# Clone repository
git clone https://github.com/ScholarLensAI/scholarlensAI-FE.git
cd scholarlensAI-FE

# Install dependencies
npm install

# Run development server
npm run dev

# To run on a different port
npm run dev -- -p 3001

Access After Running


Environment Setup

By default, it uses the configuration values in lib/config.ts (http://localhost:8000) and can run without additional setup.

To change the backend URL, create a .env.local file:

NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
BACKEND_API_URL=http://localhost:8000
Environment Variable Default Description
NEXT_PUBLIC_BACKEND_URL http://localhost:8000 Backend address to be called from client
BACKEND_API_URL http://localhost:8000 Backend address to be called from server side
BACKEND_INTERNAL_URL BACKEND_API_URL Backend address for Docker internal network

Project Structure

scholarlensAI-FE/
β”œβ”€β”€ app/                          # Next.js App Router
β”‚   β”œβ”€β”€ api/                      # Proxy/Backend integration API Routes
β”‚   β”‚   β”œβ”€β”€ chat/route.ts         # Q&A requests
β”‚   β”‚   β”œβ”€β”€ highlights/route.ts   # Highlight queries
β”‚   β”‚   β”œβ”€β”€ translate/route.ts    # Translation requests
β”‚   β”‚   └── upload/route.ts       # File upload requests
β”‚   β”œβ”€β”€ reader/page.tsx           # Document upload page
β”‚   β”œβ”€β”€ viewer/                   # Viewer page
β”‚   β”‚   β”œβ”€β”€ loading.tsx           # Loading UI
β”‚   β”‚   └── page.tsx
β”‚   β”œβ”€β”€ globals.css               # Global styles
β”‚   β”œβ”€β”€ layout.tsx                # Root layout
β”‚   └── page.tsx                  # Main page
β”‚
β”œβ”€β”€ components/                   # React components
β”‚   β”œβ”€β”€ pdf/pdf-viewer.tsx        # pdf-viewer component
β”‚   β”œβ”€β”€ ui/                       # UI components (shadcn/ui)
β”‚   β”‚   β”œβ”€β”€ button.tsx
β”‚   β”‚   β”œβ”€β”€ card.tsx
β”‚   β”‚   β”œβ”€β”€ input.tsx
β”‚   β”‚   β”œβ”€β”€ tabs.tsx
β”‚   β”‚   └── textarea.tsx
β”‚   └── theme-provider.tsx        # Theme provider
β”‚
β”œβ”€β”€ lib/                          # Utility functions
β”‚   β”œβ”€β”€ config.ts                 # Common utilities
β”‚   └── utils.ts                  # Common utilities
β”‚
β”œβ”€β”€ public/                       # Static files
β”œβ”€β”€ styles/                       # Global styles
β”œβ”€β”€ .eslintrc.js
β”œβ”€β”€ .gitignore
β”œβ”€β”€ .dockerignore
β”œβ”€β”€ docker-compose.yml            # Docker execution settings
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ components.json               # shadcn/ui configuration
β”œβ”€β”€ next.config.mjs               # Next.js configuration
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ package.json
β”œβ”€β”€ postcss.config.mjs            # PostCSS configuration
β”œβ”€β”€ README.md
└── tsconfig.json                 # TypeScript configuration

πŸ–₯️ Page Structure

Main Page (/)

  • Project introduction and key features overview
  • Entry point to upload page

Upload Page (/reader)

  • PDF file upload UI (Drag & Drop support)
  • Automatically navigates to viewer page upon successful upload

Viewer Page (/viewer)

  • PDF rendering and navigation
  • Tab interface:
    • Summary: View section-wise summaries
    • Q&A: Understand papers through AI conversation
    • Translation: Translate selected text
    • Highlights: Sentence highlights

Troubleshooting

When Environment Variables Are Not Recognized

  • Verify that .env.local file is in the project root
  • Check for NEXT_PUBLIC_ prefix
  • Restart development server

Port Conflict

npm run dev -- -p 3001

Dependency Errors

rm -rf node_modules package-lock.json
npm install

Build Errors

rm -rf .next
npm run build

Docker-Related Issues

docker compose down
docker system prune -a
docker compose up --build

Backend Connection Failure

  • Verify that backend server (http://localhost:8000) is running
  • Check backend URL in .env.local
  • Verify network/firewall settings

Releases

No releases published

Packages

 
 
 

Contributors