This chapter answers three questions: what this directory is for, where new code goes, and which directories must not be edited by hand. The directories are based on the current master branch of the four repositories; only directories that actually exist in the repositories are listed, and generated artifacts (target/, .next/, node_modules/) are not expanded. Directory purposes are summarized primarily from class names, route names, and code comments; anything that cannot be determined from the name alone is marked in the notes.

1. How to Choose Among the Four Repositories

RepositoryRoleWhen to change it
hoox-cap-backendOne of Portal’s backends, providing declaration, materials, licenses, payment, appointment, correction, and other capabilitiesChange declaration/processing APIs, CAP business orchestration, file upload/download
hoox-cms-backendPortal admin backend + Portal client content APIsChange sites/columns/content/tags/sensitive words/customer service/redirect whitelist
hoox-cms-pub-uiPortal PCChange PC pages, PC BFF, NextAuth login
hoox-cms-pub-appPortal H5Change H5 processing flow, H5 BFF, CST/native login

For the overall architecture and terminology, see 01-System Overview and Terminology; for integration configuration, see 02-Integration and Configuration Standards; for coding standards, see 03-Backend Development Standards and 04-Frontend Development Standards.

2. hoox-cap-backend

2.1 Top Level

hoox-cap-backend/
├─ cert/                       # Redis/ZooKeeper TLS certificate store (JKS)
├─ gov-hoox-cap-common/        # Common foundation package: error codes, constants, data sources, UAM
├─ gov-hoox-cap-online/        # Online declaration capabilities: facade + server
│  ├─ gov-hoox-cap-online-facade/
│  └─ gov-hoox-cap-online-server/
├─ gov-hoox-cap-run/           # Bootstrap module, configuration resources, fat jar
├─ updatesql/                  # CAP database upgrade scripts
├─ pom.xml                     # Aggregation/dependency versions/Profile
├─ CHANGELOG.md
└─ README.md
Directory/FilePurposeNote
cert/redis-*.jks, zookeeper-*.jks, used for TLS mutual authenticationSensitive material; do not copy to the frontend/documentation/public logs; confirm repository access permissions
gov-hoox-cap-common/Error codes, constants, data source configuration, and common online-offline integration APIs reused across modulesDo not put specific declaration business here; business code goes in online
gov-hoox-cap-online/Parent module for CAP online capabilitiesAggregation only; specifics are in facade/server
gov-hoox-cap-run/Bootstrap class, application*.properties, i18n, packagingDo not put business code here; for configuration changes see 02
updatesql/CAP SQL upgrade scripts, currently only 4.0.0/hoox_cap.sqlWhen adding tables/fields, add the corresponding version document; do not only change the DO
pom.xmlJava 21, Spring Boot 2.7.18, SOFA 3.14.1, hoox-common versionFull regression is required when changing dependency versions

2.2 Module Relationships

flowchart LR
  ROOT["gov-hoox-cap (pom)"] --> COMMON["gov-hoox-cap-common"]
  ROOT --> ONLINE["gov-hoox-cap-online"]
  ONLINE --> FACADE["gov-hoox-cap-online-facade"]
  ONLINE --> SERVER["gov-hoox-cap-online-server"]
  ROOT --> RUN["gov-hoox-cap-run"]
  RUN -.->|packaging/startup| COMMON
  RUN -.->|packaging/startup| FACADE
  RUN -.->|packaging/startup| SERVER

The diagram above shows build/run relationships, not a strict Maven dependency graph; for specific dependencies, refer to each pom.xml.

2.3 gov-hoox-cap-common

src/main/java/com/linewell/gov/hoox/cap/
├─ base/
│  ├─ code/                    # CAP base enums: download source, department type, tags, window binding, etc.
│  ├─ constants/               # CapConstants, RedisKeyConst
│  └─ datasource/              # CapDataBaseConfig (data source/MyBatis configuration)
└─ onlineofflinecommon/
   ├─ facade/config/dto/       # Online-offline common configuration DTOs
   └─ server/uam/service/      # UAM user/organization integration services
PackagePurposeShould new code go here?
base/codeCross-domain base enumsOnly if shared by multiple domains
base/constantsGlobal constants, Redis keysCross-domain constants go here; single-domain constants go in the domain
base/datasourceCAP data source initializationDo not write business SQL here
onlineofflinecommon/facade/config/dtoOnline-offline common configuration API DTOsCommon configuration DTOs may go here
onlineofflinecommon/server/uam/serviceUAM integrationChange only when UAM-related

2.4 gov-hoox-cap-online-facade

src/main/java/com/linewell/gov/hoox/cap/online/
├─ common/captcha/dto/         # Common captcha DTOs
└─ pc/
   ├─ book/                    # Appointment
   ├─ captcha/                 # Image/SMS captcha
   ├─ file/                    # File download token, file DTOs
   ├─ license/                 # Electronic license/cloud license
   ├─ single/
   │  ├─ appeal/               # Appeals
   │  ├─ declare/              # Declaration (query/processing)
   │  ├─ evaluate/             # Evaluation
   │  ├─ matter/               # Matters
   │  ├─ patch/                # Correction
   │  └─ pay/                  # Payment
   ├─ supplement/              # Supplementary materials
   ├─ window/                  # Service outlets/windows
   └─ without/                 # External system calls (including ROMA eligibility verification)
