A modern Next.js 15 frontend for the PDF-RAG (Retrieval-Augmented Generation) application. Chat with your PDF documents and get precise citations with exact page and coordinate references.
| Category | Technology |
|---|---|
| Framework | Next.js 15 (App Router, Static Export) |
| React | React 19 |
| Language | TypeScript |
| Styling | Tailwind CSS |
| State Management | Redux Toolkit |
| Data Fetching | TanStack Query |
| Forms | React Hook Form + Yup |
| Charts | ApexCharts |
- Node.js 18+ (recommended: 20+)
- Yarn (preferred) or npm
- Backend server running (see Backend README)
-
Clone and navigate:
cd Frontend -
Install dependencies:
yarn install # or npm install -
Set up environment variables:
cp .env.example .env.local
Edit
.env.localand configure:# Docker Compose (backend container name) NEXT_PUBLIC_API_URL=http://PDF-RAG-Backend:8000 # Local backend on host: # NEXT_PUBLIC_API_URL=http://localhost:8000
Start the development server:
yarn dev
# or
npm run devOpen http://localhost:3000 in your browser.
yarn build
# or
npm run buildThe app is configured for static export. After building:
yarn start
# or
npm startsrc/
├── app/ # Next.js 15 App Router
│ ├── layout.tsx # Root layout with providers
│ ├── page.tsx # Home page
│ └── globals.css # Global styles
├── components/
│ ├── charts/ # ApexCharts components
│ │ ├── ChartWrapper.tsx # SSR-safe chart wrapper
│ │ └── DocumentStatsChart.tsx
│ ├── providers/ # Context providers
│ │ └── Providers.tsx # Redux + TanStack Query
│ └── ui/ # Reusable UI components
│ ├── Button.tsx
│ ├── Card.tsx
│ └── Input.tsx
├── hooks/ # Custom React hooks
│ ├── useChat.ts # Chat mutations with Redux
│ └── useDocuments.ts # Document CRUD operations
├── lib/ # Utilities and configs
│ ├── api.ts # API client
│ ├── queryClient.ts # TanStack Query config
│ ├── utils.ts # Helper functions
│ └── validations/ # Yup schemas
├── store/ # Redux Toolkit
│ ├── index.ts # Store configuration
│ └── slices/ # Redux slices
│ ├── chatSlice.ts
│ └── documentSlice.ts
└── types/ # TypeScript types
└── index.ts
- Redux Toolkit for global state (documents, chat messages)
- TanStack Query for server state (caching, refetching)
- Typed hooks (
useAppDispatch,useAppSelector)
- React Hook Form for form state management
- Yup schemas for validation
- Pre-built schemas in
src/lib/validations/
- SSR-safe ApexCharts integration
ChartWrappercomponent with dynamic imports- Dark mode support
- Typed API methods in
src/lib/api.ts - Automatic error handling
- Query key management for cache invalidation
Tailwind CSS with:
- Custom utility function
cn()for class merging - Dark mode support
- Responsive design utilities
| Script | Description |
|---|---|
yarn dev |
Start development server |
yarn build |
Build for production |
yarn start |
Start production server |
yarn lint |
Run ESLint |
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes
- Run linting:
yarn lint - Test the build:
yarn build - Commit with clear messages
- Push and create a Pull Request
MIT License - See LICENSE for details.