CodeBaseHub

Features

Explore all the features included in CodeBaseHub starter kit

Authentication & Security

CodeBaseHub includes a complete authentication system powered by Better Auth, supporting multiple authentication methods and security features.

Email/Password Authentication

Secure user registration and login with email verification:

lib/auth.ts
import { authClient } from "@/lib/auth-client";

// Sign up
await authClient.signUp.email({
  email: "user@example.com",
  password: "secure-password",
  name: "John Doe",
});

// Sign in
await authClient.signIn.email({
  email: "user@example.com",
  password: "secure-password",
});

Features:

  • Bcrypt password hashing
  • Email verification
  • Password reset flow
  • Session management

OAuth Authentication

Sign in with popular OAuth providers:

components/oauth-login.tsx
// Sign in with OAuth providers
await authClient.signIn.social({
  provider: "github",
  callbackURL: "/dashboard",
});

Supported providers:

  • GitHub
  • Google
  • Discord
  • Easy to add more providers

Two-Factor Authentication

Enhanced security with TOTP-based 2FA:

// Enable 2FA
await authClient.twoFactor.enable({
  password: "user-password",
});

// Verify 2FA code
await authClient.twoFactor.verify({
  code: "123456",
});

Features:

  • TOTP-based authentication
  • QR code generation
  • Backup codes
  • Optional per user

All authentication routes are protected with CSRF tokens and secure session management.


Internationalization (i18n)

Built-in support for multiple languages with next-intl, making it easy to reach a global audience.

Globe

Multi-language Support

English, Turkish, and Arabic with easy expansion to more languages.

Code

RTL Support

Automatic right-to-left layout for Arabic and other RTL languages.

FileCode

Type-safe Translations

Fully typed translations with TypeScript autocomplete.

Usage Example

components/welcome.tsx
import { useTranslations } from 'next-intl';

export function MyComponent() {
  const t = useTranslations('common');
  return (
    <div>
      <h1>{t('welcome.title')}</h1>
      <p>{t('welcome.description')}</p>
    </div>
  );
}
app/[locale]/page.tsx
import { getTranslations } from 'next-intl/server';

export default async function Page() {
  const t = await getTranslations('common');

  return <h1>{t('welcome.title')}</h1>;
}
components/language-switcher.tsx
import { useLocale } from 'next-intl';
import { useRouter } from 'next/navigation';

export function LanguageSwitcher() {
  const locale = useLocale();
  const router = useRouter();

  const changeLanguage = (newLocale: string) => {
    router.push(`/${newLocale}`);
  };

  return (
    <select value={locale} onChange={(e) => changeLanguage(e.target.value)}>
      <option value="en">English</option>
      <option value="tr">Türkçe</option>
      <option value="ar">العربية</option>
    </select>
  );
}

User Interface

Modern, accessible UI components built with shadcn/ui and Tailwind CSS.

Example Usage

components/example.tsx
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";

export function Example() {
  return (
    <Card>
      <CardHeader>
        <CardTitle>Example Card</CardTitle>
      </CardHeader>
      <CardContent>
        <Button variant="default">Click me</Button>
      </CardContent>
    </Card>
  );
}

Database & ORM

PostgreSQL database with Drizzle ORM for type-safe database queries.

Define Schema

lib/schema.ts
import { pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";

export const users = pgTable("users", {
  id: uuid("id").defaultRandom().primaryKey(),
  email: text("email").notNull().unique(),
  name: text("name").notNull(),
  createdAt: timestamp("created_at").defaultNow().notNull(),
});

Query Data

lib/queries.ts
import { db } from "@/lib/db";
import { users } from "@/lib/schema";
import { eq } from "drizzle-orm";

const user = await db.query.users.findFirst({
  where: eq(users.email, "user@example.com"),
});

Run Migrations

# Generate migration
pnpm db:generate

# Apply migration
pnpm db:migrate

Additional Features

Settings

Theme System

Beautiful dark mode support with automatic system preference detection.

Blocks

Dashboard

Full-featured admin panel with user management and analytics.

BookOpen

Documentation

Built-in documentation system powered by Fumadocs.

Zap

Code Quality

Biome, TypeScript, and ESLint configured for consistent code style.

Box

Monorepo

Organized workspace structure with Turborepo for efficient builds.

Smartphone

Desktop App

Build native desktop apps with Tauri integration.

All features are production-ready and follow industry best practices.

Was this page helpful?
Features | CodeBaseHub