This project is a web-based application designed to provide users with an intuitive and efficient way to search for transport connections. It supports both traditional text input and modern voice-activated search, enabling flexible and accessible interaction. The system integrates with external data providers to retrieve and present real-time information on available routes, schedules, and travel options.
- Voice Input: Search for routes using voice commands with Web Speech API
- Smart Route Search: Find direct and connecting routes between stops
- Favorite Routes: Save frequently used routes for quick access
- Search History: Track your previous searches
- User Authentication: Secure sign-up/sign-in with NextAuth.js
- Admin Dashboard: User management and system administration
- Framework: Next.js 16 with App Router
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: Radix UI
- Forms: React Hook Form + Zod validation
- Runtime: Node.js
- API: Next.js API Routes
- Authentication: NextAuth.js v4
- Password Hashing: bcrypt
- ORM: Prisma
- Database: PostgreSQL
- Models: User, Przystanek (Stop), Przewoznik (Carrier), Polaczenie (Connection), Trasa (Route), SearchHistory, FavoriteRoutes
Before you begin, ensure you have the following installed:
- Node.js (v20 or higher)
- npm/yarn/pnpm
- PostgreSQL database
- Git
git clone https://github.com/AnnPoberezhna/Travel-Assistant.git
cd Travel-Assistantnpm install
# or
yarn install
# or
pnpm installCreate a .env file in the root directory:
# Database
DATABASE_URL="postgresql://username:password@localhost:5432/travel_assistant"
# NextAuth
NEXTAUTH_URL="http://localhost:####"
NEXTAUTH_SECRET="your-secret-key-here"
# Generate with: openssl rand -base64 32Run Prisma migrations to set up your database schema:
npx prisma migrate devSeed the database (optional):
npx prisma db seedYou have 2 options to populate the database:
Import real transportation data from ZTM Warsaw open data:
npm run import:gtfsWhat you get:
- 500 real stops from Warsaw
- 1 real operator (ZTM Warszawa)
- 100 real bus/tram/metro lines
- 50 trips with actual schedules
- Free and updated daily
Data source: https://mkuran.pl/gtfs/warsaw.zip (94MB)
Note: Import takes ~3 minutes. The script automatically limits data to keep database manageable.
Important: When searching routes with GTFS or seed data, enable the "Ignore time" checkbox for best results, as imported schedules may be outdated.
If GTFS import fails or you want faster setup:
npm run import:gtfs:fallbackWhat you get:
- 19 stops (Wrocław, Kraków, Warszawa, Poznań, Gdańsk, Katowice, Opole)
- 7 operators (PKP InterCity, FlixBus, MPK, etc.)
- 12 connections with realistic schedules
- Instant import (~1 second)
Important: When searching routes with generated data, enable the "Ignore time" checkbox for best results, as schedules are sample data.
npm run dev
# or
yarn dev
# or
pnpm devOpen http://localhost in your browser.
├── app/
│ ├── (auth)/ # Authentication pages
│ │ ├── sign-in/
│ │ └── sign-up/
│ ├── (dashboard)/ # Protected dashboard pages
│ │ ├── admin/ # Admin panel
│ │ ├── favorites/ # Saved favorite routes
│ │ ├── history/ # Search history
│ │ └── search/ # Route search
│ ├── api/ # API routes
│ │ ├── auth/ # NextAuth endpoints
│ │ ├── routeSearch/ # Route search logic
│ │ ├── favoriteRoutes/ # Favorites management
│ │ └── searchHistory/ # History tracking
│ ├── components/ # Reusable components
│ │ ├── form/ # Form components
│ │ ├── ui/ # UI primitives
│ │ ├── Navbar.tsx
│ │ ├── VoiceInput.tsx
│ │ └── ...
│ └── lib/ # Utility functions
│ ├── auth.ts # Auth configuration
│ ├── db.ts # Prisma client
│ └── ...
├── prisma/
│ ├── schema.prisma # Database schema
│ ├── seed.js # Database seeding
│ └── migrations/ # Migration history
└── public/ # Static assets
- User: User accounts with authentication
- Przystanek: Transportation stops/stations
- Przewoznik: Transport carriers/operators
- Polaczenie: Connections/lines operated by carriers
- Trasa: Routes with stops and schedules
- SearchHistory: User search tracking
- FavoriteRoutes: Saved favorite routes
USER: Standard user with search and favoritesADMIN: Administrative access to manage users
The app uses NextAuth.js with credential-based authentication:
- Sign up with email, username, and password
- Passwords are hashed with bcrypt
- JWT-based sessions
- Protected routes for authenticated users
- Role-based access control (User/Admin)
POST /api/auth/signin- User loginPOST /api/auth/signup- User registration
GET /api/routeSearch/find- Search for routesPOST /api/routeSearch/parse- Parse search queryGET /api/favoriteRoutes- Get user favoritesPOST /api/favoriteRoutes- Save favorite routeDELETE /api/favoriteRoutes- Remove favoriteGET /api/searchHistory- Get search history
GET /api/admin/users- List all usersGET /api/admin/me- Get current admin info
# Generate Prisma Client
npx prisma generate
# Create a new migration
npx prisma migrate dev --name migration_name
# Reset database
npx prisma migrate reset
# Open Prisma Studio (database GUI)
npx prisma studionpm run build
npm run start-
Home Page (
/) - Main search interface. Enter query as "from -> to" or use voice input. View direct and transfer routes with times and operator info. Save favorite routes. -
Sign In (
/auth/sign-in) - User login with email and password. Creates JWT session for dashboard access. -
Sign Up (
/auth/sign-up) - Account registration with email, username, and password validation. Auto-redirects to sign in after successful registration. -
Search History (
/history) - View all previous searches with timestamps. -
Favorite Routes (
/favorites) - Saved routes with details and quick actions. Re-run, remove, or view route information for commute optimization. -
Profile (
/profile) - User account settings with username, email and role display. Edit profile email and mail or change password with current password verification and bcrypt re-hashing. -
Admin Dashboard (
/admin) - User management panel (admin only). List all users, view roles and manage accounts.
This project is licensed under the MIT License
- AnnPoberezhna - GitHub Profile
- Franiu78 - GitHub Profile
- Built with Next.js
- UI components from Radix UI
- Database ORM by Prisma
- Authentication by NextAuth.js