A modern, full-stack car rental platform built with Next.js, TypeScript, MongoDB, and Tailwind CSS.
- Browse available cars with advanced filtering
- Filter by brand, fuel type, date range, and price
- Book cars for specific date ranges
- View booking history and status
- Real-time availability checking
- Manage car inventory (CRUD operations)
- Upload car images to Vercel Blob Storage
- Approve or reject booking requests
- View analytics and statistics
- Mark bookings as completed
- Secure user registration and login
- Role-based access control (User/Admin)
- Protected routes and API endpoints
- Framework: Next.js 15 with App Router
- Language: TypeScript
- Styling: Tailwind CSS
- Authentication: NextAuth.js
- Database: MongoDB with Mongoose
- File Storage: Vercel Blob Storage
- Icons: Lucide React
- Date Handling: date-fns
- Node.js 18+ installed
- MongoDB database (local or MongoDB Atlas)
- Vercel account (for blob storage)
- Clone the repository:
git clone <repository-url>
cd smart-wheels- Install dependencies:
npm install- Set up environment variables:
Create a .env file in the root directory:
# MongoDB Connection
MONGODB_URI=mongodb://localhost:27017/smart-wheels
# or use MongoDB Atlas:
# MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/smart-wheels
# NextAuth Configuration
NEXTAUTH_SECRET=your-secret-key-here-generate-with-openssl-rand-base64-32
NEXTAUTH_URL=http://localhost:3000
# Vercel Blob Storage
BLOB_READ_WRITE_TOKEN=your-vercel-blob-token-hereTo generate a secure NEXTAUTH_SECRET:
openssl rand -base64 32- Run the development server:
npm run dev- Open http://localhost:3000 in your browser
- Register a new account through the UI
- Open MongoDB and find your user in the
userscollection - Change the
rolefield from"user"to"admin" - Log out and log back in to access the admin dashboard
smart-wheels/
├── app/
│ ├── admin/ # Admin dashboard pages
│ │ ├── cars/ # Car management
│ │ ├── bookings/ # Booking management
│ │ └── layout.tsx # Admin layout with sidebar
│ ├── api/ # API routes
│ │ ├── auth/ # Authentication endpoints
│ │ ├── cars/ # Car CRUD operations
│ │ ├── bookings/ # Booking operations
│ │ └── upload/ # Image upload
│ ├── book/ # Car booking pages
│ ├── bookings/ # User bookings page
│ ├── login/ # Login page
│ ├── register/ # Registration page
│ └── page.tsx # Home page (car listing)
├── components/
│ ├── ui/ # Reusable UI components
│ │ ├── Button.tsx
│ │ ├── Card.tsx
│ │ └── Input.tsx
│ ├── Navbar.tsx # Navigation bar
│ └── SessionProvider.tsx
├── lib/
│ └── mongodb.ts # MongoDB connection
├── models/ # Mongoose models
│ ├── User.ts
│ ├── Car.ts
│ └── Booking.ts
└── ...
- Browse Cars: View all available cars with detailed information
- Filter & Search: Filter by brand, fuel type, and availability
- Book Cars: Select dates and distance, get instant cost calculation
- Track Bookings: View all your bookings and their status
- Dashboard: View key metrics and statistics
- Car Management: Add, edit, delete cars with image upload
- Booking Management: Approve/reject bookings, mark as completed
- Availability Control: Automatic availability management based on bookings
- Push your code to GitHub
- Import your repository in Vercel
- Add environment variables in Vercel dashboard
- Deploy
- Create a free cluster at MongoDB Atlas
- Create a database user
- Whitelist your IP or allow access from anywhere (0.0.0.0/0)
- Get your connection string and update
MONGODB_URI
- Go to your Vercel project settings
- Navigate to Storage
- Create a new Blob store
- Copy the
BLOB_READ_WRITE_TOKENto your environment variables
npm run dev- Start development servernpm run build- Build for productionnpm start- Start production servernpm run lint- Run ESLint
SmartWheels follows a dark, modern, and minimalistic design inspired by Apple, Vercel, and Linear. Key design principles:
- Clean, uncluttered interfaces
- Dark theme with high contrast
- Smooth transitions and interactions
- Mobile-responsive design
- Intuitive navigation
MIT