DirectoryPurposeTypical API prefix
bookAppointment processing, bookable time slots/hoox/cap/book/handle/v1
captchaImage captcha/hoox/cap/online/pc/captcha
fileDownload token, file metadata/hoox/cap/online/pc/file/download
licenseCloud license query/download/authorization/hoox/cap/online/pc/license/cloud
single/appealAppeal application/details/buttons/hoox/cap/online/pc/single/appeal/v1
single/declareDeclaration drafts, forms, materials, results, statistics/hoox/cap/online/pc/single/declare/v1
single/evaluateCase evaluation/hoox/cap/online/pc/single/evaluate/v1
single/matterMatter/service scenario configuration/hoox/cap/online/pc/config/service/v1
single/patchCorrection form/details/hoox/cap/online/pc/single/patch/v1
single/payPayment information, order placement, payment status/hoox/cap/online/pc/single/pay/v1
supplementSupplementary material confirmation/form/hoox/cap/online/pc/single/supplement/v1
windowService outlet/window details/hoox/cap/online/pc/window/v1
withoutExternal system/ROMA calls; whether login is exempt depends on the provider’s authIncludeUrl/hoox/cap/withoutQuery/v1

The paths of the file upload/download Controllers are /cap/online/pc/file/v1 (Spring MVC + JAX-RS dual stack), and they are not within the /hoox/cap/... namespace in the table above.

Conventions:

  • APIs go in facade, implementations go in server; facade does not depend on server.
  • Interface class names are I...Facade, and paths carry the version v1; for specific standards see 03-Backend Development Standards.
  • without is an entry point for external systems and cannot be treated as login-exempt across the board: the PC/H5 providers explicitly allow only getSignature, while the global hoox.oauth.auth.include.url also includes /hoox/cap/withoutQuery/v1/.*; before adding an API, you must check both the provider’s authIncludeUrl and the global include.

2.5 gov-hoox-cap-online-server

src/main/java/com/linewell/gov/hoox/cap/online/
├─ common/                     # Common services/utilities: captcha, PDF conversion, windows
└─ pc/
   ├─ book/provider/           # Appointment implementation
   ├─ captcha/provider/        # Captcha implementation
   ├─ file/
   │  ├─ controller/           # Spring MVC + JAX-RS dual-stack file APIs
   │  ├─ provider/             # Download token, etc.
   │  └─ service/              # File download/material processing
   ├─ license/provider/        # Cloud license implementation
   ├─ single/
   │  ├─ appeal/               # Appeal implementation
   │  ├─ bill/                 # Receipts/bills
   │  ├─ declare/              # Declaration implementation
   │  ├─ evaluate/             # Evaluation implementation
   │  ├─ matter/               # Matter implementation
   │  ├─ pay/                  # Payment implementation
   │  ├─ provider/             # Single-domain common provider
   │  └─ supplement/           # Supplementary submission implementation
   ├─ window/provider/         # Service outlet implementation
   └─ without/                 # External system implementation
