Below are real screenshots of the running application (not logos):
This repository contains a small full-stack application built for the Product Engineering Internship assignment. The app demonstrates:
- A React frontend (Create React App)
- A Node.js + Express backend that calls the OpenAI API
- Validation to ensure 15 flashcards are returned with the required difficulty distribution
- Simple Prev/Next navigation and keyboard support
Assignment/ # repo root (this README)
├─ backend/ # Express server + OpenAI logic
├─ frontend/ # React app (Create React App)
├─ Public/ # screenshots and images used in README / UI
└─ README.md
These are live screenshots of the running frontend application, stored in the Public folder.
- Node.js v18+ (or compatible LTS)
- npm (comes with Node)
- An OpenAI API key (or other LLM key if you modify the backend)
- Git + GitHub account (SSH key already created in your environment)
Follow these commands inside the project root. These commands assume the backend folder is backend/.
- Open a terminal and go to the backend folder:
cd /Users/t/Desktop/Tanush/Assignment/backend- Install dependencies:
npm install express cors dotenv openai
npm install --save-dev nodemon- Create a
.envfile in thebackendfolder and add the following (use your real OpenAI key):
PORT=3001
OPENAI_API_KEY=your_openai_api_key_here
ALLOWED_ORIGIN=http://localhost:3000
- Ensure
package.jsonscripts contain:
"scripts": {
"start": "node server.js",
"dev": "nodemon server.js"
}- If your
server.jsusesimportsyntax, set the package type to module (run once):
npm pkg set type=module- Start the backend (development mode):
npm run devResult: your terminal should show Backend listening on port 3001.
Follow these commands inside the project root. This example uses Create React App.
- Open a new terminal and go to the frontend folder:
cd /Users/t/Desktop/Tanush/Assignment/frontend- Install dependencies and axios if needed:
npm install
npm install axios- (Optional) To avoid CORS and use relative URLs in the app, add a proxy to
frontend/package.json:
"proxy": "http://localhost:3001"- Start the frontend:
npm startResult: the app opens at http://localhost:3000.
You can test the backend directly with curl (no frontend running required):
curl -X POST http://localhost:3001/generate-flashcards \
-H "Content-Type: application/json" \
-d '{"topic":"Photosynthesis"}'Expected response: a JSON array of 15 objects:
[
{ "question": "...", "answer": "...", "difficulty": "easy" },
...14 more cards
]- Frontend sends
POST /generate-flashcardswith{ "topic": "..." }. - Backend builds a precise prompt and calls the OpenAI API.
- Backend parses and validates the model response (exactly 15 cards, difficulty distribution 5/5/5).
- Backend returns the array to frontend.
- Frontend shows one flashcard at a time with Prev/Next and keyboard navigation.
If you accidentally uploaded your entire Desktop or other folders, fix it locally and push only the Assignment/ repo.
Run these commands from inside /Users/t/Desktop/Tanush/Assignment (single-line commands):
# set the git remote to your repo and push current branch
git remote set-url origin git@github.com:Tanushh18/Assignment.git && git add . && git commit -m "final: assignment upload" && git push origin mainIf you need to remove files that were accidentally committed (like your whole Desktop), see these steps (careful: destructive):
# remove large or unwanted files from git history (use only if you understand implications)
git rm -r --cached path/to/unwanted_folder_or_file
git commit -m "remove unwanted files"
git push origin mainPut the images inside the repo at:
/Users/t/Desktop/Tanush/Assignment/Public/
Then reference them in the README as Public/<filename.png> — this README already uses that path.
- Start backend:
cd backend && npm run dev→ seeBackend listening on port 3001. - Start frontend:
cd frontend && npm start→ app athttp://localhost:3000. - Enter a topic (e.g., "Photosynthesis") and press Generate.
- Use Prev/Next buttons or ← → keys to navigate cards.
- CORS errors: either set
ALLOWED_ORIGIN=http://localhost:3000in backend.envor use the CRA proxy. - Import syntax errors: run
npm pkg set type=modulein backend if you're usingimport. - OpenAI errors: ensure
OPENAI_API_KEYis valid and has quota.
- OpenAI for LLM generation
- React & Express examples adapted for quick assignment submission
This README is intentionally visual and designer-friendly: images are included and the run steps are presented as short, clear commands. If you want I can produce a compact single-page PDF or a short demo script you can send along with your submission.




