A comprehensive Next.js 14 playground showcasing components, SSR, SSG, ISR, API routes, middleware, and modern web development best practices.
- 7 Reusable Components: Button, Card, Modal, Input, Dropdown, Badge, Toggle
- Customizable Props: Variants, sizes, states, and more
- Storybook Integration: Interactive component exploration
- TypeScript Support: Full type safety
- SSR Page: Server-side rendered page with live data fetching
- SSG Page: Static site generation with pre-rendered content
- ISR Page: Incremental static regeneration (10-minute revalidation)
- API Routes: RESTful endpoints (
/api/users,/api/posts) - Middleware: Authentication simulation and request handling
- Lazy Loading: Dynamic imports for heavy components
- Image Optimization: Using
next/imagefor optimized images - Code Splitting: Automatic bundle optimization
- React Memoization:
memo,useMemo,useCallbackfor performance
- Node.js 18+
- Yarn or npm
# Clone the repository
git clone <repository-url>
cd developer-playground
# Install dependencies
yarn install# Start development server
yarn devOpen http://localhost:3000 to view the app.
# Launch Storybook
yarn storybookStorybook opens at http://localhost:6006.
developer-playground/
βββ .storybook/ # Storybook configuration
βββ public/ # Static assets
βββ src/
β βββ app/
β β βββ api/ # API routes
β β β βββ users/
β β β βββ posts/
β β βββ components/ # Component demo page
β β βββ demos/ # Feature demo pages
β β β βββ ssr/
β β β βββ ssg/
β β β βββ isr/
β β β βββ api/
β β β βββ lazy/
β β β βββ protected/
β β βββ docs/ # Documentation page
β β βββ globals.css
β β βββ layout.tsx
β β βββ page.tsx
β βββ components/
β β βββ ui/ # Reusable UI components
β β βββ Navigation.tsx
β βββ middleware.ts # Next.js middleware
β βββ stories/ # Storybook stories
βββ tailwind.config.ts
βββ package.json
import { Button } from "@/components/ui";
<Button variant="primary" size="md" loading={false}>
Click Me
</Button>import { Card } from "@/components/ui";
<Card variant="gradient" hoverable>
Content
</Card>import { Modal } from "@/components/ui";
<Modal isOpen={open} onClose={close} title="Title">
Content
</Modal>import { Input } from "@/components/ui";
<Input label="Email" placeholder="Enter email" error="Invalid" />import { Dropdown } from "@/components/ui";
<Dropdown options={options} value={value} onChange={setValue} />import { Badge } from "@/components/ui";
<Badge variant="success" dot>Active</Badge>import { Toggle } from "@/components/ui";
<Toggle checked={enabled} onChange={setEnabled} label="Enable" />Fetch users with optional filtering.
GET /api/users?role=Developer&limit=5Create a new user.
POST /api/users
Content-Type: application/json
{
"name": "John Doe",
"email": "john@example.com",
"role": "Developer"
}Fetch posts with optional filtering.
GET /api/posts?category=Tutorial&limit=3Create a new post.
The middleware protects routes under /demos/protected.
Access with token:
/demos/protected?token=demo-secret-token
- Push to GitHub
- Import in Vercel
- Configure environment variables
- Deploy
NEXT_PUBLIC_API_URL=https://your-domain.com
API_SECRET_KEY=your-secret-keyyarn dev # Start development server
yarn build # Build for production
yarn start # Start production server
yarn lint # Run ESLint
yarn storybook # Launch Storybook
yarn build-storybook # Build Storybook- Framework: Next.js 14
- Language: TypeScript
- Styling: Tailwind CSS 3
- Components: React 18
- Documentation: Storybook 8
- Deployment: Vercel-ready
MIT License - feel free to use this project for learning and portfolio purposes.