A modern web application for train ticket booking and management built with Next.js 14, featuring real-time train schedules, user authentication, and booking management.
app/
├── (auth)/ # Authentication routes
│ ├── login/ # Login page and components
│ └── register/ # Registration page and components
├── (dashboard)/ # Protected dashboard routes
│ ├── trains/ # Train-related features
│ │ ├── train-search/ # Train search functionality
│ │ └── booking/ # Booking management
│ ├── user/ # User profile and settings
│ └── booking-page/ # Booking process pages
├── _components/ # Shared components
│ ├── Header/ # Header components
│ └── UI/ # Reusable UI components
├── api/ # API routes
│ └── trains/ # Train-related API endpoints
└── utils/ # Utility functions and helpers
- User Authentication: Secure login and registration system
- Train Search: Real-time train schedule search and filtering
- Booking System: Complete booking flow with payment integration
- User Dashboard: Manage bookings and profile settings
- Responsive Design: Mobile-friendly interface
-
Clone the repository
git clone [your-repo-url] cd nextthird
-
Install dependencies
npm install
-
Set up environment variables Create a
.env.local
file in the root directory:DATABASE_URL=your_mongodb_url NEXTAUTH_URL=http://localhost:3000 NEXTAUTH_SECRET=your_secret_key TRAIN_API_KEY=your_api_key
-
Start the development server
npm run dev
-
Access the application Open http://localhost:3000 in your browser
-
Authentication: Located in
app/(auth)/
- Login:
app/(auth)/login
- Registration:
app/(auth)/register
- Login:
-
Dashboard: Located in
app/(dashboard)/
- Train Search:
app/(dashboard)/trains/train-search
- User Profile:
app/(dashboard)/user
- Bookings:
app/(dashboard)/booking-page
- Train Search:
-
API Routes: Located in
app/api/
- Train endpoints:
app/api/trains/
- Train endpoints:
- Next.js 14
- React
- MongoDB
- NextAuth.js
- Tailwind CSS
- TypeScript
- Create a new branch for your feature
- Make your changes
- Submit a pull request
[Your License]
- Node.js 18.x or later
- Vercel account
- Production database credentials
- API keys for external services
Create a .env.production
file with the following variables:
DATABASE_URL=your_production_database_url
NEXTAUTH_URL=https://your-production-domain.com
NEXTAUTH_SECRET=your_production_nextauth_secret
TRAIN_API_KEY=your_production_train_api_key
NODE_ENV=production
-
Install Vercel CLI:
npm i -g vercel
-
Login to Vercel:
vercel login
-
Deploy to Vercel:
vercel --prod
-
Set up environment variables in Vercel dashboard:
- Go to your project settings
- Add all environment variables from
.env.production
-
Verify the deployment:
- Check the production URL
- Test all major features
- Verify authentication flow
-
Set up custom domain (optional):
- Add domain in Vercel dashboard
- Configure DNS settings
# Install dependencies
npm install
# Run development server
npm run dev
# Build for production
npm run build
# Start production server
npm start
- Keep all API keys and secrets secure
- Use HTTPS in production
- Regularly update dependencies
- Monitor for security vulnerabilities
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx
. The page auto-updates as you edit the file.
This project uses next/font
to automatically optimize and load Geist, a new font family for Vercel.
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.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.