# PragmaStack - Frontend Production-ready Next.js 16 frontend with TypeScript, authentication, admin panel, and internationalization. ## Features ### Core - โšก **Next.js 16** - App Router with React Server Components - ๐Ÿ“˜ **TypeScript** - Full type safety - ๐ŸŽจ **Tailwind CSS** - Utility-first styling - ๐Ÿงฉ **shadcn/ui** - High-quality component library - ๐ŸŒ™ **Dark Mode** - System-aware theme switching ### Authentication & Security - ๐Ÿ” **JWT Authentication** - Access & refresh token flow - ๐Ÿ”’ **Protected Routes** - Client-side route guards - ๐Ÿ‘ค **User Management** - Profile settings, password change - ๐Ÿ“ฑ **Session Management** - Multi-device session tracking ### Internationalization (i18n) - ๐ŸŒ **Multi-language Support** - English & Italian (easily extensible) - ๐Ÿ”— **Locale Routing** - SEO-friendly URLs (`/en/login`, `/it/login`) - ๐ŸŽฏ **Type-safe Translations** - TypeScript autocomplete for keys - ๐Ÿ“„ **Localized Metadata** - SEO-optimized meta tags per locale - ๐Ÿ—บ๏ธ **Multilingual Sitemap** - Automatic sitemap generation with hreflang ### Admin Panel - ๐Ÿ‘ฅ **User Administration** - CRUD operations, search, filters - ๐Ÿข **Organization Management** - Multi-tenant support with roles - ๐Ÿ“Š **Dashboard** - Statistics and quick actions - ๐Ÿ” **Advanced Filtering** - Status, search, pagination ### Developer Experience - โœ… **Comprehensive Testing** - 1,142+ unit tests, 178+ E2E tests - ๐ŸŽญ **Playwright** - End-to-end testing with fixtures - ๐Ÿงช **Jest** - Fast unit testing with coverage - ๐Ÿ“ **ESLint & Prettier** - Code quality enforcement - ๐Ÿ” **TypeScript** - Strict mode enabled ## Getting Started ### Prerequisites - Node.js 18+ - npm, yarn, or pnpm ### Installation ```bash # Install dependencies npm install # Run development server npm run dev ``` Open [http://localhost:3000](http://localhost:3000) to view the app. ### Environment Variables Create a `.env.local` file: ```env NEXT_PUBLIC_API_URL=http://localhost:8000/api/v1 NEXT_PUBLIC_SITE_URL=http://localhost:3000 ``` ## Scripts ```bash # Development npm run dev # Start dev server npm run build # Production build npm run start # Start production server # Code Quality npm run lint # Run ESLint npm run format # Format with Prettier npm run format:check # Check formatting npm run type-check # TypeScript type checking npm run validate # Run all checks (lint + format + type-check) # Testing npm test # Run unit tests npm run test:watch # Watch mode npm run test:coverage # Coverage report npm run test:e2e # Run E2E tests npm run test:e2e:ui # Playwright UI mode # API Client npm run generate:api # Generate TypeScript client from OpenAPI spec ``` ## Project Structure ``` frontend/ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ app/ # Next.js App Router โ”‚ โ”‚ โ”œโ”€โ”€ [locale]/ # Locale-specific routes โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ (auth)/ # Auth pages (login, register) โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ (authenticated)/ # Protected pages โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ admin/ # Admin panel โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ layout.tsx # Locale layout โ”‚ โ”‚ โ”œโ”€โ”€ sitemap.ts # Multilingual sitemap โ”‚ โ”‚ โ””โ”€โ”€ robots.ts # SEO robots.txt โ”‚ โ”œโ”€โ”€ components/ # React components โ”‚ โ”‚ โ”œโ”€โ”€ auth/ # Auth components โ”‚ โ”‚ โ”œโ”€โ”€ admin/ # Admin components โ”‚ โ”‚ โ”œโ”€โ”€ forms/ # Form utilities โ”‚ โ”‚ โ”œโ”€โ”€ navigation/ # Navigation (Header, LocaleSwitcher) โ”‚ โ”‚ โ””โ”€โ”€ ui/ # shadcn/ui components โ”‚ โ”œโ”€โ”€ lib/ # Utilities & configuration โ”‚ โ”‚ โ”œโ”€โ”€ api/ # API client (auto-generated) โ”‚ โ”‚ โ”œโ”€โ”€ auth/ # Auth utilities & storage โ”‚ โ”‚ โ”œโ”€โ”€ i18n/ # Internationalization โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ routing.ts # Locale routing config โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ utils.ts # Locale utilities โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ metadata.ts # SEO metadata helpers โ”‚ โ”‚ โ””โ”€โ”€ stores/ # Zustand state management โ”‚ โ””โ”€โ”€ hooks/ # Custom React hooks โ”œโ”€โ”€ messages/ # Translation files โ”‚ โ”œโ”€โ”€ en.json # English โ”‚ โ””โ”€โ”€ it.json # Italian โ”œโ”€โ”€ e2e/ # Playwright E2E tests โ”œโ”€โ”€ tests/ # Jest unit tests โ”œโ”€โ”€ docs/ # Documentation โ”‚ โ”œโ”€โ”€ I18N.md # i18n guide โ”‚ โ””โ”€โ”€ design-system/ # Design system docs โ””โ”€โ”€ types/ # TypeScript type definitions ``` ## Internationalization (i18n) The app supports multiple languages with SEO-optimized routing. ### Supported Languages - ๐Ÿ‡ฌ๐Ÿ‡ง English (default) - ๐Ÿ‡ฎ๐Ÿ‡น Italian ### Usage ```typescript // Client components import { useTranslations } from 'next-intl'; export function MyComponent() { const t = useTranslations('namespace'); return

