Configuration
Configure CodeBaseHub settings for web and mobile apps
Configuration
Single config file manages both web and mobile app settings.
Main Config File
Location: packages/config/index.ts
export const config: Config = {
name: "CodeBaseHub",
description: "A modern full-stack starter kit for building web and mobile app",
author: "Your Name",
keywords: ["typescript", "react native", "nextjs", "trpc", "better-auth"],
url: "https://your-app-domain.com",
mail: {
fromAddress: "noreply@yourapp.com",
},
i18n: {
defaultLocale: "en",
locales: ["en", "tr", "ar"],
metadata: {
en: { name: "English", nativeName: "English", flag: "🇺🇸", rtl: false },
tr: { name: "Turkish", nativeName: "Türkçe", flag: "🇹🇷", rtl: false },
ar: { name: "Arabic", nativeName: "العربية", flag: "🇸🇦", rtl: true },
},
},
platforms: {
web: {
auth: { signupEnabled: true, socialLoginEnabled: true },
ui: { defaultTheme: "light" },
notifications: {
oneSignal: {
appId: "your-onesignal-web-app-id",
allowLocalhostAsSecureOrigin: true,
},
},
},
native: {
auth: { signupEnabled: true, socialLoginEnabled: false },
ui: { defaultTheme: "light" },
notifications: {
oneSignal: { appId: "your-onesignal-mobile-app-id" },
},
},
},
};
Using Config
// In any package or app
import { config } from "@repo/config";
// App metadata
const appName = config.name;
const description = config.description;
// Platform-specific settings
const webAuth = config.platforms.web.auth;
const mobileAuth = config.platforms.native.auth;
// i18n settings
const supportedLanguages = config.i18n.locales;
const defaultLanguage = config.i18n.defaultLocale;
Environment-Based Config
const isDevelopment = process.env.NODE_ENV === 'development';
export const config: Config = {
name: isDevelopment ? "CodeBaseHub (Dev)" : "CodeBaseHub",
url: isDevelopment ? "http://localhost:3001" : "https://your-domain.com",
platforms: {
web: {
notifications: {
oneSignal: {
appId: isDevelopment ? "dev-app-id" : "prod-app-id",
allowLocalhostAsSecureOrigin: isDevelopment,
},
},
},
},
};
Adding New Languages
- Update type:
export type Locale = "en" | "tr" | "ar" | "fr";
- Add to config:
locales: ["en", "tr", "ar", "fr"]
- Add metadata and create translation file
Type Safety
All config is fully typed with TypeScript for auto-completion and error checking.