Skip to content

Fooj Architecture

Section: 17 — Fooj
Last Updated: 2026-05-30
Scope: System components, ACA layout, networking, data layer


Component Overview


Services

Fooj.Apis (.NET 8)

The single backend API service for all Fooj operations.

PropertyValue
Technology.NET 8, Clean Architecture, CQRS with MediatR
PatternSame as ERP microservices — just one service
AuthJWT from Keycloak (standard, no ERP dual-token complexity)
DatabaseAzure SQL PaaS via EF Core
CacheAzure Redis
Swagger/swagger (disabled in production)
Port8080 (internal)

Since Fooj is not multi-tenant, there is no ITenantProvider or tenant connection string resolution. The single Azure SQL database serves all users.

Angular 18 SSR (Customer-Facing Site)

PropertyValue
TechnologyAngular 18 with Server-Side Rendering
HostingAzure Container Apps (Node.js/Nginx container)
Domainwww.fooj.sa (prod), staging.fooj.sa (stage)
PurposeCustomer-facing website with SEO-optimized SSR

SSR is critical for Fooj because the customer-facing pages need to be indexable by search engines.

Angular 18 Admin

PropertyValue
TechnologyAngular 18 (standard SPA, no SSR)
HostingAzure Container Apps (Nginx static)
Domainadmin.fooj.sa (prod), admin-staging.fooj.sa (stage)
PurposeInternal management portal for Fooj operations team

Keycloak

PropertyValue
Version24.x
DeploymentAzure Container Apps
Realmfooj (single realm, no multi-realm complexity)
Domainauth.fooj.sa (prod), auth-staging.fooj.sa (stage)
DatabaseAzure SQL (same PaaS instance, separate database)

Azure Container Apps Layout

Unlike ERP (which has separate public/private CAEs), Fooj uses a single shared CAE per environment.

Fooj Stage CAE: fooj-stage-cae
├── fooj-apis          (backend)
├── fooj-keycloak      (auth)
├── fooj-ssr           (customer site)
└── fooj-admin         (admin portal)

Fooj Prod CAE: fooj-prod-cae
├── fooj-apis
├── fooj-keycloak
├── fooj-ssr
└── fooj-admin

All services in the CAE communicate via internal DNS (VNet-integrated CAE):

fooj-apis.fooj-stage-cae.internal
fooj-keycloak.fooj-stage-cae.internal

Scaling Configuration

ServiceMin ReplicasMax ReplicasScale Trigger
fooj-apis0 (stage), 1 (prod)5HTTP queue depth
fooj-keycloak12HTTP
fooj-ssr0 (stage), 1 (prod)3HTTP
fooj-admin01HTTP

Stage scales to zero when idle — contributes to the lower ~$40/mo cost.


Networking

VNet

PropertyValue
VNet CIDR10.20.0.0/16
Stage subnet10.20.1.0/24
Production subnet10.20.2.0/24
NAT Gateway IP20.26.0.39 (shared, see shared-egress.md)

DNS Resolution

All fooj.sa DNS is managed in Azure DNS:

RecordTypeValue
www.fooj.saCNAMEACA ingress FQDN
api.fooj.saCNAMEACA ingress FQDN
auth.fooj.saCNAMEACA ingress FQDN
admin.fooj.saCNAMEACA ingress FQDN
(stage equivalents)CNAMEStage ACA FQDN

Data Layer

Azure SQL PaaS

Unlike ERP (which uses a SQL Server VM), Fooj uses Azure SQL Database PaaS.

PropertyStageProduction
TierBasic / S0General Purpose
vCores— (DTU-based)2
Storage2 GB32 GB
Backup7-day LTR35-day LTR
HALRSGeo-redundant

Benefits over VM:

  • Automatic patching and updates
  • Built-in HA and failover
  • No SSH/VM management
  • Automated backups

Azure Cache for Redis

PropertyStageProduction
TierC0 BasicC1 Standard
Memory250 MB1 GB
SSLRequiredRequired
HANoYes (replicated)

Used for:

  • Session caching
  • API response caching
  • Distributed locks

Authentication Architecture

Fooj uses a simplified auth model compared to ERP — no dual-token, no multi-realm, no company/branch selection.

Keycloak Realm Configuration

Realmfooj
Clientsfooj-web (SSR), fooj-admin
Token lifetime30 minutes
Refresh token8 hours
Custom claimsfooj_role (customer / operator / admin)
No custom SPIsStandard Keycloak only

CI/CD

Fooj uses the same Azure DevOps organization but a separate pipeline:

Pipeline:      Devops/fooj/azure-pipelines.yml
Trigger:       Changes to Fooj.* projects
Environments:  stage → prod (manual approval for prod)
ACR:           foojstageacr / foojprodacr

Resource Naming Convention

Fooj follows a simplified naming (not the ERP mic-erp-be / mic-erp-fr pattern):

ResourceStageProduction
Resource Groupfooj-stage-rgfooj-prod-rg
Container Apps Envfooj-stage-caefooj-prod-cae
SQL Serverfooj-stage-sqlfooj-prod-sql
Redisfooj-stage-redisfooj-prod-redis
Key Vaultfooj-stage-kvfooj-prod-kv
ACRfoojstageacrfoojprodacr

Internal Documentation — Microtec Platform Team