{t('title')}

; } // Server components import { getTranslations } from 'next-intl/server'; export default async function Page() { const t = await getTranslations('namespace'); return

{t('title')}

; } // Navigation (always use locale-aware routing) import { Link, useRouter } from '@/lib/i18n/routing'; Dashboard // โ†’ /en/dashboard ``` ### Adding New Languages 1. Create translation file: `messages/fr.json` 2. Update `src/lib/i18n/routing.ts`: Add `'fr'` to locales 3. Update `src/lib/i18n/metadata.ts`: Add `'fr'` to Locale type 4. Update `LocaleSwitcher` component with locale name See [docs/I18N.md](./docs/I18N.md) for complete guide. ## Testing ### Unit Tests (Jest) ```bash # Run all tests npm test # Watch mode npm run test:watch # Coverage npm run test:coverage ``` **Coverage**: 1,142+ tests covering components, hooks, utilities, and pages. ### E2E Tests (Playwright) ```bash # Run E2E tests npm run test:e2e # UI mode (recommended for debugging) npm run test:e2e:ui # Debug mode npm run test:e2e:debug ``` **Coverage**: 178+ tests covering authentication, navigation, admin panel, and user flows. ## Documentation - [Internationalization Guide](./docs/I18N.md) - Complete i18n implementation guide - [Design System](./docs/design-system/) - Component library and patterns - [Implementation Plan](./docs/I18N_IMPLEMENTATION_PLAN.md) - i18n implementation details ## Tech Stack - **Framework**: Next.js 16 (App Router) - **Language**: TypeScript 5 - **Styling**: Tailwind CSS 3 + shadcn/ui - **State Management**: Zustand + TanStack Query - **Forms**: React Hook Form + Zod - **i18n**: next-intl 4.5.3 - **Testing**: Jest + Playwright - **Code Quality**: ESLint + Prettier ## Performance - โšก Server Components for optimal loading - ๐ŸŽจ Font optimization with `display: 'swap'` - ๐Ÿ“ฆ Code splitting with dynamic imports - ๐Ÿ—œ๏ธ Automatic bundle optimization - ๐ŸŒ Lazy loading of locale messages - ๐Ÿ–ผ๏ธ Image optimization with next/image ## Browser Support - Chrome (latest) - Firefox (latest) - Safari (latest) - Edge (latest) ## Contributing 1. Follow existing code patterns 2. Write tests for new features 3. Run `npm run validate` before committing 4. Keep translations in sync (en.json & it.json) ## License MIT License - see LICENSE file for details ## Learn More - [Next.js Documentation](https://nextjs.org/docs) - [next-intl Documentation](https://next-intl-docs.vercel.app/) - [shadcn/ui](https://ui.shadcn.com/) - [Tailwind CSS](https://tailwindcss.com/)