Skip to main content
This covers basic project settings in sonamu.config.ts. You can configure project name, API paths, timezone, internationalization support, and more.

Basic Structure

projectName

Defines the name of the project. Displayed in logs, error messages, Sonamu UI, etc. Type: string (optional) Default: SonamuProject if not set

Usage Example

Setting via environment variable:
Use environment variables to have different project names per environment (e.g., MyProject-Dev, MyProject-Prod).

api Settings

Defines basic API-related settings.

api.dir

The directory name where API code is located. Type: string Default: "api"
Most projects use "api" as is. Keep the default unless there’s a specific reason to change it.

api.route.prefix

Sets the common prefix for all API endpoints. Type: string Default: "/api"
Example: With prefix: "/api":
  • UserModel.listGET /api/user/list
  • PostModel.detailGET /api/post/detail
  • OrderModel.createPOST /api/order/create
Changing the prefix will also update the generated Service code on the frontend. Therefore, it’s recommended to only change this early in the project.
Other prefix examples:

api.timezone

Sets the server’s default timezone. Affects date/time processing. Type: string (optional) Default: System default
Supported timezone format: IANA Time Zone Database Common timezone examples:
  • "Asia/Seoul" - Korea
  • "America/New_York" - US Eastern
  • "Europe/London" - UK
  • "Asia/Tokyo" - Japan
  • "UTC" - Coordinated Universal Time
For global services, it’s recommended to use "UTC" and convert to user timezone on the client.

i18n Settings

Internationalization (i18n) settings for multilingual support. Type: SonamuI18nOptions (optional)

Basic Configuration

defaultLocale

Sets the default language. Serves two roles:
  1. Key definition basis: The language used as the standard when writing Entity’s label, enumLabel, etc.
  2. Runtime default: The language to use when the user doesn’t specify a locale

supportedLocales

List of all languages to support. Must include defaultLocale.
An error will occur if defaultLocale is not included in supportedLocales.

Disabling i18n

If you don’t need multilingual support, simply omit the i18n setting:

Practical Examples

Basic Project Configuration

Using Environment Variables

Global Service

Next Steps

After completing basic project settings, proceed with these configurations:
  • database - Database connection settings
  • server - Server options and plugin settings
  • sync-targets - Frontend synchronization target settings