Skip to content

Naming conventions

Consistent naming across repositories, Azure resources, Terraform identifiers, and code. These conventions are mandatory -- all new resources must follow them.

Repositories

Pattern Example Notes
jersal-projects-core Core infrastructure + hub Singular, hyphenated
jersal-project-template Project template Singular, hyphenated
<project-name> menuloft Lowercase, standalone name

Azure resources

Naming formula

Every Azure resource follows a strict pattern:

{resource_prefix}-{org}-{purpose}-{region_code}
Segment Description Examples
resource_prefix Azure resource type abbreviation (see table below) rg, swa, st, psql
org Organization identifier jersal
purpose What the resource is for site, hub, projects-shared
region_code Short region code (see region codes) sc, we

Strict enforcement

Do not invent new naming patterns. Every new Azure resource must use this formula. If an existing resource doesn't match (legacy), document the deviation and plan migration.

Resource type prefixes

Prefix Azure resource type Hyphens allowed
rg Resource Group Yes
swa Static Web App Yes
st Storage Account No (Azure constraint: alphanumeric only, 3-24 chars)
psql PostgreSQL Flexible Server Yes
kv Key Vault Yes
appi Application Insights Yes
log Log Analytics Workspace Yes
plan App Service Plan Yes
app App Service / Function App Yes
cr Container Registry No (alphanumeric only)
vnet Virtual Network Yes
nsg Network Security Group Yes

Region codes

Code Azure region Use case
sc swedencentral Primary region for compute, databases
we westeurope Static Web Apps (SWA doesn't support swedencentral)

Adding regions

If a new region is needed, add it to this table and update terraform/envs/*/variables.tf with the new region code.

Canonical resource inventory

All currently deployed resources and their names:

Resource Name Resource Group Region Purpose
Resource Group rg-jersal-projects-shared -- swedencentral Shared infrastructure
Resource Group rg-jersal-site-sc -- swedencentral Portfolio site + hub SWAs
Storage Account stjersalprojcore rg-jersal-projects-shared swedencentral Shared Terraform state backend
Storage Account stjersalprojcoresite rg-jersal-site-sc swedencentral Site Terraform state backend
PostgreSQL jersalprojectssharedsc rg-jersal-projects-shared swedencentral Shared database server
Static Web App swa-jersal-site-sc rg-jersal-site-sc westeurope Portfolio site (jersal.net)
Static Web App swa-jersal-hub-sc rg-jersal-site-sc westeurope Documentation hub (hub.jersal.net)

Storage account naming

Storage accounts cannot contain hyphens. The pattern is st{org}{purpose}{scope} with all parts concatenated: stjersalprojcore, stjersalprojcoresite. Keep names under 24 characters.

Examples for new resources

When creating new resources, apply the formula:

Scenario Name
New project SWA for MenuLoft swa-jersal-menuloft-sc
Key Vault for shared secrets kv-jersal-shared-sc
App Service for MenuLoft API app-jersal-menuloft-sc
Container Registry (shared) crjersalsharedsc
New resource group for MenuLoft rg-jersal-menuloft-sc

Rules summary

  1. Always use the resource type prefix from the table above
  2. Always include jersal as the organization segment
  3. Always append the region code unless the resource is global
  4. Lowercase only -- no uppercase unless Azure requires it
  5. Hyphens as separators except for resource types that forbid them (storage accounts, container registries)
  6. No abbreviations in the purpose segment unless the full name exceeds Azure's character limit

Terraform

Identifiers

Type Convention Example
Resources snake_case, internal name this azurerm_resource_group.this
Variables snake_case subscription_id, admin_login
Outputs snake_case server_fqdn, database_names
Modules snake_case module.postgres, module.swa
Locals snake_case local.tags
Files Lowercase main.tf, variables.tf, outputs.tf

Module structure

Every Terraform module and environment follows the same file layout:

module-or-env/
├── main.tf          # Resources and module calls
├── variables.tf     # Input variables
├── outputs.tf       # Output values
└── backend.hcl      # (environments only) Partial backend config

Resource naming in modules

  • Modules accept the full resource name as a variable (e.g., var.name)
  • Names are not composed inside modules -- the calling environment is responsible for passing the correctly-formatted name
  • This keeps modules reusable while enforcing naming at the environment level

Tags

All resources must carry the standard tag set:

locals {
  tags = {
    env     = var.env           # e.g., "prod"
    project = var.name_prefix   # e.g., "jersal-projects"
    region  = var.region_code   # e.g., "sc"
  }
}

Code

TypeScript / JavaScript

Type Convention Example
Variables camelCase serverName, isActive
Functions camelCase getProjects, handleClick
Classes PascalCase MenuService, UserRepository
Constants UPPER_SNAKE_CASE MAX_RETRIES, API_BASE_URL
Files kebab-case menu-service.ts, user-repo.ts
Interfaces/Types PascalCase ProjectConfig, UserProfile
Enums PascalCase (members PascalCase) UserRole.Admin

CSS

Type Convention Example
Classes Tailwind utilities or kebab-case text-lg, card-header
Custom properties --kebab-case --primary-color

Git

Type Convention Example
Branch names <type>/<short-description> feature/user-auth, fix/null-response
Commit messages Conventional Commits feat(auth): add login endpoint
Branch types feature/, fix/, chore/, docs/, refactor/, test/ --