Dayboard Hub is a yacht management application built on Next.js 15 with React 19, featuring document management, crew scheduling, and financial reporting. This project has been evolved from a tutorial template into a portfolio-ready application with enterprise-grade features.
This project has been enhanced beyond the base template with the following custom implementations:
Location: app/lib/utils.ts
- Env-based feature toggles for experimental pages
- Flags:
ENABLE_EXPERIMENTAL_DASHBOARD,ENABLE_ANALYTICS_PAGE,ENABLE_OBSERVABILITY_PAGE - Integrated into navigation for conditional rendering
Location: middleware.ts, app/lib/definitions.ts
- Middleware-based RBAC with admin/user roles
- Admin-only route protection at
/dashboard/admin - Dynamic role checking in authentication flow
Location: app/api/public/data/route.ts, app/public/page.tsx
- Public API route with edge caching strategy
- SWR (Stale-While-Revalidate) implementation for optimal performance
- Cache-Control headers:
s-maxage=60, stale-while-revalidate=120
Locations:
app/dashboard/customers/loading.tsx&error.tsxapp/dashboard/observability/loading.tsx&error.tsxapp/public/loading.tsx&error.tsx- All routes have skeleton loaders and comprehensive error handling
Location: app/dashboard/observability/page.tsx
- Real-time Core Web Vitals monitoring using
next/web-vitals - Metrics: FCP, LCP, FID, INP, CLS, TTFB
- Color-coded performance ratings (good/needs-improvement/poor)
- Client-side rendering with feature flag protection
Locations: tests/, playwright.config.ts, vitest.config.ts
- Homepage navigation and content validation
- Public route caching verification
- Feature flag behavior testing
- Responsive design checks (mobile & desktop)
- Cross-browser testing (Chrome, Firefox, Safari)
- Component rendering (
tests/components/card-skeleton.test.tsx) - Utility function validation (
tests/utils.test.ts) - Feature flag system testing (
tests/components/feature-flags.test.ts) - 80%+ coverage target
Location: .github/workflows/ (to be created)
- GitHub Actions for automated testing
- Playwright E2E test runs
- Vitest coverage reports
- Build verification on pull requests
- β Next.js App Router architecture
- β PostgreSQL database integration via Vercel Postgres
- β Next-Auth authentication
- β Invoice and customer management CRUD
- β Revenue charting and analytics
- β Responsive Tailwind CSS design
- β Form validation with Zod
- β Feature flag system with env-based toggles
- β RBAC middleware for route protection
- β Edge caching with SWR strategy
- β Comprehensive loading states per route
- β Global and per-route error boundaries
- β Web Vitals observability dashboard
- β Full E2E test coverage with Playwright
- β Component unit tests with Vitest
- β CI/CD pipeline configuration
- Node.js >=20.12.0
- PostgreSQL database (Vercel Postgres recommended)
# Install dependencies
yarn install
# Set up environment variables
cp .env.example .env.local
# Configure your environment variables
# See .env.example for required variables# Database
POSTGRES_URL=your_postgres_url
POSTGRES_PRISMA_URL=your_postgres_prisma_url
POSTGRES_URL_NON_POOLING=your_postgres_non_pooling_url
# Auth
AUTH_SECRET=your_auth_secret_generate_with_openssl
# Public URL
NEXT_PUBLIC_BASE_URL=http://localhost:3000
# Feature Flags
ENABLE_EXPERIMENTAL_DASHBOARD=false
ENABLE_ANALYTICS_PAGE=false
ENABLE_OBSERVABILITY_PAGE=true# Development server
yarn dev
# Build for production
yarn build
# Start production server
yarn start# Run all tests
yarn test
# Watch mode for development
yarn test:watch
# Playwright E2E tests
yarn test:e2e
# Coverage report
yarn test:coveragenextjs-dashboard/
βββ app/
β βββ api/
β β βββ public/
β β βββ data/
β β βββ route.ts # Edge-cached API
β βββ dashboard/
β β βββ (overview)/
β β βββ customers/
β β β βββ loading.tsx # Custom skeleton
β β β βββ error.tsx # Error boundary
β β β βββ page.tsx
β β βββ observability/
β β βββ loading.tsx
β β βββ error.tsx
β β βββ page.tsx # Web vitals dashboard
β βββ lib/
β β βββ utils.ts # Feature flags
β βββ login/
β βββ public/
β β βββ loading.tsx
β β βββ error.tsx
β β βββ page.tsx # SWR example
β βββ ui/
βββ middleware.ts # RBAC implementation
βββ tests/
β βββ components/
β βββ example.spec.ts # Playwright tests
β βββ setup.ts
β βββ utils.test.ts
βββ playwright.config.ts
βββ vitest.config.ts
βββ package.json
- Coverage: Critical user flows, navigation, feature flags
- Browsers: Chrome, Firefox, Safari
- CI: Runs on every PR
- Coverage Target: 80%+
- Focus: Utilities, components, feature flags
- Fast: Runs in parallel, watch mode supported
yarn test # Run all Vitest tests
yarn test:watch # Watch mode
yarn test:e2e # Playwright E2E tests
yarn test:coverage # Generate coverage report- Feature Flags: Simple env-based approach for flexibility without external services
- RBAC: Middleware-level for early route protection
- Caching: SWR at API level for optimal performance
- Error Handling: Per-route error boundaries for granular UX
- Testing: Playwright + Vitest for comprehensive coverage
- Observability: Client-side Web Vitals for real-time metrics
- Edge caching with stale-while-revalidate
- Route-level loading states (no layout shift)
- Optimized bundle splitting
- Core Web Vitals monitoring
- Progressive enhancement
- Middleware-based RBAC
- Role-based route protection
- Authenticated API routes
- Secure environment variables
- Next-Auth secure sessions
This project is built on the Next.js Learn Dashboard template and customized for portfolio purposes.
- Base template: Next.js Learn Dashboard
- UI: Tailwind CSS
- Auth: Next-Auth
- Database: Vercel Postgres
- Testing: Playwright & Vitest