This is the React-based frontend for the Document Q&A Portal. It allows users to register, log in, upload documents, and ask questions about their documents using AI.
- Register/login with JWT authentication
- Upload and list documents
- Ask questions and display AI answers
- Friendly dashboard
- Integrates with Django REST backend
- Node.js 16+
- npm
-
Clone the repository
git clone https://github.com/ratinto/doc-frontend.git cd doc-frontend -
Install dependencies
npm install
-
Set the backend API URL
In
src/api.js, set:const api = axios.create({ baseURL: "http://localhost:8000/api/", // or your deployed backend URL });
For production, set the Render backend URL (e.g.,
https://doc-backend-xhh5.onrender.com/api/). -
Run the frontend
npm start
The app runs at http://localhost:3000.
- Push code to GitHub (or another Git provider).
- Go to Vercel and import your project.
- Deploy!
src/api.js– Axios config for backend APIsrc/AuthContext.js– Auth context using JWTsrc/pages/– Register, Login, Dashboard pagessrc/App.js– Routing
- If using environment variables for API URL:
- Create a
.envfile:REACT_APP_API_URL=https://doc-backend-xhh5.onrender.com/api/
- Create a