Welcome to my repository of solved lessons from the Winternship 2025 Case Studies.
This repo showcases my progress in mastering modern web development concepts through practical, hands-on challenges across TypeScript, React (Vite), MongoDB, and now Express.
The Winternship 2025 program provides structured case studies across:
- TypeScript → mastering language fundamentals, advanced types, generics, and design patterns
- React (Vite) → building interactive UIs with hooks, state management, and component-driven architecture
- MongoDB → designing aggregation pipelines for analytics and data transformation, CRUD operations, and ACID-compliant transactions
- Express → backend routing, middleware, and REST APIs
Each case study bridges theory and practice with real-world coding exercises.
-
CaseStudy1 (TypeScript)
- Functions (optional, default, rest parameters, callbacks, recursion, overloads)
- Advanced Types (union, utility, mapped types)
- Generics (generic classes and functions)
- Design Patterns (Observer, Strategy)
- Classes & Access Modifiers (inheritance, private/protected members)
-
react/
-
Vite-based React app (
my-react-app)- Component-driven solutions with hooks
- State management patterns
- Code-splitting and optimization
- 🌐 Live Demo
-
Vite-based React app (
my-task-app)- Standalone mini-app built with React + TypeScript
- Interactive Task Manager (add, toggle, delete tasks with useReducer)
- 🌐 Live Demo
-
-
mongodb/
-
Case Study 1: MovieFlix Analytics (
solution.js)- Aggregation pipelines using
$match,$group,$project,$sort,$limit - Example queries: views, ratings, genres
- Runnable via
mongoshor Node.js driver
- Aggregation pipelines using
-
Case Study 2: FastBite CRUD Challenge (
menu-crud.js)- Demonstrates
insertOne,find,updateOne,deleteOne - Idempotent script using
upsertand$addToSetfor repeatable runs - Runnable via
mongoshor Node.js driver
- Demonstrates
-
Case Study 3: FinTrust Transactions & Refunds (
refund-transaction.js,seed-refund.js)- Implements multi-document ACID transactions in MongoDB
- Secure money transfers with replica set enabled
- Refund workflow: balance adjustments, transaction status updates, and audit trail logging
- Prints balances before and after refund for verification
- Demonstrates rollback prevention and double-refund safeguards
-
-
express/
- Lesson 1: Getting Started (
app.js)- Basic Express server setup with
npm initandnpm install express - Routes:
/(homepage),/events(list of activities),/contact(JSON with email + phone) - Demonstrates
res.send()vsres.json()responses - Runnable via
node app.js
- Basic Express server setup with
- Lesson 2: Modular routes (
app.js,routes/)- Split routes into
routes/events.js,routes/classes.js,routes/contact.js - Mounted routers in
app.jswithapp.use('/path', router) - Organized project for scalability and team collaboration
- Runnable via
node app.js
- Split routes into
- Lesson 3: PATCH endpoint + validation (
app.js,routes/products.js)- Implements
PATCH /products/:id/inStockto update only theinStockfield - Validates input: returns
400 Bad RequestifinStockis missing or not a boolean - Returns
404 Not Foundif product ID does not exist - Demonstrates partial updates, clear status codes, and modular routing
- Runnable via
node app.js
- Implements
- Lesson 4: POST /transfer endpoint (
app.js,routes/transfer.js)- Implements
POST /transferto move points between accounts - Uses fixed valid UUIDs for Alice and Bob to simplify testing
- Validates: both IDs must be valid UUIDs, points must be a positive integer
- Returns
404 Not Foundif sender/receiver not found,400 Bad Requestif invalid UUIDs or insufficient points - Responds with
200 OKand updated balances on success - Demonstrates transaction-like workflow, input validation, and structured error handling
- Runnable via
node app.js
- Implements
- Lesson 5: BakingController (
app.js,routes/baking.js)- Implements
POST /baking/startto begin baking an order - Implements
GET /baking/status/:idto check baking status by order ID - Uses in-memory array to track baking orders
- Validates: returns
400 Bad Requestif orderId or flavor missing,404 Not Foundif order not found - Responds with
201 Createdon start and200 OKon status retrieval - Demonstrates modular routing, workflow separation, and clear status codes
- Runnable via
node app.js
- Implements
- Lesson 6: Discharge workflow with insurance middleware (
app.js,routes/discharge.js)- Implements middleware chain for discharge: request log, doctor sign-off, pharmacy review, follow-up scheduling
- Adds
insuranceApprovalCheckmiddleware to enforcereq.body.insuranceApproved - Returns
403 Forbiddenwhen insurance approval is missing - Centralized error handler logs discharge steps for troubleshooting
- Runnable via
node app.js
- Lesson 7: Admissions validation for art applicants (
app.js,routes/applications.js)- Implements
POST /applicationsendpoint to submit applications - Validates basic fields: applicant name and email required
- Adds rule: if
applicantTypeis"art",portfolioLinkmust be a valid URL - Returns
400 Bad Requestwith message"A valid portfolio link is required for art applicants."if missing or invalid - Responds with
201 Createdand application payload on success - Demonstrates extending validation rules with clear, actionable feedback
- Runnable via
node app.js
- Implements
- Lesson 8: ReturnBook workflow with MVC (
app.js,models/Book.js,repositories/,services/BookService.js,controllers/BookController.js)- Implements MVC pattern with clear separation of concerns
- BookService enforces business rules for borrowing and returning books
- BookController exposes endpoints:
POST /books/:id/borrow→ borrow a bookPOST /books/:id/return→ return a book
- Repository updates book status (
isBorrowedflag) when returned - Demonstrates repository pattern and dependency injection for modular, testable code
- Runnable via
node app.js
- Lesson 9: Course deletion workflow (
app.js,models/Course.js,repositories/,services/CourseService.js,controllers/CourseController.js)- Implements
delete(courseId)method in repository to remove courses from storage - CourseService adds
deleteCoursemethod to enforce rules (course must exist before deletion) - CourseController exposes
DELETE /courses/:idendpoint for admins - Returns
200 OKwith success message or404 Not Foundif course does not exist - Demonstrates repository pattern, service layer enforcement, and controller routing for admin actions
- Runnable via
node app.js
- Implements
- Lesson 10: BillingService integration (
app.js,services/,controllers/AppointmentController.js,tests/AppointmentService.test.js)- Defines
BillingServiceinterface andStripeBillingServiceimplementation - AppointmentService injects both NotificationService and BillingService
bookAppointmentcharges patient and sends notification when booking- AppointmentController exposes
POST /appointments/bookendpoint - Unit test uses a mock billing service to verify charges are recorded
- Demonstrates dependency injection, modular service design, and testability in Express
- Runnable via
node app.js
- Defines
- Lesson 1: Getting Started (
Clone the repository and run any case study as described below.
Most lessons can be run directly by compiling the TypeScript file and executing the generated JavaScript:
cd Internship_caseStudies/CaseStudy1
tsc lesson-name.ts
node lesson-name.jsLesson 19 is a standalone TypeScript project and uses external dependencies.
cd Internship_caseStudies/CaseStudy1/nineteen
npm install
tsc
node dist/index.jsThis will install required dependencies (typedi, reflect-metadata), compile the project using the local tsconfig.json, and run the output from the dist directory.
cd Internship_caseStudies/react/my-react-app
npm install
npm run devThis will start the Vite dev server and open the app in your browser.
cd Internship_caseStudies/react/my-task-app
npm install
npm run devThis will start the Vite dev server and open the app in your browser.
You can then interact with the Task Manager mini-app: add tasks, toggle completion, and delete tasks.
cd Internship_caseStudies/mongodb
npm install
node solution.jscd Internship_caseStudies/mongodb
npm install
node menu-crud.jscd Internship_caseStudies/mongodb
npm install
node seed-refund.js # seed sample users + transaction
node refund-transaction.js # run refund workflowcd Internship_caseStudies/express/lesson1
npm install
node app.jsThen visit:
- http://localhost:3000/ → homepage
- http://localhost:3000/events → JSON list of events
- http://localhost:3000/contact → JSON with email + phone
cd Internship_caseStudies/express/lesson2
npm install
node app.jsThen visit:
- http://localhost:3000/events → JSON list of events
- http://localhost:3000/classes → JSON list of classes
- http://localhost:3000/contact → JSON with email + phone
cd Internship_caseStudies/express/lesson3
npm install
node app.jsThen test:
# Valid update
curl -X PATCH http://localhost:3000/products/1/inStock \
-H "Content-Type: application/json" \
-d '{"inStock": false}'
# Invalid update (missing or wrong type)
curl -X PATCH http://localhost:3000/products/1/inStock \
-H "Content-Type: application/json" \
-d '{}'
curl -X PATCH http://localhost:3000/products/1/inStock \
-H "Content-Type: application/json" \
-d '{"inStock": "yes"}'cd Internship_caseStudies/express/lesson4
npm install
node app.jsThen test:
# Valid transfer
curl -X POST http://localhost:3000/transfer \
-H "Content-Type: application/json" \
-d '{"fromCustomerId":"11111111-1111-4111-8111-111111111111","toCustomerId":"22222222-2222-4222-8222-222222222222","points":100}'
# Invalid UUIDs
curl -X POST http://localhost:3000/transfer \
-H "Content-Type: application/json" \
-d '{"fromCustomerId":"123","toCustomerId":"456","points":50}'
# Insufficient points
curl -X POST http://localhost:3000/transfer \
-H "Content-Type: application/json" \
-d '{"fromCustomerId":"22222222-2222-4222-8222-222222222222","toCustomerId":"11111111-1111-4111-8111-111111111111","points":9999}'cd Internship_caseStudies/express/lesson5
npm install
node app.jsThen test:
# Start baking an order
curl -X POST http://localhost:3000/baking/start \
-H "Content-Type: application/json" \
-d '{"orderId":"101","flavor":"chocolate"}'
# Check baking status
curl -X GET http://localhost:3000/baking/status/101cd Internship_caseStudies/express/lesson6
npm install
node app.jsThen test:
# Valid discharge request
curl -X POST http://localhost:3000/discharge \
-H "Content-Type: application/json" \
-d '{"patientName":"John Doe","doctorSigned":true,"pharmacyChecked":true,"followupScheduled":true,"insuranceApproved":true}'
# Missing insurance approval (should return 403)
curl -X POST http://localhost:3000/discharge \
-H "Content-Type: application/json" \
-d '{"patientName":"Jane Doe","doctorSigned":true,"pharmacyChecked":true,"followupScheduled":true}'cd Internship_caseStudies/express/lesson7
npm install
node app.jsThen test:
# Valid art applicant with portfolio link
curl -X POST http://localhost:3000/applications \
-H "Content-Type: application/json" \
-d '{"name":"Asha","email":"asha@example.com","applicantType":"art","portfolioLink":"https://asha-artfolio.com"}'
# Invalid: art applicant missing portfolioLink
curl -X POST http://localhost:3000/applications \
-H "Content-Type: application/json" \
-d '{"name":"Ravi","email":"ravi@example.com","applicantType":"art"}'
# Invalid: art applicant with malformed portfolioLink
curl -X POST http://localhost:3000/applications \
-H "Content-Type: application/json" \
-d '{"name":"Mira","email":"mira@example.com","applicantType":"art","portfolioLink":"not-a-url"}'
# Valid: non-art applicant (portfolio not required)
curl -X POST http://localhost:3000/applications \
-H "Content-Type: application/json" \
-d '{"name":"Karan","email":"karan@example.com","applicantType":"science"}'- ✅ Returns
201 Createdwith application payload if valid. - ❌ Returns
400 Bad Requestwith"A valid portfolio link is required for art applicants."if missing or invalid. - ✅ Non-art applicants pass without portfolioLink.
cd Internship_caseStudies/express/lesson8
npm install
node app.jsThen test:
# Borrow a book
curl -X POST http://localhost:3000/books/1/borrow
# Return a book
curl -X POST http://localhost:3000/books/1/return
# Error: return a book that isn’t borrowed
curl -X POST http://localhost:3000/books/2/return- ✅ Borrow → JSON with
isBorrowed: true - ✅ Return → JSON with
isBorrowed: false - ❌ Error if book not found or invalid state
cd Internship_caseStudies/express/lesson9
npm install
node app.jsThen test:
# Delete an existing course
curl -X DELETE http://localhost:3000/courses/101
# Try deleting a non-existent course
curl -X DELETE http://localhost:3000/courses/999- ✅ Returns
200 OKwith"Course deleted successfully"if found - ❌ Returns
404 Not Foundwith"Course not found"if missing
cd Internship_caseStudies/express/lesson10
npm install
node app.jsThen test:
# Book appointment with billing + notification
curl -X POST http://localhost:3000/appointments/book \
-H "Content-Type: application/json" \
-d '{"patient":"alice@example.com","time":"Monday 10am","amount":50}'Expected:
- ✅ Console logs: Stripe charge + SMS notification
- ✅ Response JSON:
{ "status": "confirmed", "patient": "alice@example.com", "time": "Monday 10am", "amount": 50 }
- TypeScript: Functions, Advanced Types, Generics, Design Patterns (Observer + Strategy), Classes & Access Modifiers
- React (Vite): Component-driven solutions, hooks, state management
- MongoDB Case Study 1: Aggregation pipeline (MovieFlix analytics)
- MongoDB Case Study 2: CRUD challenge (FastBite menu, idempotent script)
- MongoDB Case Study 3: Transactions & Refunds (FinTrust wallet, ACID compliance)
- Express Lesson 1: Basic routes and server setup
- Express Lesson 2: Modular routes with mounted routers
- Express Lesson 3: PATCH endpoint with boolean validation
- Express Lesson 4: POST /transfer endpoint with UUID validation and error handling
- Express Lesson 5: BakingController
- Express Lesson 6: Discharge workflow with insurance middleware
- Express Lesson 7: Admissions validation for art applicants
- Express Lesson 8: ReturnBook workflow with MVC pattern
- Express Lesson 9: Course deletion workflow
- Express Lesson 10: BillingService integration with AppointmentService
- Strong focus on clarity and modularity.
- Each solution includes conceptual explanation + runnable code.
- Demonstrates growth across frontend, backend, and database layers of the MERN stack.
- MongoDB scripts are idempotent and transaction-safe, ensuring repeatable outputs and ACID compliance.
- Express lessons show step-by-step backend development, from simple routes to modular structure and precise REST endpoints with validation and middleware.
This project is open-source under the MIT License.