A sustainable travel planning application that helps users calculate and reduce their carbon footprint while traveling.
The project is split into two main parts:
client- Frontend React applicationserver- Backend API (coming soon)
To start the frontend development server:
- Navigate to the client directory:
cd client
- Install dependencies (if you haven't already):
npm install
- Start the development server:
npm start
The app will open in your browser at http://localhost:3000.
Browse and book eco-friendly travel options including:
- Transportation (trains, electric vehicles, etc.)
- Accommodations (eco-certified hotels)
- Activities (sustainable tours and experiences)
Each booking earns EcoCoins based on how eco-friendly your choices are!
Calculate the carbon footprint of your travel plans and get recommendations for reducing emissions.
- View your EcoCoin balance and transaction history
- Earn coins for eco-friendly bookings
- Track your rewards and eco-impact
Use your earned EcoCoins to contribute to environmental causes:
- Tree planting initiatives
- Ocean cleanup projects
- Wildlife conservation
- Renewable energy development
- View your eco-impact metrics
- Check your Eco Rating based on your sustainable choices
- Track your achievements and eco-contributions
-
User Registration/Login
- Register a new account to access personalized features
- Login with your credentials
-
Plan a Trip
- Go to "Compare & Book" to select transportation, accommodation, and activities
- Notice how each option has an eco-rating and carbon footprint information
- Complete a booking to earn EcoCoins
-
Check Your Wallet
- Visit the EcoCoin Wallet to see your balance and transaction history
- Review how many EcoCoins you've earned from your bookings
-
Make a Contribution
- Go to the Contribute section
- Select an environmental cause
- Contribute some of your EcoCoins to support the cause
- Watch your Eco Rating increase
-
View Your Profile
- Visit your Profile and Eco Impact Dashboard
- See your carbon savings, achievements, and eco-rating
The profile section can be accessed in two ways:
- From the top navigation bar - Click on "Profile" in the main menu
- From the profile dropdown in the upper right corner
- Carbon Calculator: Estimate emissions for flights, hotels, and transportation
- Green Certification Database: Rates hotels/transport providers using sustainability metrics
- Rewards System: Offers discounts for eco-conscious choices
- Community Reviews: User-generated tips for sustainable travel
- Node.js (v14 or higher)
- npm (v6 or higher)
- MongoDB (v4 or higher)
- Install server dependencies:
cd eco-travel-planner/server
npm install
- Create a
.envfile in the server directory with the following variables:
PORT=5000
MONGO_URI=mongodb://localhost:27017/eco-travel-planner
JWT_SECRET=your_jwt_secret_key
NODE_ENV=development
- Start the server:
npm run dev
- Install client dependencies:
cd eco-travel-planner/client
npm install
npm install react react-dom react-scripts
npm install -D tailwindcss postcss autoprefixer
- Initialize Tailwind CSS:
npx tailwindcss init -p
- Start the client:
npm start
- Register an account or log in
- Use the Carbon Calculator to estimate the emissions of your trip
- Browse the Green Certification Database to find eco-friendly accommodations and transportation
- Earn rewards for making eco-conscious choices
- Read and contribute to community reviews
eco-travel-planner/
βββ client/ # React frontend
β βββ public/ # Static files
β βββ src/ # React components and logic
β βββ components/ # Reusable UI components
β βββ pages/ # Main application pages
β βββ context/ # Global state management
βββ server/ # Express backend
β βββ config/ # Configuration files
β βββ controllers/ # Request handlers
β βββ models/ # MongoDB models
β βββ routes/ # API routes
βββ README.md # Project documentation
- Frontend: React, Tailwind CSS, Chart.js, Leaflet
- Backend: Node.js, Express
- Database: MongoDB
- Authentication: JWT
The Carbon Footprint Calculator component requires a connection to the emissions calculation API. Follow these steps to configure the API connection:
-
Create a
.envfile in the client directory with the following variables:# Carbon Calculator API Configuration REACT_APP_API_URL=http://your-api-url.com REACT_APP_API_KEY=YOUR_API_KEY_HERE # Connection settings REACT_APP_API_TIMEOUT=8000 REACT_APP_API_RETRY_INTERVAL=60000 -
Replace
http://your-api-url.comwith your actual API endpoint URL -
Replace
YOUR_API_KEY_HEREwith your valid API key if authentication is required -
Adjust the timeout and retry interval as needed
If you encounter issues with the API connection:
- API URL Issue: Verify the API URL is correct in your
.envfile - Authentication: Check that your API key is valid and properly formatted
- CORS Issues: If you encounter CORS errors, ensure the API server allows requests from your application domain
- Firewall/Network: Check if there are any network restrictions blocking the API connection
- API Server Status: Verify the API server is running and accessible
The application will automatically fall back to local calculation mode if the API cannot be reached. To force local calculation mode for testing, you can set the API URL to an invalid endpoint in your .env file.