A modern Next.js 16.0.1 application template featuring authentication with Better Auth and database management with Drizzle ORM. Built with TypeScript, Tailwind CSS, and shadcn/ui components.
- Authentication System: Complete auth flow with register/login forms
- Better Auth Integration: Server-side authentication with session management
- Internationalization (i18n): Multi-language support with English and Slovak
- Theme System: Dark/light/system theme support with persistent preferences
- Drizzle ORM: Type-safe database operations with SQLite
- Modern UI: Built with shadcn/ui components and Tailwind CSS
- TypeScript: Full type safety throughout the application
- Form Validation: Client-side form handling with error preservation
- Responsive Design: Mobile-first responsive layout
- Framework: Next.js 16.0.1 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS v4
- UI Components: shadcn/ui
- Database: SQLite with Drizzle ORM
- Authentication: Better Auth
- Internationalization: next-intl
- Theme Management: next-themes
- Package Manager: pnpm
- Node.js 18+
- pnpm (recommended) or npm/yarn
git clone <repository-url>
cd atriumpnpm install# Generate database schema
pnpm db:generate
# Run migrations
pnpm db:migratepnpm devOpen http://localhost:3000 with your browser to see the result.
atrium/
βββ app/ # Next.js app directory
β βββ [locale]/ # Localized routes (en, sk)
β β βββ auth/ # Authentication pages
β β βββ dashboard/ # Protected dashboard page
β β βββ layout.tsx # Locale layout
β β βββ page.tsx # Localized home page
β βββ i18n/ # Internationalization config
β β βββ navigation.ts # next-intl navigation
β β βββ request.ts # next-intl request config
β β βββ routing.ts # Locale routing config
β βββ messages/ # Translation files
β β βββ en.json # English translations
β β βββ sk.json # Slovak translations
β βββ api/auth/ # Better Auth API routes
β βββ actions.ts # Server actions
β βββ layout.tsx # Root layout with theme & language switchers
β βββ page.tsx # Home page
βββ components/ # React components
β βββ language-selector.tsx # Language switcher component
β βββ theme-provider.tsx # Theme system components
β βββ ui/ # shadcn/ui components
βββ proxy.ts # Next.js 16 proxy (middleware)
βββ db/ # Database configuration
β βββ drizzle/ # Migration files
β βββ schema/ # Database schemas
β βββ index.ts # Database instance
βββ lib/ # Utility libraries
β βββ auth.ts # Better Auth server config
β βββ auth-client.ts # Better Auth client config
β βββ utils.ts # Utility functions
βββ public/ # Static assets
The application includes a comprehensive theme system with dark/light/system theme support:
- ThemeProvider: Wraps the application with theme context
- ModeToggle: Dropdown button for theme switching in the header
- Persistent Storage: Theme preference is saved in localStorage
The theme switcher is automatically available in the top-right corner of all pages. Users can choose between:
- Light: Always use light theme
- Dark: Always use dark theme
- System: Follow system preference (default)
// Theme provider setup in layout.tsx
<ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
{children}
</ThemeProvider>
// Using theme in components
import { useTheme } from "next-themes"
const { setTheme } = useTheme()The application supports multiple languages with next-intl:
- English (en): Default language
- Slovak (sk): Secondary language
- LanguageSelector: Dropdown button for language switching in the header
- Routing: Automatic locale-based routing (
/en/*,/sk/*) - Translations: Organized by page in JSON files
app/messages/
βββ en.json # English translations
βββ sk.json # Slovak translations
The language switcher is available in the top-right corner next to the theme toggle. When users switch languages:
- Current page content is translated
- URL is updated with locale prefix (except for default English)
- Language preference is maintained during navigation
To add new translations:
- Update both
en.jsonandsk.jsonfiles - Use translation keys in components:
// Server components
const t = await getTranslations("home")
<h1>{t("title")}</h1>
// Client components
const t = useTranslations("auth")
<button>{t("signIn")}</button>- Add locale to
app/i18n/routing.ts - Create new translation file in
app/messages/ - Update middleware matcher if needed
This template includes a complete authentication system with:
- Registration: User sign-up with email, name, and password
- Login: Secure user authentication
- Session Management: Server-side session handling
- Protected Routes: Dashboard accessible only to authenticated users
- Form Validation: Client-side validation with error preservation
- Users visit
/and see the landing page - Click "Login / Register" to navigate to
/auth - Register a new account or sign in with existing credentials
- Successfully authenticated users are redirected to
/dashboard - Users can log out from the dashboard or main page
The application uses the following main tables:
user: User account informationsession: Authentication sessionsaccount: OAuth account connectionsverification: Email verification tokens
# Generate new migration
pnpm db:generate
# Apply migrations
pnpm db:migrate
# Open database studio
pnpm db:studioThis template uses shadcn/ui components for a modern, accessible interface:
- Forms with validation
- Tabs for auth switching
- Cards for layout
- Alerts for error messages
- Buttons with loading states
pnpm dev- Start development serverpnpm build- Build for productionpnpm start- Start production serverpnpm lint- Run Biome linterpnpm format- Format code with Biomepnpm db:generate- Generate database migrationspnpm db:migrate- Run database migrationspnpm db:studio- Open Drizzle Studio
Create a .env.local file in the root directory:
NEXT_PUBLIC_BETTER_AUTH_URL=http://localhost:3000The authentication system is configured in lib/auth.ts with:
- Email/password authentication
- SQLite database adapter
- Session management with cookies
- Admin plugin support
Database settings are in drizzle.config.ts:
- SQLite database file location
- Migration directory
- Schema configuration
- Push your code to GitHub
- Connect your repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy automatically
Ensure your platform supports:
- Node.js 18+
- SQLite database or configure for PostgreSQL/MySQL
- Environment variables for Better Auth
- Next.js Documentation - Learn about Next.js features
- Better Auth Documentation - Authentication setup
- next-intl Documentation - Internationalization
- next-themes Documentation - Theme management
- Drizzle ORM Documentation - Database operations
- shadcn/ui Documentation - UI components
- Tailwind CSS Documentation - Styling
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.