A production-ready, TypeScript-first booking platform for campsite reservations, built with Next.js 14, PostgreSQL, and modern React patterns.
Trailbase is a comprehensive campsite booking platform with:
- Full TypeScript Coverage - Type-safe from database to UI
- Modern Stack - Next.js 14 App Router, Prisma ORM, React Query
- Production Features - Authentication, payments, real-time availability
- Scalable Architecture - Built for growth and maintainability
- README.md - This file (project overview)
- QUICK_START_CHECKLIST.md - START HERE - Step-by-step setup guide
- TYPESCRIPT_SETUP_SUMMARY.md - Technical decisions and rationale
- TRAILBASE_MIGRATION_PLAN.md - Full migration roadmap
- package.json - Dependencies and scripts
- tsconfig.json - TypeScript configuration
- next.config.js - Next.js configuration
- env.example.txt - Environment variables template
- types-campsite.ts - Campsite models
- types-user.ts - User and authentication types
- types-booking.ts - Booking system types
- types-review.ts - Review and rating types
- types-api.ts - API response types
- validations-auth.ts - Auth form validation
- validations-campsite-booking.ts - Booking validation
- utils.ts - Utility functions (30+ helpers)
- schema.prisma - Complete database schema
- Three user roles: Camper, Owner, Admin
- NextAuth.js authentication
- Profile management with avatar upload
- Email verification
- Password reset flow
- Rich campsite listings with images
- Advanced search and filters
- Map integration
- Amenities and pricing
- Seasonal rates
- Owner dashboard
- Real-time availability calendar
- Multi-date selection
- Guest management
- Booking modifications
- Cancellation handling
- Payment processing (Stripe)
- 5-star rating system
- Photo uploads
- Owner responses
- Verified stays
- Helpful votes
- Messaging system
- Admin dashboard
- Analytics
- Email notifications
- Mobile responsive
- Dark mode
- Next.js 14 - App Router, Server Components, Server Actions
- TypeScript - Full type safety
- Tailwind CSS - Utility-first styling
- shadcn/ui - Beautiful, accessible components
- React Query - Data fetching and caching
- Zustand - Lightweight state management
- React Hook Form - Form handling
- Zod - Schema validation
- Next.js API Routes - Serverless backend
- Prisma - Type-safe ORM
- PostgreSQL - Production database
- NextAuth.js - Authentication
- Stripe - Payment processing
- Cloudinary - Image hosting
- Vercel - Deployment
- GitHub Actions - CI/CD
- ESLint - Code linting
- Prettier - Code formatting
- Node.js 18+
- PostgreSQL database
- Git
-
Read the Quick Start Checklist
cat QUICK_START_CHECKLIST.md
-
Install Dependencies
npm install
-
Setup Environment Variables
cp env.example.txt .env.local # Edit .env.local with your values -
Setup Database
npx prisma migrate dev --name init npx prisma generate
-
Run Development Server
npm run dev
-
Open in Browser
http://localhost:3000
trailbase/
├── prisma/
│ └── schema.prisma # Database schema
├── public/ # Static assets
├── src/
│ ├── app/ # Next.js App Router
│ │ ├── (auth)/ # Auth pages
│ │ ├── (dashboard)/ # Dashboard pages
│ │ ├── campsites/ # Campsite pages
│ │ ├── bookings/ # Booking pages
│ │ └── api/ # API routes
│ ├── components/ # React components
│ │ ├── ui/ # shadcn/ui components
│ │ ├── forms/ # Form components
│ │ └── shared/ # Shared components
│ ├── lib/ # Utilities and helpers
│ │ ├── validations-auth.ts
│ │ ├── validations-campsite-booking.ts
│ │ └── utils.ts
│ ├── types/ # TypeScript types
│ │ ├── types-campsite.ts
│ │ ├── types-user.ts
│ │ ├── types-booking.ts
│ │ ├── types-review.ts
│ │ └── types-api.ts
│ ├── hooks/ # Custom React hooks
│ └── stores/ # Zustand stores
├── env.example.txt # Environment template
├── next.config.js # Next.js config
├── tsconfig.json # TypeScript config
└── package.json # Dependencies
# Create feature branch
git checkout -b feature/your-feature
# Make changes and test
npm run dev
# Commit with conventional commits
git commit -m "feat: add feature description"# Check types
npm run type-check
# Generate Prisma types
npx prisma generate# Create migration
npx prisma migrate dev --name your_migration_name
# Apply migrations
npx prisma migrate deploy
# Open Prisma Studio
npx prisma studio# Run tests
npm test
# Run tests in watch mode
npm run test:watchnpm run dev- Start development servernpm run build- Build for productionnpm start- Start production servernpm run lint- Run ESLintnpm run type-check- Check TypeScript typesnpm run format- Format code with Prettier
See env.example.txt for all required environment variables.
DATABASE_URL- PostgreSQL connection stringNEXTAUTH_SECRET- NextAuth.js secretNEXTAUTH_URL- App URL
STRIPE_SECRET_KEY- Stripe paymentsCLOUDINARY_URL- Image uploadsEMAIL_SERVER- Email notifications
Your campsite booking platform can be built using the TypeScript/Next.js structure. See TRAILBASE_MIGRATION_PLAN.md for the complete implementation roadmap.
- Setup - TypeScript, Next.js, database
- Core Features - Auth, campsites, bookings
- Advanced Features - Payments, messaging, admin
- Polish - Performance, SEO, testing
This is a personal project for portfolio purposes. Feel free to fork and adapt for your own use.
MIT License - See LICENSE file for details
For questions or issues:
- Check the documentation files
- Review the TypeScript types
- Consult the migration plan
- Check Next.js and Prisma docs
- Read QUICK_START_CHECKLIST.md
- Follow the setup steps
- Review TYPESCRIPT_SETUP_SUMMARY.md
- Start coding!
Built with Next.js 14, TypeScript, and Prisma