A full-stack web application built with Next.js for reserving timeslots. Features Google OAuth authentication, role-based access control, and a comprehensive admin dashboard.
Language: Arabic (RTL support) | Timezone: Asia/Riyadh
Screenshots gallery — UI preview (Arabic RTL).
- Google OAuth Authentication - Secure sign-in with Google accounts
- User Registration - Register with name, email, phone number, and gender
- Browse Reservations - View available time slots on a calendar interface
- Make Reservations - Select date and time
- User Dashboard - View and manage personal reservations
- Reservation Management - View, approve, or reject reservation requests
- Calendar View - Visual overview of all reservations
- User Management - View all registered users and their details
- Block Dates/Times - Mark specific dates or time periods as unavailable
- Configure Settings - Set operation hours, max reservations per user, advance booking days
- RTL Support - Full Arabic language interface
- Responsive Design - Mobile-friendly with adaptive layouts
- Role-Based Access Control - Separate user and admin permissions
| Technology | Purpose |
|---|---|
| Next.js | React framework with App Router |
| React | UI library |
| TypeScript | Type-safe JavaScript |
| TailwindCSS | Utility-first CSS |
| Ant Design | UI component library |
| Day.js | Date manipulation |
| Technology | Purpose |
|---|---|
| Next.js | Server-side rendering & API routes |
| Auth.js | Authentication (Google OAuth) |
| Zod | Schema validation |
| Technology | Purpose |
|---|---|
| MongoDB | NoSQL database |
| Mongoose | MongoDB ODM |
Before you begin, ensure you have met the following requirements:
- Node.js v18 or higher
- Git for version control
- MongoDB 6.x (local installation or MongoDB Atlas)
- Google Cloud Console project with OAuth 2.0 credentials
- Go to Google Cloud Console
- Create a new project or select an existing one
- Navigate to APIs & Services > Credentials
- Click Create Credentials > OAuth 2.0 Client ID
- Configure the consent screen if prompted
- Set application type to Web application
- Add authorized redirect URI:
http://localhost:3000/api/auth/callback/google - Copy the Client ID and Client Secret
Follow these steps to set up the project on your local machine.
First, clone the repository from GitHub to your local machine using git:
git clone <repository-url>
cd reservation_webappInstall the dependencies required for the project:
npm i
Create an .env file to store the following variables:
# MongoDB Connection
MONGODB_URI="mongodb://127.0.0.1:27017/MONGODB_DATABASE_NAME" # MONGODB_DATABASE_NAME is your Mongodb database name.
AUTH_SECRET='YOUR_RANDOM_SECRET' # Added by `npx auth`. Read more: https://cli.authjs.dev The Secret should be HARD to guess.
# Google OAuth Credentials
AUTH_GOOGLE_ID='GOOGLE_OAUTH_CLIENT_ID' # This is an OAuth 2.0 client id you get from Google. Read more: https://developers.google.com/identity/protocols/oauth2
AUTH_GOOGLE_SECRET='GOOGLE_OAUTH_CLIENT_SECRET' # This is an OAuth 2.0 client secret you get from Google. Read more: https://developers.google.com/identity/protocols/oauth2
# Auth.js Configuration
AUTH_TRUST_HOST=true
AUTHJS_SECRET_1='ANOTHER_RANDOM_SECRET_STRING' # This is a random string (i.e., secret) used to hash tokens, sign cookies and generate cryptographic keys. Read more: https://authjs.dev/reference/core#secret
AUTH_URL="http://localhost:3000"
To run the development server:
npm run devOpen http://localhost:3000 with your browser.
- Register: Click "Register" and sign in with Google. Complete the registration form with your details.
- Browse: Navigate to the reservation page to view available time slots.
- Book: Select a date and time slot, provide a reason, and submit your reservation request.
- Wait for Approval: Admin will review and approve/reject your request.
- Access Admin Panel: Navigate to http://localhost:3000/admin
- View Reservations: Use the calendar to see all reservations by date
- Manage Requests: Review pending reservation requests
- Block Dates: Mark specific dates or times as unavailable
- Configure Settings: Set operation hours and booking limits
To grant admin privileges to a user:
- Open your MongoDB client (MongoDB Compass or
mongosh) - Connect to your database
- Find the user document in the
userscollection - Update the
rolefield from"user"to"admin":
src/
├── app/ # Next.js App Router
│ ├── (admin)/admin/ # Admin dashboard pages
│ ├── (main)/ # Public pages (home, reservation)
│ ├── (user)/ # User dashboard
│ ├── (login)/ # Login page
│ ├── (signup)/ # Registration page
│ └── api/ # API routes
├── components/ # React components
│ ├── header/ # Navigation components
│ └── ui/ # Page-specific components
├── lib/ # Business logic
│ ├── _data_access/ # Database queries
│ ├── actions/ # Server actions
│ ├── database_models/ # Mongoose schemas
│ └── schemas/ # Zod validation
├── auth.ts # Auth.js configuration
├── auth.config.ts # Auth providers
└── middleware.ts # Route protection
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
For production deployment, see the Next.js deployment documentation.
Important: Before deploying to production:
- Set
trustHost: trueanduseSecureCookies: trueinsrc/auth.config.ts - Use strong, unique values for
AUTH_SECRETandAUTHJS_SECRET_1 - Update
AUTH_URLto your production domain
- kbits000 - Project development and code implementation.
