A modern, full-featured railway payment and ticketing system built with Next.js 14, TypeScript, Tailwind CSS, and Web3 wallet integration.
- π Authentication (Login/Register)
- π« Ticket booking and management
- ποΈ Travel passes purchase
- π± QR code ticket generation and scanning
- π³ Multiple payment methods (Card, Crypto Wallet, Mobile)
- π Dashboard with travel overview
- π€ User profile management
- π Revenue analytics and reporting
- π Route management
- π° Fare configuration
- π₯ Staff management
- π Device management
- π Real-time statistics
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: ShadCN UI
- State Management: Zustand
- API Client: Axios
- Wallet Integration: RainbowKit + Wagmi
- QR Code: qrcode.react, html5-qrcode
- Blockchain: Sepolia Testnet
railpay/
βββ app/ # Next.js App Router pages
β βββ auth/ # Authentication pages
β β βββ login/
β β βββ register/
β βββ dashboard/ # User dashboard pages
β β βββ tickets/
β β βββ passes/
β β βββ profile/
β βββ admin/ # Admin pages
β β βββ routes/
β β βββ fares/
β β βββ revenue/
β β βββ staff/
β β βββ devices/
β βββ pay/ # Payment page
β βββ qr/ # QR code pages
β β βββ generate/
β β βββ scan/
β βββ layout.tsx # Root layout
β βββ page.tsx # Landing page
β βββ providers.tsx # Providers (RainbowKit, etc.)
β βββ globals.css # Global styles
βββ components/ # React components
β βββ ui/ # ShadCN UI components
β βββ Sidebar.tsx
β βββ NavBar.tsx
β βββ TicketCard.tsx
β βββ RouteSelector.tsx
β βββ PaymentModal.tsx
β βββ QRDisplay.tsx
β βββ QRScanner.tsx
βββ lib/ # Utility libraries
β βββ api.ts # API client setup
β βββ wallet.ts # Wallet utilities
β βββ store.ts # Zustand stores
β βββ utils.ts # Utility functions
βββ public/ # Static assets
βββ logos/
βββ icons/
- Node.js 18+ installed
- npm or yarn package manager
- WalletConnect Project ID (for RainbowKit - optional)
- Clone the repository (or navigate to the project directory)
cd "C:\Users\DELL\Desktop\NEW VERSION RAILPAY"- Install dependencies
npm install
# or
yarn install- Set up environment variables
Create a .env.local file in the root directory:
NEXT_PUBLIC_API_URL=http://localhost:3001/api
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_walletconnect_project_idNote: For WalletConnect (RainbowKit) to work properly, you'll need to:
- Sign up at WalletConnect Cloud
- Create a project and get your Project ID
- Add it to
.env.localas shown above
Alternatively, you can use the placeholder YOUR_PROJECT_ID in the code for development.
- Run the development server
npm run dev
# or
yarn dev- Open your browser
Navigate to http://localhost:3000
- Register/Login: Create an account or sign in
- Book Ticket: Go to
/payto search and book tickets - View Tickets: Check your tickets in
/dashboard/tickets - Generate QR: Create QR codes for your active tickets
- Scan QR: Use the scanner to verify tickets (admin feature)
- Login as Admin: Use an email containing "admin" to access admin features
- Manage Routes: Add, edit, or delete routes in
/admin/routes - Configure Fares: Set pricing in
/admin/fares - View Revenue: Check analytics in
/admin/revenue - Manage Staff: Add/remove staff members in
/admin/staff - Monitor Devices: Track connected devices in
/admin/devices
Currently, the app uses mock authentication:
- Any email and password will work for login/register
- Emails containing "admin" will be assigned admin role
- All other users get the user role
npm run build
npm start| Variable | Description | Required |
|---|---|---|
NEXT_PUBLIC_API_URL |
Backend API URL | No (defaults to localhost:3001) |
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID |
WalletConnect Project ID for RainbowKit | No (optional) |
- User registration and login
- Session management with Zustand
- Protected routes
- Route search and selection
- Ticket booking
- Ticket management (view, filter, search)
- QR code generation for tickets
- Multiple payment methods
- Crypto wallet integration (RainbowKit)
- Card payments
- Mobile payments
- Comprehensive dashboard with statistics
- Route CRUD operations
- Fare management
- Revenue analytics
- Staff management
- Device monitoring
Edit app/globals.css to customize the color scheme:
:root {
--primary: 221.2 83.2% 53.3%;
/* ... other colors */
}Update lib/api.ts to connect to your backend API:
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3001/api'- Ensure you have a valid WalletConnect Project ID
- Check that your wallet extension is installed and unlocked
- Verify you're on the Sepolia testnet
- Ensure camera permissions are granted
- Use HTTPS or localhost (HTTP doesn't support camera access)
- Check browser compatibility (Chrome, Firefox, Safari supported)
- Clear
.nextfolder:rm -rf .next - Reinstall dependencies:
rm -rf node_modules && npm install - Check Node.js version (requires 18+)
To connect this frontend to a backend:
- Update
lib/api.tswith your actual API endpoints - Implement real authentication tokens
- Replace mock data with API calls
- Set up WebSocket connections for real-time updates (optional)
This project is open source and available for use.
For issues or questions, please check the documentation or create an issue in the repository.
Built with β€οΈ using Next.js 14 and modern web technologies.