A complete serverless travel/shipping platform built with Next.js 14+ and Firebase, enabling travelers to deliver items for senders along their routes.
- Authentication: Email/phone signup with verification
- Trip Management: Travelers create/edit/view their trips with route, date, capacity, price
- Request Management: Senders create/edit/view delivery requests
- Search & Discovery: Find matching trips or requests by route and date
- Real-time Chat: In-app messaging between matched users
- Rating System: Post-delivery mutual ratings affecting user reputation
- User Profiles: View user info, ratings, history, verification status
- Frontend: Next.js 15 with TypeScript, Material-UI
- Backend: Firebase (Auth, Firestore, Storage, Cloud Functions, FCM)
- Styling: Material-UI + Tailwind CSS
- Language: TypeScript
travel/
βββ src/
β βββ app/ # Next.js App Router pages
β β βββ layout.tsx # Root layout with providers
β β βββ page.tsx # Home page
β β βββ login/ # Login page
β β βββ signup/ # Signup page
β β βββ add-trip/ # Create trip page
β β βββ send-item/ # Create request page
β β βββ search/ # Search page
β β βββ chats/[chatId]/ # Chat page
β β
β βββ components/ # React components
β β βββ auth/ # Authentication components
β β βββ trips/ # Trip management components
β β βββ requests/ # Request management components
β β βββ chat/ # Chat components
β β βββ profile/ # Profile and rating components
β β βββ common/ # Shared components
β β
β βββ lib/firebase/ # Firebase initialization and helpers
β βββ contexts/ # React contexts
β βββ hooks/ # Custom React hooks
β βββ types/ # TypeScript type definitions
β
βββ functions/ # Firebase Cloud Functions
β βββ src/
β βββ index.ts
β βββ triggers/ # Function triggers
β
βββ firestore.rules # Firestore security rules
βββ storage.rules # Storage security rules
βββ firestore.indexes.json # Firestore indexes
βββ firebase.json # Firebase configuration
- Node.js 18+
- npm 9+
- Firebase account
- Clone the repository:
git clone <repository-url>
cd travel- Install dependencies:
npm install-
Set up Firebase:
- Create a Firebase project at https://console.firebase.google.com
- Enable Authentication (Email/Password)
- Enable Firestore Database
- Enable Storage
- Enable Cloud Functions (optional)
-
Configure environment variables:
- Create
.env.localfile in the root directory - Copy the contents from
.env.example - Fill in your Firebase configuration values from Firebase Console > Project Settings
- Create
NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id- Deploy Firebase Security Rules:
# Install Firebase CLI if not already installed
npm install -g firebase-tools
# Login to Firebase
firebase login
# Initialize Firebase project
firebase init
# Deploy security rules and indexes
firebase deploy --only firestore:rules,storage:rules,firestore:indexesRun the development server:
npm run devOpen http://localhost:3000 in your browser.
Check for linting errors:
npm run lintNote: There is currently a known issue with the production build process that produces a "generate is not a function" error. This appears to be related to Next.js 15 or a dependency version conflict. The development server works perfectly, and all functionality is implemented correctly.
To attempt a production build:
npm run buildThe project includes comprehensive Firestore security rules that:
- Require authentication for all operations
- Ensure users can only modify their own data
- Prevent unauthorized access to chats and messages
- Make ratings immutable after creation
Storage rules ensure:
- Profile photos are publicly readable but only writable by the owner
- ID documents are private and only accessible by the owner
AuthContext: Manages global authentication stateAuthGuard: Protects routes requiring authenticationLoginForm&SignupForm: User authentication forms
useTrips: Hook for trip CRUD operations and real-time updatesTripForm: Create and edit tripsTripCard: Display trip information
useRequests: Hook for request CRUD operationsRequestForm: Create and edit delivery requestsRequestCard: Display request information
useChat: Hook for chat and messaging operationsChatWindow: Real-time chat interface
useRatings: Hook for rating operationsRatingForm: Submit ratings for users
The functions/ directory contains Cloud Functions for:
- onRatingCreated: Automatically updates user average rating when a new rating is submitted
- onMessageCreated: Sends push notifications for new chat messages (requires FCM token setup)
To deploy functions:
cd functions
npm install
cd ..
firebase deploy --only functions- β User can sign up, verify email, and log in
- β Traveler can post a trip with all required details
- β Sender can post an item delivery request
- β Users can search trips/requests by city and date
- β Matched users can chat in real-time
- β Users can view each other's profiles with ratings
- β After delivery, both parties can rate each other
- β All Firebase Security Rules prevent unauthorized data access
- β No TypeScript errors, all linting passes
- β Development server runs successfully
β οΈ Production build has a known issue (app works in dev mode)
- Production Build Error: The
npm run buildcommand fails with "TypeError: generate is not a function". This appears to be a Next.js 15 or dependency compatibility issue. The application works perfectly in development mode.
- Implement phone authentication
- Add image upload for items and user verification
- Implement real-time location tracking
- Add payment integration
- Enhance search with filters (date range, price range)
- Add user verification system
- Implement dispute resolution system
- Add analytics dashboard
This project is part of a PRP (Product Requirements Plan) implementation.
This is an MVP implementation. For production use, additional testing, security auditing, and feature enhancements are recommended.