DirectoryPurpose
commonCross-domain services/utilities such as captcha, PDF conversion, and windows
book/providerAppointment facade implementation
captcha/providerCaptcha facade implementation
file/controllerFile upload/download MVC APIs; also carries JAX-RS annotations
file/providerFacade implementations such as file tokens
file/serviceFile download and material processing business
license/providerCloud license facade implementation
single/*Facade implementations for each declaration subdomain; bill/controller contains document/receipt APIs (/cap/online/pc/single/bill/v1)
window/providerService outlet facade implementation
withoutExternal system/ROMA facade implementation

Notes:

  • The path of file/controller is /cap/online/pc/file/v1, not /hoox/cap/...; the authentication configuration’s authIncludeUrl must cover it.
  • CAP has no local MyBatis mapper XML; most business queries are in the SDK/hoox-common services; before adding local SQL, first confirm the mapper scan path.
  • single/bill does not create separate APIs in the facade’s single subdirectory; bill APIs may be carried by declare or the file domain; search the existing paths before adding.

2.6 gov-hoox-cap-run

src/main/
├─ java/com/linewell/gov/hoox/cap/run/
│  ├─ CapWebApplication.java   # Bootstrap class
│  └─ config/JobConfig.java    # Scheduled job configuration
└─ resources/
   ├─ common/                  # Common configuration (data sources, OAuth, gateway, CAP addresses, etc.)
   ├─ dev/                     # Local/development environment overrides
   └─ i18n/                    # Internationalization resources
DirectoryPurpose
java/.../runOnly startup, global configuration, and job configuration
resources/commonConfiguration shared by all environments; application.properties is here
resources/devConfiguration overridden when the Maven dev profile is active
resources/i18nInternationalization resources for CAP error messages/prompts

The current repository only has the common and dev resource directories; the test/prod/huawei/dm profiles declared in pom.xml have no corresponding resource directories, so confirm before switching profiles (see 02).

2.7 Where CAP New Code Goes

What you want to addPut it here
New REST APIgov-hoox-cap-online-facade/.../pc/<domain>/facade
API DTOThe same domain’s dto or the facade module’s common DTO package
API implementationgov-hoox-cap-online-server/.../pc/<domain>/provider
Local business serviceThe same domain’s service
File upload/download Controller.../pc/file/controller (MVC scenarios only)
Cross-domain constants/error codesgov-hoox-cap-common/.../base/{constants,code}
SQL upgradeupdatesql/<version>/hoox_cap.sql
Unit testsThe corresponding module’s src/test/java/..., with package names mirroring the main code

3. hoox-cms-backend

3.1 Top Level

hoox-cms-backend/
├─ cert/                       # Redis/ZooKeeper TLS certificate store (JKS)
├─ hoox-cms-facade/            # Admin/client APIs + DTOs
├─ hoox-cms-server/            # Implementations, domain services, DAO, Mapper, i18n
├─ hoox-cms-run/               # Bootstrap module, configuration resources, fat jar
├─ sql/gauss/                  # CMS initialization/upgrade/rollback scripts
├─ pom.xml
└─ README.md
Directory/FilePurposeNote
cert/Redis/ZooKeeper TLS JKSSensitive material; do not share externally
hoox-cms-facade/Only APIs and DTOs, no implementationsadmin/client must be separated
hoox-cms-server/Business implementations, DAO, Mapper, i18nDomain cohesion: one directory per domain
hoox-cms-run/Bootstrap class, configuration, packaging, overrideDo not put business code here
sql/gauss/GaussDB initialization/upgrade/rollback scriptsScripts must be added for new tables/fields

3.2 Module Relationships

flowchart LR
  ROOT["hoox-cms-backend (pom)"] --> FACADE["hoox-cms-facade"]
  ROOT --> SERVER["hoox-cms-server"]
  ROOT --> RUN["hoox-cms-run"]
  SERVER -.->|implements facade| FACADE
  RUN -.->|packaging/startup| FACADE
  RUN -.->|packaging/startup| SERVER

3.3 hoox-cms-facade

src/main/java/com/linewell/gov/hoox/cms/
├─ facade/
│  ├─ admin/                   # Admin backend APIs
│  │  ├─ article/              # Content management
│  │  ├─ authorization/        # Authorization management
│  │  ├─ chat/                 # Customer service/conversations
│  │  ├─ clean/                # Data cleanup
│  │  ├─ column/               # Columns
│  │  ├─ complain/             # Inquiries and complaints
│  │  ├─ dept/                 # Departments
│  │  ├─ dict/                 # Dictionary
│  │  ├─ file/                 # Files
│  │  ├─ jumplink/             # Redirect link whitelist
│  │  ├─ link/                 # External links
│  │  ├─ system/               # Site configuration
│  │  ├─ tag/                  # Tags
│  │  ├─ topic/                # Topics
│  │  ├─ website/              # Sites
│  │  └─ word/                 # Hot words/sensitive words/filter words
│  └─ client/                  # Portal client APIs
│     ├─ article/              # Published content
│     ├─ authorization/        # Authorization
│     ├─ captcha/              # Captcha
│     ├─ chat/                 # Customer service
│     ├─ collect/              # Favorites
│     ├─ column/               # Columns
│     ├─ complain/             # Inquiries and complaints
│     ├─ dept/                 # Departments
│     ├─ dict/                 # Dictionary
│     ├─ file/                 # Files
│     ├─ jumplink/             # Redirect whitelist validation
│     ├─ smp/                  # SMP matter services
│     ├─ system/               # Site configuration
│     ├─ topic/                # Topics
│     └─ word/                 # Hot words
└─ dto/                        # Req/Resp/DTOs corresponding to facade
DirectoryPurposeNote
facade/adminAdmin write operations/configuration queriesDo not expose to the Portal client
facade/clientPortal client read-only/submissionDo not reuse admin write APIs
facade/client/smpFetch service data from SMP/Matter CenterDepends on external systems; pay attention to degradation
dtoAPI transfer objectsDo not put DO/Entity here

When adding APIs, create separate admin and client packages; do not mount admin APIs under the client path for the sake of “reuse”.

3.4 hoox-cms-server

src/main/java/com/linewell/gov/hoox/cms/
├─ chat/                       # WebSocket sessions, Redis broadcast, message services
├─ config/                     # Thread pool, file paths, open authentication, WebSocket configuration
├─ consts/                     # Table names, Redis keys, i18n constants
├─ datasource/                 # Data sources, MyBatis-Plus, pagination interceptor
├─ depend/                     # External dependencies: files, GOMS, SMP, URLs
├─ enums/
│  ├─ code/                    # Error codes/warning codes
│  ├─ constant/                # Business constant enums
│  └─ dict/                    # Dictionary enums (scanned by @EnumsScanner)
├─ exception/                  # CmsException, parameter validation exceptions
├─ init/                       # Startup initialization (CmsRunnerInit)
├─ job/                        # Scheduled jobs
├─ provider/
│  ├─ admin/                   # Admin facade implementations
│  └─ client/                  # Client facade implementations
├─ server/                     # Domain layer: dao/entity/service
├─ utils/                      # Result, date, file, encryption, external link validation, etc.
└─ ...

Domain Layer server/

DirectoryPurposeSubdirectories
articleContent, content column/tag associations, operation logsdao, entity, service
authorizationNIN/NIF authorizationdao, entity, service
chatCustomer service conversations, members, messagesdao, entity, service
collectFavoritesdao, entity, service
columnColumnsdao, entity, service
complainInquiries and complaintsdao, entity, service
deptDepartment queries/organization informationservice
dictDictionaryscanner, service
fileFile metadatadao, entity, service
jumplinkRedirect link whitelistdao, entity, service
systemSite/footer/system configurationdao, entity, service
tagTagsdao, entity, service
topicTopics/topic servicesdao, entity, service
websiteSitesdao, entity, service
wordHot words, filter words, sensitive wordsdao, entity, sensitive, service
anyncCurrently an empty directory, no code foundDo not treat it as an async entry point; async is in config/AsyncThreadPoolConfig

Support Packages

DirectoryPurposeTypical Classes
chat (root)WebSocket sessions, Redis subscription/broadcast, online customer service messagesAdminChatMessageSocket, ClientChatMessageSocket, SessionManager
configGlobal configurationAsyncThreadPoolConfig, CmsFilePathConfig, CmsOpenAuthConfig, CmsWebSocketConfig
constsTable name/Redis key/i18n constantsTableNameConst, RedisKeyConst, I18nConst
datasourceData source/MyBatis-PlusCmsDataBaseConfig, MybatisPlusInterceptorConfig
dependExternal system adaptationDependFileManager, DependGomsManager, DependSmpManager, DependUrlManager
enums/codeError codes/warning codesECmsExceptionCode, ECmsWarnCode
enums/constantBusiness constant enumsFile business types, etc.
enums/dictDictionary enumsECmsArticleStatusDict, etc.
exceptionCMS exceptionsCmsException, CmsParamValidException
initStartup initializationCmsRunnerInit (language table sharding, filter words, Redis heartbeat, WebSocket, consultation cache)
jobScheduled jobsFinishTimeoutChatJob, HotWordStatisticsJob
provider/adminAdmin implementationsMirrors facade by domain
provider/clientClient implementationsMirrors facade by domain
utilsCommon utilitiesCmsResultUtils, DateUtil, FileSecurityValidator, ExternalLinkWhitelistValidator, UUIDGenerate (SDK)

Resources hoox-cms-server/src/main/resources

resources/
├─ i18n/                       # message_*.properties
└─ mybatis/mapper/cms/         # Mapper XML organized by domain
  • Mapper XML goes in mybatis/mapper/cms/<domain>/, not in hoox-cms-run.
  • i18n goes in i18n/; currently there are message_ar_DZ, message_en_US, message_fr_FR, etc.
  • hoox-cms-run/src/main/resources has only common, dev, META-INF; do not assume that i18n is in the run module.

3.5 hoox-cms-run

src/main/
├─ java/.../cms/run/CmsWebApplication.java   # Bootstrap class
├─ resources/
│  ├─ common/                                # Common configuration
│  ├─ dev/                                   # dev overrides
│  └─ META-INF/rpc-config.json               # SOFA RPC configuration
└─ override/                                 # Third-party class overrides extracted from hoox-oauth-server
DirectoryPurposeNote
CmsWebApplication.javaStartup, @ComponentScan, cache/enums/schedulingDo not add business logic
resources/commonData source, Redis, OAuth, dependencies, MyBatis, and other configurationFor configuration standards see 02
resources/devLocal data source/devops overridesdev only
resources/META-INF/rpc-config.jsonSOFA RPC configurationKeep in sync when changing ports/protocols
src/main/overrideJava override classes extracted from hoox-oauth-server at build timeDo not edit by hand; overwritten on every build; change the upstream dependency if a change is truly needed

3.6 Where CMS New Code Goes

What you want to addPut it here
Admin APIshoox-cms-facade/.../facade/admin/<domain>
Client APIshoox-cms-facade/.../facade/client/<domain>
API DTOshoox-cms-facade/.../dto/<domain>
API implementationshoox-cms-server/.../provider/{admin/client}/<domain>
Domain services/DAO/DOhoox-cms-server/.../server/<domain>/{service,dao,entity}
Mapper XMLhoox-cms-server/src/main/resources/mybatis/mapper/cms/<domain>
Table names/Redis keyshoox-cms-server/.../consts
Dictionaries/error codes.../enums/dict, .../enums/code
External system adaptation.../depend
Scheduled jobs.../job
Startup initialization.../init/CmsRunnerInit (be careful: a startup failure affects the whole site)
SQL upgradesql/gauss/hoox-cms-<from>-upgrade-<to>.sql
Unit testshoox-cms-server/src/test/java/..., with package names mirrored

4. hoox-cms-pub-ui (PC)

4.1 Top Level

hoox-cms-pub-ui/
├─ .husky/                     # Git hooks (commit-msg/pre-commit)
├─ .vscode/                    # Editor configuration
├─ patches/                    # patch-package patches
├─ public/                     # Static files served as-is (favicon, etc.)
├─ schemas/                    # Collection of API JSON Schemas (GET/POST/WEBSOCKET subdirectories)
├─ scripts/                    # Build/validation/theme scripts
├─ src/                        # Source code
├─ .env.development            # Default development environment configuration
├─ .env.production             # Default production build configuration
├─ ecosystem.config.js         # PM2 configuration (8300)
├─ next.config.js              # Next build/images/SCSS/webpack
├─ lingui.config.js            # Lingui extraction/compilation
├─ jest.config.js              # Jest
├─ tailwind.config.js          # Tailwind
├─ tsconfig.json               # TS configuration
├─ package.json                # Scripts/dependencies
├─ package-lock.json
└─ README.md
Directory/FilePurposeNote
.husky/Pre-commit lint/commit message validationDo not bypass the hook when committing
.vscode/Team editor settingsDo not force personal preferences on others
patches/patch-package fixes for third-party packagesPatches may stop working after dependency upgrades; verify them
public/Static files served as-isCurrently only favicon/placeholder images; most business images are in src/assets
schemas/JSON Schemas for each BFF route (PC splits them into GET/POST/WEBSOCKET directories)No references were found in the current source code; whether they must be synchronized after route changes is to be confirmed; do not treat this as runtime validation
scripts/Version number stripping, Lingui fixes, BPJS sync, antd themeDo not change build scripts arbitrarily
src/Application source codeSee below
.env.*Environment variablesAlready committed, containing shared environment addresses and key-type configuration; do not add real keys to the repository
ecosystem.config.jsPM2 cluster, port 8300Consistent with Nginx/gateway
next.config.jsreactStrictMode:false, ignoring build-time lint/TS, image quality, SCSS injection, React 19 shimRegression-test antd/Lingui when changing webpack aliases
lingui.config.jslocale, catalog paths, pseudoLocaleSynchronize src/i18n.ts when adding languages
jest.config.jsjsdom, @/ alias, testMatchTests go in src/__tests__
tailwind.config.jsTailwind scan scope/themeCoordinate with SCSS variables
tsconfig.jsonstrict, @/*, client-kit aliasDo not disable strict

4.2 src/ Overview

src/
├─ __tests__/                  # Jest tests, mirroring the source directories
├─ app/                        # App Router: pages + BFF + static SDK routes
├─ assets/                     # Images, fonts, shared resources grouped by language/type
├─ components/                 # 61 reusable component directories
├─ contexts/                   # React Context (currently BuriedContext)
├─ core/                       # constants/datasources/entities/services
├─ hooks/                      # Custom hooks
├─ libs/                       # request, client-kit wrappers
├─ locales/                    # Lingui .po language packs
├─ middlewares/                # Non-routing middleware utilities (refreshToken)
├─ shims/                      # Third-party compatibility shims
├─ styles/                     # Global SCSS/antd styles
├─ template/                   # Print templates (by language)
├─ typings/                    # API/global types
├─ utils/                      # client/server/store utilities
├─ i18n.ts                     # Runtime locale configuration
└─ middleware.ts               # Next middleware (route validation/mobile redirect)
DirectoryPurposeShould new code go here?
__tests__Unit/component testsPut tests here; directories mirror the source code
appRoutes, pages, BFFPut new pages/routes here
assetsImages/fonts/shared resourcesPut static assets here or in public
componentsReusable UIPut common components here
contextsGlobal ContextOnly for cross-page state
coreBusiness core (constants/data sources/entities/services)Put business logic here
hooksReusable hooksPut common hooks here
libsRequest library wrappersDo not write business logic here
locales.po language packsMaintain with Lingui/Crowdin
middlewaresNon-routing middleware utilitiesCurrently only refreshToken.ts
shimsCompatibility layerThird-party compatibility code only
stylesGlobal stylesGlobal variables/resets go here
templatePayment success print templatesAdd HTML by language
typingsTypesAPI DTOs/global types go here
utilsUtilitiesKeep pure functions/client/server/store separate
i18n.tsLocale list/default valueChange this when adding languages
middleware.tsRoute validation/mobile redirectMust be changed when adding pages

4.3 src/app Routes

app/
├─ [lang]/                     # All PC pages (with language prefix)
│  ├─ (home)/                  # Home page route group
│  ├─ [...notFound]/           # Fallback 404
│  ├─ callback-pages/          # Payment results, license detail callbacks
│  ├─ citizen-services/        # Citizen services
│  ├─ enterprise-services/     # Enterprise services
│  ├─ government-citizen-interaction/  # Government-citizen interaction/feedback
│  ├─ grayscale-release/       # Grayscale release description/entry
│  ├─ policies-regulations/    # Policies and regulations
│  ├─ search/                  # Search
│  ├─ sector-services/         # Sector services
│  ├─ service/                 # Cases: apasinfo/handle/patch
│  ├─ user-account/            # User account center
│  └─ zone/                    # Zones
├─ api/                        # PC BFF
├─ bpjs/                       # Tracking SDK static route
└─ pdfjs/                      # PDF.js static route
DirectoryPurposeNote
[lang]Language-prefixed routesar-dz/fr-fr/en-us, plus zh-cn in development
(home)Home page route groupGrouping does not affect the URL
[...notFound]Fallback for unmatched pathsDo not write business logic here
callback-pagesPayment results, license detailsRelated to mobile redirect rules
citizen-servicesCitizen services topic pageData comes from CMS topics
enterprise-servicesEnterprise services topic pageSame as above
government-citizen-interactionGovernment-citizen interaction/feedbackIncludes feedback
grayscale-releaseGrayscale releasePage entry
policies-regulationsPolicies and regulations/content detailsContent comes from CMS
searchSite-wide searchHot words/search APIs
sector-servicesSector servicesAggregated by department
serviceCase processapasinfo/handle/patch
user-accountUser account centerMy Cases/Bills/Licenses/Favorites/Messages, etc.
zoneZonesAggregated by region/topic
apiBFFSee 4.4
bpjsTracking SDKcreateBpjsRouteHandler()
pdfjsPDF.js static assetscreatePdfjsRouteHandler()

user-account subdirectories:

DirectoryPurpose
(basic-information)Basic Information route group
account-settingAccount Settings
componentsUser account center local components
electronic-certificateElectronic Licenses
favorite-listFavorites
my-appealsMy Appeals
my-applicationsMy Cases
my-billMy Bills
my-feedbackMy Feedback
my-legalLegal Entity Information
my-messagesMy Messages
my-reservationMy Reservations
service-evaluationService Evaluation

4.4 src/app/api (PC BFF)

api/
├─ (common)/                   # File upload/download, health check (route group, does not affect the URL)
├─ apiaccess/uv/               # UV statistics proxy
├─ auth/[...nextauth]/         # NextAuth login/callback/session
├─ cap-rest/                   # CAP proxy + dedicated routes
├─ cms-rest/                   # CMS proxy + dedicated routes
├─ csm-tpaccess/               # HWBP proxy
├─ form-rest/file-download/    # Form Center file download
├─ goms-rest/                  # GOMS messages/dictionary
├─ smp-rest/                   # SMP service list
├─ user/                       # Users, legal entities, authorization, captcha, messages
└─ [[...slug]]/route.ts        # Unified 404 for unmatched APIs
DirectoryPurposeNote
(common)File upload/download, PDF generation, health checkThe route group does not create a URL prefix; the actual URLs are /api/cap-file-upload, etc.
apiaccess/uvUV statisticsReads APIACCESS_UV_URL
auth/[...nextauth]NextAuthCustom GET/POST, CSRF, callback validation
cap-restCAP API proxyGeneric [[...proxy]] + multiple dedicated routes
cms-restCMS API proxyGeneric [[...proxy]] + topics/favorites/complaints/redirect validation, etc.
csm-tpaccessHWBP tracking proxy[[...proxy]]
form-restForm CenterFile download
goms-restGOMS messages/dictionaryMultiple dedicated routes
smp-restSMP service listDedicated routes
userUsers/legal entities/authorization/captchaNamed by action
[[...slug]]Fallback 404Do not add business logic here

The BFF has many leaf directories, and they change as APIs are added or removed; this section groups them by service. A leaf directory name states the API purpose (such as complain-add and license-list), and no itemized list is maintained. When adding an API, do not add only a datasource without adding a whitelist entry; the generic proxy only allows exact paths.

4.5 src/components (61)

DirectoryPurpose
antd-trigger-childantd trigger child node wrapper
apasinfo-lifecycleCase lifecycle display/mobile modal
app-providerGlobal App Provider (theme/language/configuration)
application-select-modalCase selection modal
breadcrumbBreadcrumb
buttonCommon button
card-selectCard selection
carouselCarousel
checkbox-buttonCheckbox button
cloud-licenseCloud license modal/direct license retrieval
cms-file-imageCMS file image
cms-url-imageCMS URL image
coming-soon-modal”Coming soon” modal
department-cascaderDepartment cascader
dept-select-debounceDebounced department select
dept-tree-select-clineDepartment tree select (the directory name is a historical spelling)
emptyEmpty state
error-draftDraft error state
error-resultError result page
external-link-modalExternal link confirmation modal
external-link-providerExternal link interception Provider
feedback-modalFeedback modal
fix-aria-selectAccessibility fix for Select/Cascader
gotoServiceHandle-promptGo to processing prompt modal
guide-centerService guide center
guide-stepGuide step
hot-searchHot search
hyperlink-modalHyperlink confirmation modal
image-viewerImage preview
lazy-background-imageLazy-loaded background image
linkLink wrapper
modalCommon Modal
modal-confirmConfirmation Modal
modal-footerModal footer
modal-tipTip Modal
online-serviceOnline customer service/chat
page-footerPage footer
page-headerPage header/navigation
page-titlePage title
paginationPagination
pdf-viewerPDF preview
portal-services-pagePortal services topic page client
query-tableQuery table/list
scene-guidanceScenario guidance Q&A
sector-service-cardSector service card
service-cardService card
service-headerService detail header
service-select-debounceDebounced service select
service-select-modalService selection modal
service-treeService tree
services-favoris-modalFavorite services modal
side-barSidebar
spaceSpacing layout
sso-service-cardSSO service card
swiper-picCarousel image
tab-barTab bar
tab-statusStatus tag
unauthorized-promptUnauthorized prompt
web-page-to-fileWeb page to PDF/print
with-authorizedLogin/permission wrapper (client/server versions)
zone-headerZone page header

4.6 src/core

core/
├─ constants/                  # Common, list, language, CMS/SMP/user/payment, etc. constants
├─ datasources/
│  ├─ client/                  # Browser-side API calls
│  └─ server/                  # Server Component / Route Handler API calls
├─ entities/                   # DTO -> view entities/default values
└─ services/
   ├─ client/                  # Client-side business facade
   └─ server/                  # Server-side business facade
DirectoryPurposeRule
constantsEnumerated values, status mappings, language mappings, URL constantsDo not write request logic
datasources/clientclientRequest calls the BFFOnly for client components/hooks
datasources/serverserverRequest + HOOX-AUTH + cacheOnly for Server Components/BFF
entitiesDefault values, DTO→view objectsDo not make network requests
services/clientClient-side business methodsCompose datasource/entity
services/serverServer-side business methodsDo not export to the client

Order for adding an API: datasource → service → page/component; do not call datasource directly from pages (there are a few existing exceptions; do not let new code spread them).

4.7 Other src Directories

DirectoryPurposeKey Point
hooksuseAutoLogout, useI18nInit, useRouter, useUserIdle, etc.Do not stuff common logic into pages
contextsBuriedContextTracking context
libs/requestclient.ts/server.ts request wrappersGlobal interceptors/security configuration
libs/client-kit@linewell/client-kit external link guard wrapperThe webpack alias points here
utils/clientBrowser utilities such as cookie, sign-out, CSRF, external links, trackingCannot use next/headers
utils/serverServer-side utilities such as authentication, RSA, cache, i18n, CMS cacheMust not enter the client bundle
utils/storeZustand storeOnly store UI/session-scoped state
typingscmsApi.ts, smpApi.ts, global.d.ts, next-auth.d.ts, env.d.tsAPI types and global declarations
locales.po files for ar-dz/fr-fr/en-us/zh-cnMaintain with Lingui/Crowdin; do not edit compiled artifacts by hand
stylesglobals.scss, var.scss, antd.css, etc.Global styles/variables
templatePayment success print templates (HTML by language)Add the corresponding template when adding a language
shimsrc-util-react-render.jsReact 19 + antd 4 compatibility; do not delete
middlewaresrefreshToken.tsDifferent from the root middleware.ts
assetsBy language/images/shared resourcesProcessed at build time, not public

4.8 Where PC New Code Goes

What you want to addPut it here
New pagesrc/app/[lang]/<route>/page.tsx (+ page.client.tsx)
New route validationvalidRoutes in src/middleware.ts
New componentsrc/components/<kebab-case>/
New hooksrc/hooks/useXxx.ts
New API call (client)src/core/datasources/client/
New API call (server)src/core/datasources/server/
New business servicesrc/core/services/{client/server}/
New view entitysrc/core/entities/
New BFF routesrc/app/api/<service>/.../route.ts + whitelist
New global typesrc/typings/
New copymsg/Trans in components, then run Lingui
New testsrc/__tests__/ mirrored directory

5. hoox-cms-pub-app (H5)

5.1 Top Level

hoox-cms-pub-app/
├─ .husky/
├─ .vscode/
├─ patches/
├─ public/
├─ schemas/
├─ scripts/
├─ src/
├─ .env.development
├─ .env.production
├─ ecosystem.config.js         # PM2 8100
├─ next.config.js              # basePath: '/h5'
├─ lingui.config.js
├─ jest.config.js
├─ tailwind.config.js
├─ tsconfig.json
├─ package.json
├─ package-lock.json
├─ yarn.lock                   # Two sets of lockfiles exist at the same time
└─ README.md
Directory/FilePurposeNote
patches/patch-package patchesH5’s patches for antd 5/axios, etc. differ from PC
schemas/H5 route JSON SchemasPaths have an h5- prefix; no references were found in the current source code
scripts/Version number stripping, CST SDK copying, dompurify cleanup, type validationcopy-cstoon-jssdk.js is related to the native container
public/Static files served as-isCurrently only placeholder images; PDF/BPJS are served by app routes
ecosystem.config.jsPM2 cluster, port 8100Consistent with the /h5 reverse proxy
next.config.jsbasePath:'/h5', Lingui SWC, ignoring build-time lint/TS, server externalsChanging basePath affects all URLs
package-lock.json + yarn.lockTwo sets of lockfilesThe current scripts use npm; before changing dependencies, confirm which set CI/deployment uses, and mixing them is prohibited

5.2 src/ Overview

src/
├─ __tests__/                  # Jest tests
├─ app/                        # App Router: pages + H5 BFF + static SDK
├─ assets/                     # Fonts/shared resources
├─ components/                 # 15 reusable component directories
├─ contexts/                   # BuriedContext
├─ core/                       # constants/datasources/services
├─ hooks/                      # useI18nInit/useUserIdle
├─ libs/request/               # H5 request wrappers
├─ locales/                    # Lingui .po
├─ styles/                     # Global styles
├─ types/                      # Jest type declarations
├─ typings/                    # Global types/client-kit declarations
├─ utils/                      # client/server/store
├─ i18n.ts                     # Runtime locale
└─ middleware.ts               # formCenter proxy
DirectoryPurposeDifference from PC
appPages/BFF/static SDKNo [lang]; URLs carry /h5
assetsFonts, shared resourcesFewer per-language image directories than PC
componentsMobile components15, mainly antd-mobile
coreConstants/data sources/servicesNo entities directory
typesjest.d.tsPC does not have it
typingsGlobal typesNo cmsApi.ts/smpApi.ts
middleware.tsformCenter proxyDoes not handle language prefixes
libsOnly requestPC also has client-kit
stylesGlobal SCSSNo PC’s template/shims/middlewares

5.3 src/app Routes

app/
├─ api-h5/                     # H5 BFF
├─ bpjs/                       # Tracking SDK static route
├─ callback-pages/             # Payment results
├─ license/                    # License preview
├─ pdfjs/                      # PDF.js static assets
├─ service/                    # Processing flow (handle/patch/appeal/approve/receipt/view)
├─ unauthorized/               # Unauthorized page
└─ layout.tsx                  # Root layout ('use client')
DirectoryPurposeNote
api-h5H5 BFFPrefix /h5/api-h5
bpjsTracking SDKcreateBpjsRouteHandler()
callback-pages/payment-resultPayment resultsThe native container redirects here
licenseLicensesIncludes preview license preview
pdfjsPDF.jsStatic assets
serviceMain processing flowSee below
unauthorizedUnauthorizedRedirected here when access is not permitted
layout.tsxRoot layoutClient component, including token/user initialization

service subdirectories:

DirectoryPurpose
appealAppeals
approveApproval/review-related pages
componentsProcessing flow local components (result pages, etc.)
handleMain processing page
patchCorrection
receiptReceipt/acceptance
viewCase viewing
Provider.tsxProcessing flow shared state/steps
layout.tsxProcessing flow layout

The steps/states of the H5 processing flow are in service/Provider.tsx: sceneGuidance, fillForm (may include materialUpload), inProcess, result; when adding steps, you must also change constants such as HandleState/MaterialPhase, not just add components.

5.4 src/app/api-h5 (H5 BFF)

api-h5/
├─ (common)/                   # File upload/download, health check
├─ cap-rest/                   # CAP proxy + dedicated routes
├─ cms-rest/                   # Redirect whitelist validation
├─ csm-tpaccess/               # HWBP proxy
└─ user/                       # app user information/keys/SMS
DirectoryPurposeNote
(common)File upload/download/PDF/health checkThe route group does not create a URL prefix
cap-restGeneric CAP proxy + dedicated routesPOST normalizes the response
cms-restRedirect link whitelist validationNo generic CMS proxy
csm-tpaccessHWBP tracking[[...proxy]]
userapp-get-k, app-user-info, SMSRelated to native token

H5 does not have generic physical routes such as PC’s /api-h5/smp-rest and /api-h5/goms-rest; although the environment variables contain SMP/GOMS addresses, do not assume that a corresponding BFF necessarily exists. Add one following the existing cap-rest pattern when needed.

5.5 src/components (15)

DirectoryPurpose
app-providerGlobal App Provider
coming-soon-modalComing soon modal
error-resultError result page
external-link-modalExternal link confirmation modal
external-link-providerExternal link interception Provider
hyperlink-modalHyperlink confirmation modal
inner-popupEmbedded popup layer
modal-commonCommon Modal
modal-imgImage modal
modal-tipTip modal
navigat-head-modalNavigation header modal
pdf-viewerPDF preview
scene-guidanceScenario guidance Q&A
title-popupTitle popup
web-page-to-fileWeb page to PDF/print

5.6 Other H5 src Directories

DirectoryPurpose
core/constantsProcessing status, material phase, payment, language, user constants
core/datasources/clientBrowser-side API calls
core/datasources/serverServer-side API calls (if any)
core/services/clientClient-side business facade (CapService, UserService)
core/services/serverServer-side business facade (if any)
hooksuseI18nInit, useUserIdle
libs/requestclientRequest/serverRequest
utils/clientcookie, authGate, CST, Toast, external links
utils/serverapiPipe, RSA, authentication
utils/storeZustand (such as declareTimeStore)
typingsGlobal types/client-kit declarations
typesJest types
locales.po language packs
stylesGlobal styles
assets/font, assets/sharedFonts/shared resources

5.7 Where H5 New Code Goes

What you want to addPut it here
New pagesrc/app/.../page.tsx (the URL automatically carries /h5)
New processing stepsrc/app/service/ + Provider.tsx state/steps
New componentsrc/components/<kebab-case>/
New API callsrc/core/datasources/client/ or server/
New business servicesrc/core/services/{client/server}/
New BFF routesrc/app/api-h5/<service>/.../route.ts + whitelist
New global typesrc/typings/
New copyLingui msg/Trans, run extraction/compilation
New testsrc/__tests__/ mirrored directory

6. How to Distinguish Directories with the Same Name

NameLocationActual Meaning
commonCAP’s gov-hoox-cap-commonCommon foundation module
commonCAP server’s online/commonCommon services/utilities
commonFrontend app/api/(common)File/health check BFF route group
serverBackend hoox-cms-serverBackend implementation module
serverFrontend core/datasources/serverRequest layer that runs only on the server
clientBackend facade/clientPortal client APIs
clientFrontend core/datasources/clientBrowser-side request layer
coreBoth frontendsFrontend business core (constants/data sources/entities/services)
typesH5 src/typesJest type declarations
typingsBoth frontendsAPI/global types
templatePC src/templatePrint templates
middlewaresPC src/middlewaresNon-routing middleware utilities (refreshToken)
middleware.tsBoth frontends’ root src/Next routing middleware
overrideCMS hoox-cms-run/src/main/overrideThird-party class overrides, generated at build time

7. Do Not Edit by Hand / Edit with Caution

PathReason
Backend target/Maven build artifact
Frontend .next/, coverage/Next/Jest generated files
CMS hoox-cms-run/src/main/override/Extracted from hoox-oauth-server at build time; manual changes are overwritten
node_modules/Dependency directory; change dependencies via package.json + lockfile
The SDK static routes in src/app/bpjs and src/app/pdfjsProvided by dependencies/scripts; do not write business logic there
src/locales/*/messages.ts (if generated)Lingui compilation artifacts; recompile after changing .po
schemas/No runtime references found currently; the generation method is uncertain, so confirm before changing routes and do not treat it as business code
cert/*.jksCertificate/key material; do not copy/print
Key-type configuration in .env.productionReal values should not be committed to the repository; inject them through the deployment environment

8. Find Directories by Task

TaskLook First At
Add a declaration query APICAP online-facade/.../single/declare → online-server/.../provider → UI core/datasources → BFF whitelist
Add a CMS admin content fieldCMS facade/admin/article → dto/article → server/article/{entity,dao,service} → Mapper XML → SQL
Add a Portal home page columnCMS facade/client/column / article → UI core/services/server/cms → page component
Add an H5 processing stepH5 app/service/Provider.tsx → app/service/... → core/services/client/cap → CAP API
Modify login/callbackPC src/auth.ts + src/app/api/auth/[...nextauth]; H5 layout.tsx + utils/client/authGate + api-h5/user
Modify API addressesFrontend .env.* + virtual prefix in src/libs/request/server.ts; backend application-*.properties
Add a languagesrc/i18n.ts + lingui.config.js + src/locales/*.po + template/image resources
Add a scheduled jobCMS server/job + bootstrap class @EnableScheduling; CAP run/config/JobConfig
Troubleshoot blank screen/hydrationPage Server/Client boundary, AppProvider, useI18nInit, NODE_ENV
Troubleshoot 404PC middleware.ts validRoutes; BFF whitelist; H5 basePath//h5

9. Known Current State at the Directory Level

  • CAP/CMS both have only the dev resource directory actually present; the other environment directories declared in the Maven profiles are not committed, so confirm before switching.
  • CMS’s hoox-cms-run/src/main/override is a build-generated directory and is not business source code.
  • CMS’s i18n is in hoox-cms-server/src/main/resources/i18n, not in the run module.
  • Both frontends’ schemas/ are tracked by Git, but no references were found in the current source code; do not assume that they participate in runtime validation.
  • H5 has both package-lock.json and yarn.lock; the current npm scripts are the actual build entry point, so confirm which set CI uses before changing dependencies.
  • PC’s src/middlewares/refreshToken.ts and the root src/middleware.ts are not the same thing: the former is a token refresh utility, and the latter is the Next routing middleware.
  • H5’s root layout.tsx is 'use client', unlike PC’s Server Layout; do not stuff server-side capabilities into the root layout.