starkon
Version:
Complete Next.js boilerplate with authentication, i18n & CLI - Create production-ready apps instantly
1,448 lines (1,109 loc) β’ 40.5 kB
Markdown
# π Starkon - Next.js Boilerplate & Template Generator
[](https://www.npmjs.com/package/starkon)
[](https://www.npmjs.com/package/starkon)
[](https://github.com/zzafergok/starkon/blob/main/LICENSE)
[](https://nextjs.org/)
> π **Create production-ready Next.js applications in seconds, not hours**
**The most comprehensive Next.js 16 starter template with authentication, internationalization, corporate features, and an interactive CLI that lets you choose the perfect template.**
### β¨ Interactive Template Selection
```bash
npx starkon my-app
```
Choose from 3 optimized templates with arrow keys, or use 3 additional specialized templates via `--template` flag:
- ποΈ **Next.js Boilerplate** - Full-stack with auth & i18n
- π― **Landing Page** - Marketing-optimized single page
- π’ **Corporate** - Business website with CMS
- π **Dashboard** - Admin panel optimized (manual: `--template dashboard`)
- β‘ **Basic** - Essential setup (manual: `--template basic`)
- π― **Minimal** - Bare-bones (manual: `--template minimal`)
## β‘ Quick Start
### π― Interactive CLI Menu
Simply run the command and choose your template:
```bash
npx starkon my-app
```
You'll see an interactive menu with 3 main options:
- **β― Next.js Boilerplate** - Full-featured with auth & i18n
- **Landing Page Template** - Single-page marketing site
- **Corporate Template** - Business website with CMS
Use **ββ arrow keys** to navigate and **Enter** to select.
### π Complete Setup
```bash
npx starkon my-awesome-app
# β Interactive menu appears
# β Select template with arrow keys
# β Press Enter to confirm
cd my-awesome-app
npm install
npm run dev
```
Your Next.js app will be running at `http://localhost:3000` π
### πββοΈ Skip Interactive Menu
You can also specify template directly:
```bash
npx starkon my-app --template corporate # Business website
npx starkon my-app --template landing # Marketing page
npx starkon my-app --template standard # Full-stack app
```
## π― Template Library
Choose the perfect starting point for your specific use case:
### π’ **Corporate Template** β
Complete business website with content management system.
```bash
npx starkon company-website --template corporate
```
**Perfect for:**
- Corporate websites
- Agency portfolios
- Business landing pages
- Service companies
**Includes:**
- π **Pages:** Home, About, Services, Blog, Gallery, Contact
- π§© **Components:** ServiceCard, TeamMember, BlogCard, GalleryItem
- π **Content System:** Built-in content management with TypeScript interfaces
- π¨ **Professional Design:** Clean, modern business aesthetic
- π± **Responsive:** Mobile-optimized layouts
**Excludes:** Authentication system, i18n complexity for cleaner corporate focus
### π― **Landing Template** β _Popular_
Single-page marketing websites optimized for conversions.
```bash
npx starkon product-launch --template landing
```
**Perfect for:**
- Product launches
- SaaS marketing sites
- Portfolio websites
- Event pages
**Includes:**
- π¨ **Sections:** Hero, Features, Testimonials, CTA, Contact
- β‘ **Animations:** Smooth scroll-triggered animations with Framer Motion
- π **Forms:** Contact forms with validation
- π― **CTA Optimized:** Conversion-focused design patterns
**Excludes:** Authentication, i18n, dashboard components for faster loading
### ποΈ **Next.js Boilerplate** (Full-Featured)
Complete full-stack setup with all enterprise features.
```bash
npx starkon enterprise-app --template standard
```
**Perfect for:**
- SaaS applications
- Admin dashboards
- Enterprise tools
- Multi-user platforms
**Includes:**
- π **Authentication:** JWT-based auth with session management
- π **i18n:** English/Turkish with easy language addition
- π **Dashboard:** Admin panels and user management
- π‘οΈ **Security:** Protected routes, XSS protection
- π¨ **Complete UI Kit:** 46 production-ready components
### β‘ **Basic Template**
Essential Next.js setup without complexity.
```bash
npx starkon simple-app --template basic
```
**Perfect for:**
- Small projects
- Prototypes
- Learning Next.js
- Quick experiments
**Includes:** Next.js 16, TypeScript, Tailwind CSS, ESLint
**Excludes:** Authentication, i18n, complex UI components
### π **Dashboard Template**
Admin dashboard optimized for data-heavy applications.
```bash
npx starkon admin-panel --template dashboard
```
**Perfect for:**
- Admin dashboards
- Analytics tools
- Data management
- Internal tools
**Includes:** Dashboard layout, data tables, charts integration, auth system
**Excludes:** Public marketing pages
### π― **Minimal Template**
Bare-bones Next.js setup for maximum control.
```bash
npx starkon minimal-app --template minimal
```
**Perfect for:**
- Custom implementations
- Learning projects
- Starting from scratch
**Includes:** Next.js 16, TypeScript only
**Excludes:** Everything else - build your own way
## ποΈ Architecture Overview
### Project Structure
```
starkon-app/
βββ src/
β βββ app/ # Next.js App Router
β β βββ (auth)/ # π Protected route group
β β β βββ dashboard/ # Main dashboard
β β β βββ settings/ # User settings
β β β βββ profile/ # User profile management
β β β βββ components/ # Component showcase/demo
β β β βββ layout.tsx # Auth layout wrapper
β β βββ (corporate)/ # π’ Corporate route group
β β β βββ about/ # Company info
β β β βββ services/ # Services catalog
β β β βββ blog/ # Blog system
β β β βββ gallery/ # Project gallery
β β β βββ contact/ # Contact page
β β β βββ layout.tsx # Corporate layout
β β βββ (authentication)/ # π Auth flows
β β β βββ login/ # Login page
β β β βββ register/ # Registration
β β β βββ forgot-password/ # Password recovery
β β β βββ reset-password/ # Password reset
β β β βββ verify-email/ # Email verification
β β β βββ layout.tsx # Auth flow layout
β β βββ page.tsx # Home page
β β βββ not-found.tsx # 404 handler
β β βββ layout.tsx # Root layout
β βββ components/ # Reusable components
β β βββ core/ # π§© 46 base UI components
β β β βββ button.tsx
β β β βββ input.tsx
β β β βββ card.tsx
β β β βββ data-table.tsx
β β β βββ command-menu.tsx
β β β βββ rich-text-editor.tsx
β β β βββ ... (40+ more)
β β βββ corporate/ # π’ Business components
β β β βββ ServiceCard.tsx
β β β βββ TeamMember.tsx
β β β βββ BlogCard.tsx
β β β βββ GalleryItem.tsx
β β βββ sections/ # π― Landing page sections
β β β βββ Hero.tsx
β β β βββ Features.tsx
β β β βββ Testimonials.tsx
β β βββ ui/ # Complex components
β β β βββ FileUpload/ # File upload with dropzone
β β β βββ brand/ # Brand components
β β β βββ dashboard/ # Dashboard components
β β βββ layout/ # Layout components
β β βββ forms/ # Form components
β βββ lib/ # Core utilities
β β βββ api/
β β β βββ axios.ts # HTTP client with interceptors
β β βββ services/ # API services & auth
β β β βββ authApiService.ts
β β β βββ mockAuthService.ts
β β β βββ sessionTokenManager.ts
β β βββ validations/ # Zod schemas
β β β βββ auth.ts # Auth validation schemas
β β βββ types/ # TypeScript definitions
β β βββ content.ts # π Content management system
β β βββ i18n.ts # Internationalization
β β βββ utils.ts # Helper utilities
β βββ hooks/ # Custom React hooks
β β βββ useAuth.ts # Authentication hook
β β βββ useTheme.ts # Theme management
β β βββ useToast.ts # Toast notifications
β β βββ useLocale.ts # Locale management
β β βββ useClipboard.ts # Clipboard utilities
β β βββ usePasswordStrength.ts # Password validation
β β βββ useForm.ts # Form utilities
β βββ providers/ # Context providers
β β βββ AuthProvider.tsx # Auth state management
β β βββ I18nProvider.tsx # i18n integration
β β βββ ReactQueryProvider.tsx # Data fetching
β β βββ theme-provider.tsx # Dark/light theme
β β βββ toast-provider.tsx # Toast system
β βββ store/ # Zustand stores
β β βββ toastStore.ts # Toast notifications
β β βββ pomodoro-store.ts # Pomodoro timer state
β βββ locales/ # π i18n translations
β βββ en/ # English
β βββ tr/ # Turkish
βββ public/ # Static assets
βββ tailwind.config.mjs # Tailwind configuration
βββ next.config.mjs # Next.js configuration
```
### Technology Stack
**Core Framework:**
- **Next.js 16** - App Router, Server Components, optimized performance
- **React 19** - Latest React features and improvements
- **TypeScript 5.7** - Full type safety and developer experience
**UI & Design:**
- **Radix UI** - Accessible, unstyled component primitives
- **Tailwind CSS 3.4** - Utility-first styling with custom design system
- **class-variance-authority** - Type-safe component variants
- **Framer Motion** - Smooth animations and transitions
- **Lucide React** - Beautiful, consistent icon library
- **CSS Variables** - Dynamic theming support
**State & Data:**
- **React Query (@tanstack/react-query)** - Server state management and caching
- **Zustand 5.0** - Lightweight client state management
- **Redux + Redux Persist** - Optional complex state with persistence
- **React Hook Form** - Performant forms with validation
**API & HTTP:**
- **Axios** - HTTP client with custom interceptors
- **Request/response queuing** - Token refresh handling
- **FormData support** - File upload integration
- **Environment-based switching** - Mock/real API toggle
**Forms & Validation:**
- **React Hook Form** - Form state management
- **Zod** - TypeScript-first schema validation
- **@hookform/resolvers** - Form validation integration
**Internationalization:**
- **i18next** - Complete i18n solution
- **react-i18next** - React integration
- **Browser language detection** - Automatic locale detection
- **localStorage + cookie persistence** - Language preference storage
**Advanced Features:**
- **cmdk** - Command menu (Cmd+K)
- **react-dropzone** - File upload interface
- **@tanstack/react-table** - Headless table library
- **date-fns** - Date manipulation utilities
- **crypto-js** - Encryption utilities
- **react-error-boundary** - Error handling
**Development:**
- **ESLint** - Code linting with Next.js rules
- **Prettier** - Code formatting with Tailwind plugin
- **Jest** - Unit testing framework
- **React Testing Library** - Component testing utilities
- **Husky** - Git hooks
- **Commitizen** - Conventional commits
## π Authentication System
### Features
- **JWT Tokens** - Secure access and refresh token system
- **Auto-refresh** - Automatic token renewal with 5-minute buffer
- **Session Management** - Persistent login with "Remember Me"
- **Protected Routes** - Middleware-based route protection
- **Mock Development** - Built-in test users for development
- **4 Auth Flows** - Login, Register, Forgot Password, Reset Password, Verify Email
### Development Users
```typescript
// Available test accounts
admin@example.com / admin123 // Full admin access
user@example.com / user123 // Standard user
demo@example.com / demo123 // Demo account
```
### Usage
```tsx
import { useAuth } from '@/hooks/useAuth'
function Dashboard() {
const { user, logout, isAuthenticated } = useAuth()
if (!isAuthenticated) return <LoginForm />
return <h1>Welcome {user.name}!</h1>
}
```
### Authentication Architecture
**5-Layer System:**
1. **Token Management** (`sessionTokenManager.ts`) - sessionStorage with 5-minute refresh buffer
2. **API Service** (`authApiService.ts`) - Environment-based mock/real API switching
3. **Auth Provider** (`AuthProvider.tsx`) - React Context with periodic validation
4. **Middleware** (`middleware.ts`) - Server-side language and route handling
5. **Axios Interceptors** (`axios.ts`) - Auto token attachment and 401 retry queue
## π Internationalization
### Built-in Language Support
- **English (en)** - Complete translations
- **Turkish (tr)** - Native language support
- **Browser Detection** - Automatic language detection
- **URL Persistence** - Language state in URL parameters (`?lang=en`)
- **localStorage & Cookie** - Persistent language preference
### Detection Priority
1. **localStorage** - Key: `language` (permanent)
2. **Cookie** - Key: `language` (365-day expiry)
3. **URL Parameter** - `?lang=tr`
4. **Browser Navigator** - `navigator.language`
5. **Default** - Turkish (`tr`)
### Adding New Languages
```bash
# 1. Create translation file
src/locales/es/translation.json
# 2. Add to supported locales
src/lib/i18n.ts
```
### Usage
```tsx
import { useTranslation } from 'react-i18next'
function Component() {
const { t, i18n } = useTranslation()
// Change language
i18n.changeLanguage('en')
return <h1>{t('welcome.title')}</h1>
}
```
## π¨ UI Component System
### Core Components (46)
**Basic Components:**
```tsx
// Form Components
<Button variant="default | outline | ghost | destructive | link" size="sm | md | lg | icon" />
<Input type="text | email | password" />
<PasswordInput showStrength={true} />
<NumberInput min={0} max={100} />
<Textarea placeholder="Enter text..." />
<Checkbox checked={true} />
<Switch enabled={true} />
<Select options={options} />
```
**Layout Components:**
```tsx
<Card>
<CardHeader>
<CardTitle>Title</CardTitle>
</CardHeader>
<CardContent>Content</CardContent>
</Card>
<Separator orientation="horizontal | vertical" />
<Accordion type="single | multiple" />
<Tabs defaultValue="tab1">
<TabsList>
<TabsTrigger value="tab1">Tab 1</TabsTrigger>
</TabsList>
</Tabs>
<Collapsible>
<CollapsibleTrigger>Toggle</CollapsibleTrigger>
<CollapsibleContent>Hidden content</CollapsibleContent>
</Collapsible>
```
**Data Display:**
```tsx
// Tables with @tanstack/react-table
<DataTable data={data} columns={columns} />
<EnhancedDataTable data={data} columns={columns} searchable sortable />
<DataGrid data={data} />
<Table>
<TableHeader>
<TableRow>
<TableHead>Column</TableHead>
</TableRow>
</TableHeader>
</Table>
<Badge variant="default | secondary | outline | destructive" />
<Avatar src="/avatar.jpg" fallback="JD" />
```
**Date & Time:**
```tsx
<Calendar selected={date} onSelect={setDate} />
<DatePicker value={date} onChange={setDate} />
<MonthYearPicker value={date} onChange={setDate} />
<ModernDatePicker value={date} onChange={setDate} />
```
**Navigation:**
```tsx
<CommandMenu>
<CommandInput placeholder="Search..." />
<CommandList>
<CommandGroup heading="Suggestions">
<CommandItem>Calendar</CommandItem>
</CommandGroup>
</CommandList>
</CommandMenu>
<DynamicBreadcrumb items={items} />
<EnhancedPaginationControls page={1} totalPages={10} />
<Stepper steps={steps} currentStep={0} />
<ModernDrawer open={isOpen} onClose={close}>
<DrawerContent>Content</DrawerContent>
</ModernDrawer>
```
**Feedback:**
```tsx
<Alert variant="default | destructive | warning | info">
<AlertTitle>Alert Title</AlertTitle>
<AlertDescription>Description</AlertDescription>
</Alert>
<AlertDialog>
<AlertDialogTrigger>Open</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogTitle>Are you sure?</AlertDialogTitle>
</AlertDialogContent>
</AlertDialog>
<Skeleton className="w-full h-20" />
<LoadingSpinner size="sm | md | lg" />
<Progress value={50} />
<Toast title="Success" description="Action completed" />
```
**Advanced Components:**
```tsx
<Dialog open={isOpen} onOpenChange={setIsOpen}>
<DialogContent>
<DialogHeader>
<DialogTitle>Dialog Title</DialogTitle>
</DialogHeader>
</DialogContent>
</Dialog>
<Dropdown>
<DropdownTrigger>Menu</DropdownTrigger>
<DropdownContent>
<DropdownItem>Item 1</DropdownItem>
</DropdownContent>
</Dropdown>
<Popover>
<PopoverTrigger>Open</PopoverTrigger>
<PopoverContent>Content</PopoverContent>
</Popover>
<Tooltip content="Tooltip text">
<button>Hover me</button>
</Tooltip>
<ScrollArea className="h-96">
<div>Scrollable content</div>
</ScrollArea>
<Slider value={[50]} onValueChange={setValue} />
```
**Enterprise Components:**
```tsx
// File Upload with react-dropzone
<FileUpload
accept={{ 'image/*': ['.png', '.jpg'] }}
maxSize={5242880}
onDrop={handleDrop}
/>
// Rich Text Editor
<RichTextEditor
value={content}
onChange={setContent}
placeholder="Start typing..."
/>
// Advanced Search with Filters
<EnhancedSearchFilters
filters={filters}
onFilterChange={handleFilterChange}
/>
// Accessibility Enhancer
<AccessibilityEnhancer skipToContentId="main">
<YourContent />
</AccessibilityEnhancer>
// Enterprise Error Boundary
<EnterpriseErrorBoundary
fallback={<ErrorFallback />}
onError={logError}
>
<YourApp />
</EnterpriseErrorBoundary>
```
### Corporate Components
```tsx
// Service showcase
<ServiceCard
title="Web Development"
description="Custom web solutions"
features={["React", "Next.js", "TypeScript"]}
icon={Code}
href="/services/web"
/>
// Team member display
<TeamMember
name="John Doe"
role="Lead Developer"
bio="10+ years experience"
image="/team/john.jpg"
social={{ linkedin: "...", github: "..." }}
skills={["React", "Node.js", "AWS"]}
/>
// Blog post cards
<BlogCard
title="Getting Started with Next.js"
excerpt="Learn the fundamentals..."
author={{ name: "Jane Smith", avatar: "/authors/jane.jpg" }}
category="Tutorial"
readingTime="5 min read"
publishedAt="2024-01-15"
/>
// Gallery items
<GalleryItem
image="/projects/project1.jpg"
title="Project Name"
category="Web Design"
description="Project description"
/>
```
### Landing Page Sections
```tsx
// Hero section with CTA
<Hero
title="Build Amazing Apps"
subtitle="Next.js boilerplate for rapid development"
primaryAction="Get Started"
secondaryAction="View Demo"
/>
// Feature showcase
<Features
title="Everything You Need"
features={[
{ title: "Fast Setup", icon: Zap, description: "..." },
{ title: "TypeScript", icon: Shield, description: "..." }
]}
/>
// Social proof
<Testimonials
title="What Developers Say"
testimonials={[
{ name: "Developer", role: "CTO", content: "Amazing tool!" }
]}
/>
// Call to action
<CTA
title="Ready to Build?"
description="Start your next project today"
primaryAction="Get Started"
secondaryAction="View Pricing"
/>
```
## πͺ Custom Hooks
### Authentication
```tsx
import { useAuth } from '@/hooks/useAuth'
const { user, login, logout, isAuthenticated, loading } = useAuth()
```
### Theme Management
```tsx
import { useTheme } from '@/hooks/useTheme'
const { theme, setTheme, systemTheme } = useTheme()
setTheme('dark' | 'light' | 'system')
```
### Toast Notifications
```tsx
import { useToast } from '@/hooks/useToast'
const { toast } = useToast()
toast.success('Success message')
toast.error('Error message')
toast.warning('Warning message')
toast.info('Info message')
toast.promise(asyncFn, {
loading: 'Loading...',
success: 'Done!',
error: 'Failed',
})
```
### Locale Management
```tsx
import { useLocale } from '@/hooks/useLocale'
const { locale, setLocale, availableLocales } = useLocale()
setLocale('en' | 'tr')
```
### Clipboard Utilities
```tsx
import { useClipboard } from '@/hooks/useClipboard'
const { copy, copied, error } = useClipboard()
copy('Text to copy')
```
### Password Strength
```tsx
import { usePasswordStrength } from '@/hooks/usePasswordStrength'
const { strength, score, feedback } = usePasswordStrength(password)
// Returns: weak | fair | good | strong
```
### Form Utilities
```tsx
import { useForm } from '@/hooks/useForm'
const { values, errors, handleChange, handleSubmit } = useForm({
initialValues: { email: '', password: '' },
onSubmit: async (values) => {
/* ... */
},
})
```
## π Providers
### Auth Provider
Manages authentication state across the application.
```tsx
// Wrap your app
import { AuthProvider } from '@/providers/AuthProvider'
;<AuthProvider>
<YourApp />
</AuthProvider>
// Access auth state
const { user, isAuthenticated, login, logout } = useAuth()
```
### i18n Provider
Provides internationalization support.
```tsx
import { I18nProvider } from '@/providers/I18nProvider'
;<I18nProvider>
<YourApp />
</I18nProvider>
```
### React Query Provider
Configures React Query for data fetching and caching.
```tsx
import { ReactQueryProvider } from '@/providers/ReactQueryProvider'
;<ReactQueryProvider>
<YourApp />
</ReactQueryProvider>
```
### Theme Provider
Manages dark/light theme with system preference detection.
```tsx
import { ThemeProvider } from '@/providers/theme-provider'
;<ThemeProvider defaultTheme='system' storageKey='theme'>
<YourApp />
</ThemeProvider>
```
### Toast Provider
Displays toast notifications throughout the app.
```tsx
import { ToastProvider } from '@/providers/toast-provider'
;<ToastProvider>
<YourApp />
</ToastProvider>
```
## π οΈ Development Workflow
### Getting Started
```bash
# 1. Create project with interactive menu
npx starkon my-project
# β Choose template from menu
# 2. Setup development
cd my-project
npm install
# 3. Start development server
npm run dev
# 4. Open browser
open http://localhost:3000
```
### Code Quality
```bash
# Linting and formatting
npm run lint # ESLint check
npm run lint:fix # Auto-fix ESLint errors
npm run prettier # Format code
npm run prettier:check # Check formatting
# Type checking
npm run type-check # TypeScript validation
# Testing
npm test # Run test suite
npm run test:watch # Watch mode testing
npm run test:coverage # Coverage report
```
### Build and Deploy
```bash
# Production build
npm run build
# Analyze bundle size
npm run analyze # Opens webpack-bundle-analyzer
# Start production server
npm run start
```
## π CLI Reference
### Basic Usage
```bash
# Interactive template selection (3 main templates)
npx starkon <project-name>
# Or specify any of 6 templates directly
npx starkon <project-name> --template <template-type>
```
### Options
| Option | Description | Example |
| -------------------------- | ---------------------------------- | ------------------------------ |
| `--template <type>` | Choose template type | `--template corporate` |
| `--skip-git` | Skip git repository initialization | - |
| `--skip-update-check` | Skip version update check | - |
| `--verbose` | Show detailed output | - |
| `--config-set <key=value>` | Set user configuration | `--config-set locale=en` |
| `--config-get <key>` | Get configuration value | `--config-get defaultTemplate` |
| `--clear-cache` | Clear template cache | - |
### Template Types
**Interactive Menu (3 templates):**
| Template | Use Case | Interactive Selection |
| ----------- | -------------------------------- | ------------------------- |
| `standard` | Full-stack apps with auth + i18n | **Next.js Boilerplate** |
| `landing` | Marketing/product pages | **Landing Page Template** |
| `corporate` | Business websites | **Corporate Template** |
**Manual Selection Only (3 templates):**
| Template | Use Case | Command |
| ----------- | ---------------- | ---------------------------------------- |
| `dashboard` | Admin panels | `npx starkon admin --template dashboard` |
| `basic` | Simple projects | `npx starkon simple --template basic` |
| `minimal` | Bare-bones setup | `npx starkon minimal --template minimal` |
### Advanced Examples
```bash
# Interactive template selection (recommended)
npx starkon my-awesome-project
# Skip interactive menu with specific template
npx starkon acme-corp --template corporate --skip-git
# Landing page with verbose output
npx starkon product-launch --template landing --verbose
# Configuration management
npx starkon --config-set locale=en
npx starkon --config-get locale
npx starkon --clear-cache
```
## π Feature Comparison
| Feature | Standard | Corporate | Landing | Dashboard | Basic | Minimal |
| ------------------------ | -------- | --------- | ------- | --------- | ------ | ------- |
| **Core** |
| Next.js 16 | β
| β
| β
| β
| β
| β
|
| TypeScript 5.7 | β
| β
| β
| β
| β
| β
|
| Tailwind CSS | β
| β
| β
| β
| β
| β |
| React 19 | β
| β
| β
| β
| β
| β
|
| **Authentication** |
| JWT Auth System | β
| β | β | β
| β | β |
| Protected Routes | β
| β | β | β
| β | β |
| User Management | β
| β | β | β
| β | β |
| Password Recovery | β
| β | β | β
| β | β |
| **Internationalization** |
| i18n Support | β
| β | β | β
| β | β |
| Multi-language | β
| β | β | β
| β | β |
| URL Language Params | β
| β | β | β
| β | β |
| **UI Components** |
| Core UI Kit (46) | β
| β
| β
| β
| β
| β |
| Corporate Components | β | β
| β | β | β | β |
| Landing Sections | β | β | β
| β | β | β |
| Dashboard Components | β
| β | β | β
| β | β |
| **Advanced Features** |
| Command Menu (Cmd+K) | β
| β
| β
| β
| β | β |
| File Upload | β
| β
| β
| β
| β | β |
| Rich Text Editor | β
| β
| β | β
| β | β |
| Data Tables | β
| β | β | β
| β | β |
| Error Boundaries | β
| β
| β
| β
| β | β |
| **State Management** |
| React Query | β
| β
| β
| β
| β | β |
| Zustand | β
| β
| β
| β
| β | β |
| Redux (Optional) | β
| β | β | β
| β | β |
| **Pages & Routing** |
| Public Pages | β
| β | β
| β | β | β |
| Corporate Pages | β | β
| β | β | β | β |
| Auth Pages | β
| β | β | β
| β | β |
| Dashboard | β
| β | β | β
| β | β |
| **Custom Hooks** |
| useAuth | β
| β | β | β
| β | β |
| useTheme | β
| β
| β
| β
| β | β |
| useToast | β
| β
| β
| β
| β | β |
| useLocale | β
| β | β | β
| β | β |
| useClipboard | β
| β
| β
| β
| β | β |
| usePasswordStrength | β
| β | β | β
| β | β |
| **Performance** |
| Bundle Size | Large | Medium | Small | Medium | Small | Tiny |
| Setup Time | 2-3 min | 1-2 min | 1 min | 2 min | 30 sec | 15 sec |
## π Deployment Guide
### π’ Vercel (Recommended)
Zero-configuration deployment for Next.js apps:
```bash
# Install Vercel CLI
npm install -g vercel
# Deploy
vercel
# Production deployment
vercel --prod
```
**Features:**
- Automatic builds on git push
- Edge functions support
- Built-in analytics
- Custom domains
### π Netlify
Great for static and hybrid apps:
```bash
# Build for deployment
npm run build
# Deploy to Netlify
netlify deploy --prod --dir=.next
```
### π΅ Docker
For containerized deployment, add a Dockerfile to your scaffolded project:
```dockerfile
# Example Dockerfile (add to your project after scaffolding)
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]
```
```bash
# Build and run
docker build -t my-starkon-app .
docker run -p 3000:3000 my-starkon-app
```
**Note:** Dockerfile is not included in the Starkon CLI package itself. Add it to your scaffolded project as needed.
### βοΈ Other Platforms
- **Railway:** `railway deploy`
- **Render:** Connect GitHub repository
- **AWS Amplify:** Push to connected git branch
- **Google Cloud:** `gcloud app deploy`
## βοΈ Configuration
### Environment Variables
Create `.env.local` in your project root:
```env
# API Configuration
NEXT_PUBLIC_API_URL=http://localhost:3001/api
NODE_ENV=development
# Authentication (Standard & Dashboard templates)
NEXTAUTH_SECRET=your-secret-key-here-change-in-production
NEXTAUTH_URL=http://localhost:3000
# Database (if using)
DATABASE_URL=postgresql://user:pass@localhost:5432/db
# Analytics (optional)
NEXT_PUBLIC_GA_ID=G-XXXXXXXXXX
# App Configuration
NEXT_PUBLIC_APP_NAME=My Starkon App
NEXT_PUBLIC_APP_URL=http://localhost:3000
```
### User Configuration
CLI configuration stored in `~/.starkon/config.json`:
```json
{
"defaultTemplate": "corporate",
"preferredPackageManager": "pnpm",
"locale": "en",
"skipGit": false,
"skipUpdateCheck": false,
"telemetryEnabled": true
}
```
## π§ͺ Testing
### Running Tests
```bash
npm test # Run all tests
npm run test:watch # Watch mode
npm run test:coverage # Coverage report
```
### Writing Tests
```tsx
import { render, screen } from '@testing-library/react'
import { Button } from '@/components/core/button'
test('Button renders correctly', () => {
render(<Button>Click me</Button>)
expect(screen.getByRole('button')).toHaveTextContent('Click me')
})
```
## π¨ Customization
### Theme System
Customize your brand colors in `tailwind.config.mjs`:
```tsx
// tailwind.config.mjs
export default {
theme: {
extend: {
colors: {
primary: {
50: 'hsl(210 40% 98%)',
100: 'hsl(210 40% 96%)',
// ... your brand colors
},
},
animation: {
'fade-in': 'fadeIn 0.5s ease-in-out',
'slide-in': 'slideIn 0.3s ease-out',
// ... custom animations
},
},
},
}
```
### Component Variants
Using class-variance-authority for type-safe variants:
```tsx
// Custom component with variants
import { cva } from 'class-variance-authority'
import { cn } from '@/lib/utils'
const buttonVariants = cva('base-styles', {
variants: {
variant: {
default: 'bg-primary text-white',
outline: 'border border-primary text-primary',
ghost: 'hover:bg-accent',
},
size: {
sm: 'px-3 py-1.5 text-sm',
lg: 'px-6 py-3 text-lg',
},
},
defaultVariants: {
variant: 'default',
size: 'default',
},
})
export function CustomButton({ variant, size, className, ...props }) {
return <button className={cn(buttonVariants({ variant, size }), className)} {...props} />
}
```
### Dark Mode
Theme switching with system preference detection:
```tsx
import { useTheme } from '@/hooks/useTheme'
function ThemeToggle() {
const { theme, setTheme } = useTheme()
return <button onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}>Toggle Theme</button>
}
```
## π Available Scripts
### Development
```bash
npm run dev # Next.js development server (Turbo mode)
npm run build # Production build
npm run start # Production server
npm run analyze # Bundle analyzer (set ANALYZE=true)
```
### Code Quality
```bash
npm run lint # ESLint check
npm run type-check # TypeScript validation
npm run prettier # Code formatting
npm run prettier:check # Check formatting only
```
### Testing
```bash
npm test # Jest test runner
npm run test:watch # Watch mode testing
npm run test:coverage # Generate coverage report
```
### Package Management (for contributors)
```bash
npm run build:lib # Build CLI with tsup
npm run commit # Commitizen conventional commits
npm run release # Release management with release-it
npm run prepare # Husky git hooks setup
```
## π Migration Guide
### From Create Next App
```bash
# 1. Create Starkon project
npx starkon my-app --template basic
# 2. Copy your existing code
cp -r old-project/src/app/* new-project/src/app/
cp -r old-project/components/* new-project/src/components/
# 3. Update imports
# Change: import { Button } from '../components/Button'
# To: import { Button } from '@/components/core/button'
# 4. Install your additional dependencies
cd new-project
npm install your-packages
```
### From Other Boilerplates
1. **Extract your custom components** to `src/components/`
2. **Move API logic** to `src/lib/services/`
3. **Update styling** to use Tailwind classes
4. **Add TypeScript types** in `src/lib/types/`
5. **Integrate with providers** in `src/providers/`
### Migrating Authentication
If you have existing auth:
1. Review Starkon's JWT flow in `src/lib/services/authApiService.ts`
2. Replace mock service with your API endpoints
3. Update token structure in `sessionTokenManager.ts`
4. Modify `AuthProvider.tsx` for your auth logic
## π€ Contributing
We welcome contributions to make Starkon even better!
### Development Setup
```bash
# Clone repository
git clone https://github.com/zzafergok/starkon.git
cd starkon
# Install dependencies
npm install
# Start development
npm run dev
# Run tests
npm test
# Build CLI
npm run build:lib
```
### Creating New Templates
```bash
# 1. Add template to index.js TEMPLATES object
# 2. Define excludeFiles array (exclusion-based system)
# 3. Test template generation
npx starkon test-app --template your-template
# 4. Update README.md with template documentation
# 5. Submit PR
```
### Guidelines
- **Code Quality:** Follow ESLint and Prettier rules
- **Testing:** Add tests for new features
- **Documentation:** Update README for new features
- **TypeScript:** Maintain full type safety
- **Conventional Commits:** Use `npm run commit` for commits
## π Performance
### Bundle Analysis
```bash
# Analyze your build
ANALYZE=true npm run build
# Opens webpack-bundle-analyzer in browser
```
### Optimization Features
- **Automatic Code Splitting** - Route-based splitting
- **Image Optimization** - Next.js Image component
- **Font Optimization** - Google Fonts optimization
- **Static Generation** - ISG and SSG support
- **Edge Runtime** - Faster cold starts
- **React Server Components** - Reduced client bundle
## π οΈ Troubleshooting
### Common Issues
**Build Errors:**
```bash
# Clear Next.js cache
rm -rf .next
# Clear npm cache
npm cache clean --force
# Reinstall dependencies
rm -rf node_modules package-lock.json
npm install
```
**TypeScript Errors:**
```bash
# Check types without building
npm run type-check
# Clear TypeScript cache
rm -rf node_modules/.cache
```
**Authentication Issues:**
```bash
# Check token in browser storage
# DevTools -> Application -> Session Storage -> tokens
# Clear all auth data
localStorage.clear()
sessionStorage.clear()
```
**i18n Not Working:**
```bash
# Check language detection priority:
# 1. localStorage 'language' key
# 2. Cookie 'language' key
# 3. URL parameter ?lang=en
# 4. Browser navigator.language
# 5. Default: 'tr'
# Force language
localStorage.setItem('language', 'en')
```
**Component Not Found:**
```bash
# Check import path uses @ alias
import { Button } from '@/components/core/button' # β
Correct
import { Button } from '../components/core/button' # β Wrong
# Verify tsconfig.json has paths configured:
# "@/*": ["./src/*"]
```
### Getting Help
- π **Bug Reports:** [GitHub Issues](https://github.com/zzafergok/starkon/issues)
- π¬ **Questions:** [Discussions](https://github.com/zzafergok/starkon/discussions)
- π§ **Contact:** [zafer@starkon.website](mailto:zafer@starkon.website)
- π **Documentation:** [CLAUDE.md](CLAUDE.md) (for development)
## π License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## π Acknowledgments
**Core Technologies:**
- **[Next.js](https://nextjs.org/)** - The React framework for production
- **[Radix UI](https://www.radix-ui.com/)** - Low-level accessible UI primitives
- **[Tailwind CSS](https://tailwindcss.com/)** - Utility-first CSS framework
- **[React Query](https://tanstack.com/query)** - Powerful data synchronization
- **[Zustand](https://zustand-demo.pmnd.rs/)** - Lightweight state management
**Inspiration:**
- **[shadcn/ui](https://ui.shadcn.com/)** - Component design patterns
- **[T3 Stack](https://create.t3.gg/)** - TypeScript-first development
- **[Vercel Templates](https://vercel.com/templates)** - Deployment optimization
---
<div align="center">
### π Ready to Build Something Amazing?
**[Get Started](https://github.com/zzafergok/starkon#quick-start) β’ [View Examples](https://starkon.website) β’ [Read Docs](https://github.com/zzafergok/starkon/wiki)**
Made with β€οΈ by [Zafer GΓΆk](https://github.com/zzafergok)
β **If Starkon helped you ship faster, please give us a star on GitHub!**
</div>
---
## π Stats
- π¨ **46 UI Components** ready to use
- π **Complete Auth System** with JWT tokens & 5 auth flows
- π **2 Languages** supported (English, Turkish) with easy expansion
- π± **6 Templates** (3 interactive + 3 manual selection)
- πͺ **7 Custom Hooks** for common patterns
- π **5 Providers** for app-wide state management
- β‘ **Interactive CLI** with arrow key navigation
- π **< 30 seconds** from CLI to running app
- π οΈ **Production Ready** - no additional setup needed
- π¦ **React 19** & **Next.js 16** - Latest versions