LetsTravel is a full-stack travel web application built for my portfolio. It lets users explore tour packages, plan trips, book tours, complete a checkout flow, and generate tickets — all in one place. It also includes an admin dashboard to manage tours, bookings, and basic user activity insights.
This repo is organized into a production-friendly Flask structure (templates/, static/, wsgi.py), while keeping many legacy URLs working (older HTML pages that still reference paths like /css codes/... and /js code/...).
| Resource | Link |
|---|---|
| 🌐 Live Demo | Click here |
| 💻 GitHub Repository | Click here |
Google Drive template:
- Link only:
ADD_YOUR_GOOGLE_DRIVE_LINK_HERE
- Clickable thumbnail:
[](ADD_YOUR_GOOGLE_DRIVE_LINK_HERE)All screenshots are stored in docs/screenshots/.
- Key features
- Tech stack
- Project layout (high level)
- Prerequisites
- Environment variables
- Setup (Windows PowerShell)
- Setup (macoslinux)
- Admin setup & maintenance commands
- Main routes
- Smoke test (quick local verification)
- MongoDB Atlas setup (step-by-step)
- Production deployment
- Troubleshooting
- User auth: Register, login, logout.
- User dashboard: Browse featured tours and categories.
- Search & activity tracking:
- Page views are recorded server-side for logged-in users.
- Searches and bookings are stored under user activity documents.
- Booking + checkout: Create a booking and complete a payment-confirm flow.
- Tickets: View ticket HTML and generate a ticket PDF.
- Admin dashboard:
- Users / Tours / Bookings tabs
- Export users/bookings/tours to Excel
- Basic user activity table (page views/search counts)
- Legacy compatibility: Many old URLs are routed/served via a dedicated public blueprint.
- Backend: Python, Flask
- Frontend (UI): Server-rendered HTML using Flask/Jinja2 templates, CSS, JavaScript
- What does “templates (Jinja2)” mean? Jinja2 is Flask’s HTML template system. It lets the server fill values like the logged-in username and reuse common parts like the navbar. The browser still receives normal HTML/CSS/JS (it is not a separate React/Vue frontend).
- Database: MongoDB (via MongoEngine)
- Exports: Pandas + XlsxWriter
- PDF generation: ReportLab
- Production servers: Gunicorn (Linux/macOS) or Waitress (Windows)
- Optional tooling: Node.js scripts for Amadeus API testing (see
tools/node/)
app.py— local dev entrypoint (creates the Flask app).wsgi.py— production WSGI entrypoint (gunicorn wsgi:app,waitress-serve --call wsgi:app).backend/letstravel/— Flask app factory + blueprints.backend/letstravel/__init__.py—create_app()+ request activity tracking.backend/letstravel/routes/—auth.py,main.py,admin.py,public.py.
backend/models/— MongoEngine document models (User,Tour,Booking,UserActivity).templates/— Jinja2 templates (auth, dashboard, admin, payment, and many legacy HTML pages).static/— CSS/JS/images and legacy assets.manage.py— maintenance CLI commands (admin setup/reset, seeding, indexes).tools/— smoke test script and archived legacy scripts.
- Python 3.10+ recommended
- MongoDB running locally, or a hosted MongoDB URI
- (Optional) Node.js 18+ if you want to run the scripts in
tools/node/
This app reads configuration from environment variables.
Common variables:
SECRET_KEY— Flask secret key (required for production).FLASK_ENV— set todevelopmentfor dev settings; defaults to production-like settings.MONGODB_URI— recommended in production, e.g.mongodb://localhost:27017/letstravel_dbor Atlas connection string.MONGODB_DB— database name (default:letstravel_db).MONGODB_HOST— used only ifMONGODB_URIis not set.SESSION_DAYS— cookie session lifetime in days (default: 7).SESSION_COOKIE_SECURE—1for HTTPS-only cookies (default in prod),0for local dev.
Optional (Personalized Itineraries / AI):
COHERE_API_KEY— enables the itinerary generator.COHERE_API_URL— optional override (defaults to Cohere Chat v2).COHERE_MODEL— optional override.
Optional (Node tooling):
AMADEUS_CLIENT_IDAMADEUS_CLIENT_SECRET
You can put variables in a local .env file (it is ignored by git).
Quick .env example (local dev):
FLASK_ENV=development
SECRET_KEY=dev-only-change-me
MONGODB_URI=mongodb://localhost:27017/letstravel_db
MONGODB_DB=letstravel_db
SESSION_COOKIE_SECURE=0- Create and activate a virtual environment:
cd "C:\Users\HARSHAL BARHATE\OneDrive\Desktop\LetsTravel"
python -m venv .venv
.\.venv\Scripts\Activate.ps1- Install dependencies:
pip install -r requirements.txt- Ensure MongoDB is reachable.
- If MongoDB is local, the default config targets
mongodb://localhost:27017/letstravel_db. - Or set
MONGODB_URIto your hosted MongoDB connection string.
- Run the app:
python app.pyThen open:
http://127.0.0.1:5000/login
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python app.pyThe project includes a small CLI.
python manage.py setup-adminDefault credentials:
- Email:
admin@letstravel.com - Password:
admin123
python manage.py reset-admin-password --email admin@letstravel.com --password "YourNewPassword"python manage.py create-indexes
python manage.py seed-tours
python manage.py check-users
python manage.py summaryUser-facing:
/login— login page/register— registration page/dashboard— main user dashboard (requires login)/packages— packages page (requires login)
Admin:
/admin/dashboard— admin dashboard (admin only)/admin/export/users— export users to Excel/admin/export/bookings— export bookings to Excel/admin/export/tours— export tours to Excel
Legacy compatibility (examples):
/index.html(redirects appropriately)/css codes/<file>(alias tostatic/css)/js code/<file>(alias tostatic/js)/Theme.js(legacy theme toggler)
The legacy routes are handled by public blueprint in backend/letstravel/routes/public.py.
- Sessions: When users log in/out, the app updates fields on the
Userdocument:login_count,last_login,active_sessions,total_session_duration
- User activities: Stored in
user_activitycollection:- Page views (logged server-side for logged-in users)
- Searches and bookings (written by route handlers)
Note: This is “basic analytics” (counts and history). It is not full analytics like time-on-page, geo analytics, heatmaps, etc.
A small smoke test script exists at tools/smoke_flow.py.
Run it after the server-side code is importable and MongoDB is reachable:
python tools/smoke_flow.pyIt performs a lightweight flow check (login → dashboard → packages → checkout → payment confirm → ticket → ticket PDF) and also hits a few legacy URLs.
This app connects using:
MONGODB_URI(Atlas connection string)MONGODB_DB(database name used by the app; defaults toletstravel_db)
- Atlas → Database → Build a Database → choose the free tier (M0) for demo.
- Atlas → Security → Database Access → Add New Database User
- Authentication method: Password
- Role:
readWrite(for a demo app)
- Atlas → Security → Network Access
- For Render/hosts with changing IPs, the simplest demo setting is:
0.0.0.0/0 - For better security, restrict to your fixed IP if you have one.
- For Render/hosts with changing IPs, the simplest demo setting is:
- Atlas → Database → Connect → Drivers
- Copy the
mongodb+srv://...connection string
- Copy the
Example (format):
mongodb+srv://<USERNAME>:<PASSWORD>@<CLUSTER_HOST>/?retryWrites=true&w=majority
Locally, add these to .env (or export them in your shell):
MONGODB_URI=mongodb+srv://USERNAME:PASSWORD@CLUSTER_HOST/?retryWrites=true&w=majority
MONGODB_DB=letstravel_dbNotes:
- If your password contains special characters, URL-encode it.
- This repo includes
dnspythoninrequirements.txtwhich is required formongodb+srv://URIs.
python app.pyIf Atlas is configured correctly, the app should load and you can register/login.
This project includes a production WSGI entrypoint: wsgi.py.
-
Push this repo to GitHub.
-
Create a new Web Service on Render from your GitHub repo.
-
Set:
- Build Command:
pip install -r requirements.txt - Start Command:
gunicorn --bind 0.0.0.0:$PORT wsgi:app
- Add environment variables on Render (Dashboard → Environment):
SECRET_KEY(required; use a long random string)MONGODB_URI(your Atlas connection string)MONGODB_DB=letstravel_db(or your preferred DB name)FLASK_ENV=production
Note: localhost:27017 is only for local dev. In production you must use Atlas (or another hosted MongoDB).
gunicorn wsgi:apppip install waitress
waitress-serve --call wsgi:appRecommended production environment variables:
- Set a strong
SECRET_KEY - Set
MONGODB_URI - Keep
SESSION_COOKIE_SECURE=1when serving over HTTPS
The folder tools/node/ contains scripts to test external APIs.
Install Node dependencies:
npm installRun the Amadeus env var test:
node tools/node/test.jsRun the Amadeus flight search test:
node tools/node/amadeus.jsThese scripts require AMADEUS_CLIENT_ID and AMADEUS_CLIENT_SECRET in your .env.
- Do not use the default admin credentials in production.
- This project stores an
original_passwordfield for some users/admins (for demo/admin convenience). This is not secure for real production use.
- Atlas connection fails (timeout / not authorized):
- Verify Atlas Network Access allows your IP (or
0.0.0.0/0for demo). - Re-check username/password in the
MONGODB_URI.
- Verify Atlas Network Access allows your IP (or
- SRV / DNS errors with
mongodb+srv://: ensurednspythonis installed (it is included inrequirements.txt). - Login works but dashboard/admin looks stuck: hard refresh (
Ctrl+F5) to clear cached JS/CSS. - Mongo connection errors: verify MongoDB is running and
MONGODB_URIis correct. - Port conflicts: if port 5000 is already in use, set
FLASK_RUN_PORT(or change the run command) and try again.
Harshal Vasudev Barhate
GitHub: https://github.com/Harshal-Bsys27
LinkedIn: https://www.linkedin.com/in/harshalbarhate778945ag/
Email: harshalbarhate2028@gmail.com





