A modern full-stack car rental application built with React, TypeScript, and Node.js/Express. DriveNow connects customers with affordable car rental options, featuring a clean interface for browsing available vehicles and submitting rental enquiries.
- Modern UI: Built with React 19, TypeScript, and Tailwind CSS
- Component Library: Radix UI components for accessible, consistent design
- Routing: TanStack Router for type-safe navigation
- State Management: React Query for server state management
- Form Handling: React Hook Form with Zod validation
- Responsive Design: Mobile-first approach with Tailwind CSS
- Dark Mode Support: Built-in theme switching capability
- RESTful API: Express.js server with CORS support
- Database: SQLite for lightweight, file-based storage
- Car Management: CRUD operations for vehicle inventory
- Enquiry System: Customer rental request handling
- Email Ready: Nodemailer integration for notifications
- Environment Config: dotenv for secure configuration
- React 19 - Modern React with concurrent features
- TypeScript - Type-safe development
- Vite - Fast build tool and dev server
- TanStack Router - Type-safe routing
- TanStack React Query - Server state management
- Tailwind CSS 4 - Utility-first styling
- Radix UI - Accessible component primitives
- React Hook Form - Form state management
- Zod - Schema validation
- Framer Motion - Animations
- Lucide React - Icon library
- Express 5 - Web framework
- SQLite3 - Database engine
- CORS - Cross-origin resource sharing
- Nodemailer - Email sending
- dotenv - Environment variables
- Jest - Testing framework
- Biome - Linting and formatting
drivenow/
βββ frontend/ # React frontend application
β βββ src/
β β βββ components/ # Reusable UI components
β β βββ contexts/ # React contexts
β β βββ hooks/ # Custom React hooks
β β βββ lib/ # Utility functions
β β βββ pages/ # Page components
β β βββ router/ # Route configuration
β β βββ App.tsx # Main application component
β βββ public/ # Static assets
β βββ package.json # Frontend dependencies
βββ api/ # Node.js backend API
β βββ src/
β β βββ db/ # Database configuration and seeding
β β βββ routes/ # API route handlers
β β βββ server.js # Express server setup
β βββ tests/ # Backend test files
β βββ package.json # Backend dependencies
βββ README.md # This file
- Node.js (v18 or higher)
- npm or yarn package manager
-
Clone the repository
git clone https://github.com/raju6991/drivenow.git cd drivenow -
Install frontend dependencies
cd frontend npm install -
Install backend dependencies
cd ../api npm install -
Set up environment variables
# In the api directory, create a .env file cd api cp .env.example .env # Edit .env with your configuration
-
Initialize the database
# In the api directory npm run seed
-
Start the backend server
cd api npm run devThe API will run on
http://localhost:3000 -
Start the frontend development server
cd frontend npm run devThe frontend will run on
http://localhost:5173
-
Build the frontend
cd frontend npm run build -
Start the production backend
cd api npm start
cd frontend
npm run testcd api
npm testGET /api/cars- Retrieve all available carsGET /api/cars/:id- Retrieve specific car details
POST /api/enquiries- Submit a rental enquiry
{
"name": "John Doe",
"phone": "+1234567890",
"email": "john@example.com",
"rental_duration": "1 week",
"vehicle_interest": "Mitsubishi Lancer",
"message": "I'm interested in renting this car."
}The frontend uses a modern component library built with:
- Radix UI for accessible primitives
- Tailwind CSS for styling
- Lucide React for icons
- Framer Motion for smooth animations
Key pages include:
- Home - Landing page with hero section
- Cars Available - Browse rental vehicles
- About - Company information
- Contact - Contact form and details
Create a .env file in the api/ directory:
PORT=3000
NODE_ENV=development
# Email configuration (optional)
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your-email@gmail.com
EMAIL_PASS=your-app-passwordThe API is configured to accept requests from:
https://gccheapcarrental.com(production)http://localhost:5173(development)
- Build the application:
npm run build - Deploy the
dist/folder to your hosting provider - Configure environment variables for production
- Set up production environment variables
- Install dependencies:
npm install --production - Start the server:
npm start - Consider using a process manager like PM2
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the ISC License - see the package.json file for details.
For support and inquiries:
- Frontend Issues: Check the React console for errors
- Backend Issues: Check the server logs and API responses
- Database Issues: Ensure SQLite is properly initialized with
npm run seed
-
Code Quality: The project uses Biome for linting and formatting
# Frontend npm run lint # Backend npm run lint npm run format
-
Type Safety: TypeScript ensures type safety across the application
-
Testing: Jest is configured for unit and integration testing
-
Hot Reload: Vite provides fast development with HMR
DriveNow - Making car rental simple and affordable. πβ¨