0%
balqalam Logo
balqalam
FeaturesCommunityPricingDocumentation
Login
  • Introduction
  • Pitch
  • Hogwarts
  • Live Demo
  • MVP
  • Roadmap
  • Launch Sprint
  • PRD
  • Get Started
  • Localhost
  • Architecture
  • Structure
  • Pattern
  • Page
  • Layout
  • Content
  • Types
  • Config
  • Actions
  • Queries
  • Authorization
  • Validation
  • Form
  • Table
  • Detail
  • Card
  • Util
  • Hooks
  • List Params
  • Views
  • README.md
  • ISSUE.md
  • Technology Stack
  • Database
  • File
  • CDN Assets
  • Entry Points
  • Dashboard
  • Authentication
  • Credentials
  • OAuth
  • Flow Diagrams
  • Multi-Tenancy
  • Offline
  • Onboarding
  • Onboarding Videos
  • Add Values
  • Admission
  • Application
  • Attendance
  • Compliance
  • Profile
  • Exams
  • Exam Wizard
  • Timetable
  • Classrooms
  • Notifications
  • Conference
  • LMS (Lumos)
Finance
  • Finance
  • Fee Management
  • Invoice
  • Wallet
  • Salary
  • Payroll
  • Timesheet
  • Expenses
  • Budget
  • Receipt
  • Accounts
  • Banking
  • Reports
  • Dashboard
  • Permissions
  • Messages
  • Integration Flow
  • Provision
  • AI Document Processing
  • Document Intelligence
  • Internationalization
  • Translation
  • Translation Guide
  • Icons
  • Docs Factory
  • Inspiration
  • Listings
  • Teachers
  • Students
  • Catalog
  • Library
  • Contributing
  • Code of conduct
  • GitHub Workflow
  • Database Seeds
  • Database Safety
  • Test Accounts
  • Playwright
  • Prettier
  • Block Rebound
Sales & GTM
  • Marketing Brief
  • Sales
  • Go-to-market
  • Marketing
  • Admission — Feature Spotlight
  • Pilot Program
  • Leads
  • Proposal
  • Outreach Templates
  • Case Study
  • Competitors
  • Landing-page teardown
  • Competitor FAQ
  • Business model
  • Shared economy
  • Traction
Fundraising & Ecosystem
  • Get Support
  • Investor Deck
  • Data Room
  • Investors
  • Accelerators
  • Incubators
  • Grants
  • Sponsors
  • Partners
  • Competitions & Hackathons
  • Universities & Training Centers

Config

PreviousNext

Pure data — option arrays, labels, defaults, and metadata for a feature.

config.ts holds enum option arrays, labels, defaults, and metadata. Pure data — no functions, no Prisma imports, no React.

Categories

CategoryShapeReference
Form step definitionsSTEPS, STEP_FIELDS, TOTAL_FIELDS for wizardslistings/teachers/config.ts
Constants with labelsOption arrays, status badges, color mapssaas-dashboard/tenants/config.ts
Navigation mapsSidebar / header / footer items with RBACtemplate/platform-sidebar/config.ts
Feature-rich domainLimits, rules, defaultsschool-dashboard/dashboard/config.ts
InfrastructureFramework configs (Next, NextAuth, AI)auth.config.ts, next.config.ts

Rules

#Rule
1as const for literal type inference
2Named exports only (NextAuth's auth.config.ts is the framework exception)
3No circular imports — lift shared shapes to src/lib/config/
4No utility functions — formatFileSize() belongs in util.ts
5No type definitions — types belong in types.ts
6No raw process.env — read via @/env.mjs
7Stay under ~300 lines — split when bloated

Canonical example

import type { Prisma } from "@prisma/client"
 
export const GENDER_OPTIONS = [
  { value: "MALE", label: "Male" },
  { value: "FEMALE", label: "Female" },
] as const
 
export const STATUS_OPTIONS = [
  { value: "ACTIVE", label: "Active", variant: "default" },
  { value: "TRANSFERRED", label: "Transferred", variant: "secondary" },
  { value: "GRADUATED", label: "Graduated", variant: "success" },
] as const
 
export const PAGE_SIZE_OPTIONS = [10, 20, 50, 100] as const
 
export const DEFAULT_FILTERS: Prisma.StudentWhereInput = { active: true }

i18n

Configs hold values; the dictionary owns translation. UI looks up the translated label using the value as a key:

const genderLabel =
  dictionary.school.students.gender[option.value] ?? option.label

Anti-patterns

  • GENDER_OPTIONS redefined (4 files) with inconsistent values — lift to src/lib/config/options.ts.
  • PAGE_SIZE_OPTIONS redefined (5+ files) — same fix.
  • MAX_FILE_SIZE redefined (7+ files) — use SIZE_LIMITS from file/config.ts.
  • Role type redefined — import from @prisma/client.
  • Utility functions (formatFileSize) — move to util.ts.
  • Types in config (PlatformNavItem) — move to types.ts.
  • Raw process.env — read via @/env.mjs.
  • Empty config files — delete or fill.
  • Bloated files (dashboard/config.ts 485 lines) — split by concept.
  • English-only labels — UI looks up via dictionary.

Naming

  • File: config.ts.
  • Primitives: UPPER_SNAKE_CASE. Object literals: camelCase.
  • One concept per export.

See also

  • Pattern
  • Types
  • Util
  • Validation
TypesActions

On This Page

CategoriesRulesCanonical examplei18nAnti-patternsNamingSee also

Built by Databayt ·

Welcome to balqalam.

A great journey is about to begin.