A secure, role-based car booking platform designed specifically for women's safety and comfort. Built with Next.js 15, Supabase, and TypeScript.
- 🔐 Secure Authentication - Email/password authentication with Supabase
- 👥 Role-Based Access Control - Three user roles: Passenger, Driver, and Admin
- ⏰ 24-Hour Sessions - Automatic session management with secure expiration
- 🛡️ Admin Verification - Special codes required for admin account creation
- 📱 Responsive Design - Beautiful UI that works on all devices
- 🚀 Modern Stack - Next.js 15, TypeScript, Tailwind CSS, Supabase
- Node.js 18+ installed
- A Supabase account and project
- npm or yarn package manager
-
Clone the repository
git clone <repository-url> cd bookingapp
-
Install dependencies
npm install
-
Set up environment variables
Copy
.env.exampleto.env.local:cp .env.example .env.local
Update
.env.localwith your Supabase credentials:NEXT_PUBLIC_SUPABASE_URL=your-project-url NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
-
Run the development server
npm run dev
-
Open your browser
Navigate to http://localhost:3000
- Book rides with verified drivers
- View ride history
- Manage profile settings
- Access:
/passengers
- Accept ride requests
- Track earnings
- Manage documents
- Access:
/driver
- Manage users and drivers
- View platform analytics
- Generate admin codes
- Review support tickets
- Access:
/admin
-
Use one of the seeded admin codes:
ADMIN-2024-INITADMIN-2024-SETUPADMIN-2024-DEMO
-
Go to
/signup -
Select "Admin" role
-
Enter the admin code
-
Complete signup
See Admin Code Management for details.
bookingapp/
├── app/ # Next.js app directory
│ ├── (auth)/ # Authentication routes
│ │ ├── login/ # Login page
│ │ └── signup/ # Signup page
│ ├── passengers/ # Passenger dashboard
│ ├── driver/ # Driver dashboard
│ ├── admin/ # Admin dashboard
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Landing page
│ └── error.tsx # Error page
├── components/ # Reusable components
│ ├── navbar.tsx # Navigation bar
│ ├── toast.tsx # Toast notifications
│ └── loading-spinner.tsx # Loading indicator
├── lib/ # Utility libraries
│ └── supabase/ # Supabase clients
│ ├── client.ts # Browser client
│ ├── server.ts # Server client
│ ├── middleware.ts # Session middleware
│ └── session-utils.ts # Session utilities
├── docs/ # Documentation
│ ├── SESSION_MANAGEMENT.md
│ └── ADMIN_CODE_MANAGEMENT.md
├── proxy.ts # Next.js proxy (middleware)
└── .env.local # Environment variables
Stores user role assignments.
| Column | Type | Description |
|---|---|---|
| id | UUID | Primary key |
| user_id | UUID | Foreign key to auth.users |
| role | ENUM | passenger, driver, or admin |
| created_at | TIMESTAMP | Account creation time |
| updated_at | TIMESTAMP | Last update time |
Stores admin verification codes.
| Column | Type | Description |
|---|---|---|
| id | UUID | Primary key |
| code | TEXT | Unique admin code |
| is_active | BOOLEAN | Whether code is active |
| used_by | UUID | User who used the code |
| used_at | TIMESTAMP | When code was used |
| created_at | TIMESTAMP | Code creation time |
User → Signup Form → Select Role → (Admin: Enter Code) →
Create Account → Assign Role → Redirect to Dashboard
User → Login Form → Validate Credentials →
Fetch Role → Redirect to Role-Specific Dashboard
Request → Proxy Middleware → Validate Session →
Refresh Tokens → Update Cookies → Allow/Redirect
- ✅ Row Level Security (RLS) on all tables
- ✅ Server-side authentication validation
- ✅ 24-hour session expiration
- ✅ Secure cookie configuration
- ✅ Admin code verification
- ✅ PKCE flow for token exchange
- ✅ Automatic token refresh
npm testnpm run build
npm startnpm run lint| Variable | Description | Required |
|---|---|---|
NEXT_PUBLIC_SUPABASE_URL |
Supabase project URL | Yes |
NEXT_PUBLIC_SUPABASE_ANON_KEY |
Supabase anonymous key | Yes |
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY |
Supabase publishable key | Yes |
- Push your code to GitHub
- Import project in Vercel
- Add environment variables
- Deploy
The app can be deployed to any platform that supports Next.js:
- Netlify
- AWS Amplify
- Railway
- Render
- Session Management - How sessions work
- Admin Code Management - Managing admin codes
- Verify the code exists in the database
- Check if the code is active
- Ensure the code hasn't been used
- Check cookie settings in browser
- Verify HTTPS in production
- Review Supabase project settings
- Ensure you're logged in
- Check your user role in the database
- Clear cookies and log in again
- Framework: Next.js 15 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- Authentication: Supabase Auth
- Database: PostgreSQL (via Supabase)
- Deployment: Vercel-ready
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
[Your License Here]
For issues and questions:
- Open an issue on GitHub
- Contact: [your-email@example.com]
- Built with Next.js
- Powered by Supabase
- Styled with Tailwind CSS