Skip to content

Latest commit

ย 

History

History
157 lines (108 loc) ยท 4.77 KB

File metadata and controls

157 lines (108 loc) ยท 4.77 KB

๐Ÿ“˜ Learn Trip Planner

Welcome to the Trip Planner codebase learning guide! This document helps you understand the structure, key components, and technologies used in this AI-powered MERN travel planning application.


๐Ÿง  What Youโ€™ll Learn

  • How a full-stack MERN application is structured
  • How to integrate AI chatbot features
  • Firebase authentication implementation
  • Building multilingual, responsive React apps with TypeScript
  • Working with REST APIs and MongoDB in Node.js
  • Managing routes, states, and reusable components
  • Admin dashboard and role-based access
  • Real-world full-stack project deployment practices

๐Ÿ—‚๏ธ Project Overview


react\_app/
โ”œโ”€โ”€ client/         # Frontend - React + Vite + TypeScript
โ”œโ”€โ”€ server/         # Backend - Node.js + Express + MongoDB
โ”œโ”€โ”€ README.md       # Main documentation
โ”œโ”€โ”€ Contributing.md # Contribution guidelines
โ”œโ”€โ”€ vite.config.ts  # Vite config
โ””โ”€โ”€ tsconfig.\*.json # TypeScript configurations


๐Ÿงฉ Core Concepts Explained

๐Ÿ”น Frontend (client/)

File/Folder Purpose
src/App.tsx Root component for routing & layout
components/ Reusable UI elements like navbar, chatbot, footer
pages/ Page-specific views like home, Places, Admin
utils/ Utility functions (e.g. toasts, error handling)
i18n.js Multi-language setup using react-i18next
assets/images/ Site visuals used in pages and UI
responsive.css Custom CSS for mobile responsiveness

Tip: Learn how routing and lazy loading is done in App.tsx.


๐Ÿ”น Backend (server/)

File Purpose
server.js Main Express server with MongoDB connection
routes/ (If added) Contains API route files (e.g. /places, /users)
controllers/ (Optional) Logic separated from routes for clean code
models/ Mongoose schemas (e.g. Place, Booking, User)

Make sure you understand how MongoDB connection is initialized in server.js.


๐Ÿ”น Authentication

  • Uses Firebase Authentication for:
    • Sign up / Sign in with email
    • Secure session management
  • Firebase config is added in frontend, and optionally used on backend if needed.

๐Ÿ”น AI Chatbot Integration

  • The chatbot component (chatbot.tsx) sends user queries to an API endpoint.
  • You can connect it with OpenAI, LangChain, or a custom model.
  • Check how messages are managed and styled in Message.tsx.

๐ŸŒ i18n - Multilingual Support

  • Implemented via react-i18next
  • English, Hindi, and French are supported
  • Strings are defined in locale files and translated using t('key')

๐Ÿงช Testing the App

# Frontend
cd client
npm install
npm run dev

# Backend (in a separate terminal)
cd server
npm install
npm start
  • App runs on: http://localhost:5173
  • API runs on: http://localhost:5000

Ensure your MongoDB and Firebase setup is ready before launching.


๐Ÿ“Œ Contribution-Friendly Areas

Want to learn by building? Here are beginner-friendly parts:

Feature Skills Involved
Add more chatbot prompts JS, API calls
Add new destination cards React, design
Add language to i18n JSON, react-i18next
Improve responsive layout CSS/Bootstrap
Add toast on booking toastUtils.ts

๐Ÿ”ฎ Suggested Extensions

You can try adding:

  • โฐ Trip Countdown widget
  • ๐Ÿ“ฑ Convert web app to PWA
  • ๐Ÿ’ฌ WebSocket-based real-time chat
  • ๐Ÿ“ท Gallery page with image upload
  • ๐Ÿงพ PDF itinerary export

๐Ÿ“š Recommended Learning Paths

Topic Resource
React + TypeScript react-typescript-cheatsheet
Firebase Auth Firebase Docs
MERN Basics freeCodeCamp MERN Guide
i18n in React react-i18next Docs
MongoDB Mongoose Mongoose Quick Start

๐Ÿ™Œ Final Note

Whether you're here to learn web dev, contribute to open source, or build your portfolio, Trip Planner is a great playground. Make sure to read Contributing.md before submitting PRs.

Happy coding! ๐Ÿ’ป๐ŸŒ