Skip to content
cccskills
FreePublished on GitHub

architecture

Modular monolith architecture overview for melosys-api. Use when needing to understand module structure, dependencies between modules, where to place new code, or when changes in one module might affect others. Triggers: "architecture", "module dependencies", "where should I put", "which modules", "dependency graph".

The English summary is being prepared. Showing the original description.

See how to install

Files included (1)

  • SKILL.md7.6 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Melosys-API Architecture

Modular monolith with 12 core modules plus the soknad-altinn types module (JAXB-generated classes from an Altinn XSD; depends on nothing internal, used by integrasjon). Understanding the dependency graph is essential for:

  • Knowing where to place new code
  • Understanding what tests to run after changes
  • Avoiding circular dependencies

Module Dependency Graph

                              ┌─────────────┐
                              │     app     │ ← Entry point (Spring Boot)
                              └──────┬──────┘
           ┌──────────────┬─────────┼─────────┬──────────────┐
           │              │         │         │              │
           ▼              ▼         ▼         ▼              ▼
    ┌──────────┐   ┌──────────┐ ┌──────┐ ┌─────────┐  ┌──────────┐
    │frontend- │   │ saksflyt │ │config│ │sikkerhet│  │statistikk│
    │   api    │   └────┬─────┘ └───┬──┘ └────┬────┘  └────┬─────┘
    └────┬─────┘        │           │         │            │
         │              │           │         │            │
         └──────┬───────┴───────────┴─────────┘            │
                │                                          │
                ▼                                          │
         ┌──────────┐                                      │
         │ service  │◄─────────────────────────────────────┘
         └────┬─────┘
              │
    ┌─────────┼─────────┬────────────┐
    │         │         │            │
    ▼         ▼         ▼            ▼
┌────────┐┌────────┐┌──────────┐┌───────────┐
│reposit-││integra-││saksflyt- ││   domain  │
│  ory   ││  sjon  ││   api    │└─────┬─────┘
└───┬────┘└───┬────┘└────┬─────┘      │
    │         │          │            │
    └─────────┴──────────┴────────────┘
                         │
                         ▼
                    ┌─────────┐
                    │  feil   │ ← Base exception module
                    └─────────┘

Module Descriptions

ModulePurposeKey Contents
appSpring Boot entry pointMain class, Flyway migrations, profiles
frontend-apiREST endpoints for melosys-webControllers, DTOs, GraphQL
saksflytSaga orchestrationSaga implementations, step handlers
saksflyt-apiSaga contracts/eventsEvent classes, saga interfaces
serviceBusiness logicCore services, validation, calculations
repositoryData accessJPA repositories, queries
integrasjonExternal systemsPDL, EESSI, Joark, Kafka consumers
domainJPA entitiesEntities, embeddables, converters
sikkerhetSecurityOIDC, ABAC, token handling
configCross-cutting configMDC, Unleash, ShedLock, metrics
statistikkDVH reportingEvent listeners, statistics producers
feilException hierarchyTekniskException, FunksjonellException
soknad-altinnAltinn A1 form typesJAXB classes generated from NAV_MedlemskapArbeidEOS XSD (no internal deps; used by integrasjon)

Dependency Rules

Allowed dependencies (downward only):

app → frontend-api, saksflyt, config, sikkerhet, statistikk, domain
frontend-api → service, repository, domain, sikkerhet, feil
saksflyt → service, saksflyt-api, domain, config, feil
service → repository, integrasjon, saksflyt-api, domain, config, feil
statistikk → service, domain
repository → domain
integrasjon → domain, sikkerhet, config, feil, soknad-altinn
saksflyt-api → domain, config
domain → feil
sikkerhet → feil
config → sikkerhet
feil → (none)

Forbidden: Circular dependencies, upward dependencies

Source of truth: These rules are derived from each module's pom.xml <dependencies> (artifacts under groupId no.nav.melosys, e.g. melosys-domain, melosys-integrasjon). They are hand-maintained here — regenerate from the POMs if module dependencies change.

Impact Analysis

When modifying code, test dependent modules:

If you change...Test these modules
feildomain, service, saksflyt, frontend-api, integrasjon, sikkerhet
domainrepository, service, saksflyt, frontend-api, integrasjon, saksflyt-api
repositoryservice, frontend-api
integrasjonservice
saksflyt-apiservice, saksflyt
servicesaksflyt, frontend-api, statistikk
sikkerhetintegrasjon, frontend-api, config
configservice, saksflyt, saksflyt-api, integrasjon

Placement Guidelines

Type of codeModule
REST endpointfrontend-api
Business logicservice
JPA entitydomain
Repository interfacerepository
External API clientintegrasjon
Saga/workflowsaksflyt (impl), saksflyt-api (contract)
Security filtersikkerhet
Kafka consumerintegrasjon
Kafka producerservice or integrasjon
Statistics listenerstatistikk
Flyway migrationapp
Cross-cutting configconfig
Custom exceptionfeil

Data Flow Examples

REST Request Flow

frontend-api → service → repository → domain
                     ↘→ integrasjon (external calls)

Saga Flow

frontend-api → service → saksflyt-api (event)
                              ↓
                         saksflyt (saga execution)
                              ↓
                         service (steps)

Kafka Event Flow

integrasjon (consumer) → service → domain/repository
service → integrasjon (producer)

Test Module

ModuleType
integrasjonstestIntegration tests with Spring context
arkitekturArchUnit architecture tests

Run integration tests with: mvn verify -pl integrasjonstest

Enforcement

The module-level boundaries above are enforced primarily by Maven: a module can only reference code in modules it declares as <dependencies>. The ArchUnit test arkitektur/src/test/kotlin/no/nav/melosys/ArkitekturTestIT.kt adds a coarser layering check on packages (Controller ..tjenester.gui.. → Service ..service.. → Integrations ..integrasjon.. / Persistence ..repository..), so it is weaker than — not a substitute for — the module dependency rules.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Expert knowledge of Altinn A1 application processing for posted workers in melosys-api. Use when: (1) Understanding Altinn søknad/skjema processing, (2) Debugging MedlemskapArbeidEOS form mapping, (3) Understanding SoeknadMapper transformations, (4) Investigating posted worker application issues, (5) Understanding the MOTTAK_SOKNAD_ALTINN saga flow.

The English summary is being prepared. Showing the original description.

navikt/melosys-api2Updated Oct 21, 2026

Expert knowledge of Employer/Employment integration (EREG/AAREG) in melosys-api. Use when: (1) Working with organization data from EREG (Enhetsregisteret), (2) Working with employment data from AAREG (Arbeidsforhold), (3) Understanding employer/organization lookup, (4) Debugging employer or employment issues, (5) Understanding the mapping between register data and domain models. Triggers: orgnummer, arbeidsforhold, EREG, AAREG, Enhetsregisteret, registeropplysninger, ansettelsesperiode, saksopplysning.

The English summary is being prepared. Showing the original description.

navikt/melosys-api2Updated Oct 21, 2026

Expert knowledge of Behandling (case treatment) domain in melosys-api. Use when: (1) Understanding the behandling lifecycle and status transitions, (2) Debugging issues with behandling creation, status changes, or closure, (3) Understanding relationships between Fagsak, Behandling, and Behandlingsresultat, (4) Investigating why a behandling is stuck or has wrong status, (5) Understanding Behandlingstyper, Behandlingstema, Behandlingsstatus enums, (6) Debugging journalføring or SED-triggered behandling creation, (7) Understanding behandling creation via saksflyt sagas.

The English summary is being prepared. Showing the original description.

navikt/melosys-api2Updated Oct 21, 2026

Expert knowledge of Behandlingsresultat (treatment result) domain in melosys-api. Use when: (1) Understanding result types and their meaning (FASTSATT_LOVVALGSLAND, MEDLEM_I_FOLKETRYGDEN, etc.), (2) Working with periods - Lovvalgsperiode, Medlemskapsperiode, Anmodningsperiode, Utpekingsperiode, (3) Debugging vedtak/decision metadata, criteria evaluation, or social insurance charges, (4) Understanding EU/EEA coordination logic and Article 16 exception handling, (5) Working with trygdeavgift (social insurance charge) calculations.

The English summary is being prepared. Showing the original description.

navikt/melosys-api2Updated Oct 21, 2026

brev

Free

Expert knowledge of Brev (letter generation) in melosys-api. Use when: (1) Producing letters and decision documents (vedtaksbrev), (2) Understanding Dokgen templates and mapping, (3) Configuring letter recipients and distribution, (4) Debugging letter generation issues, (5) Adding new letter types or templates.

The English summary is being prepared. Showing the original description.

navikt/melosys-api2Updated Oct 21, 2026

Expert knowledge of the melosys-api Oracle database schema. Use when: (1) Writing SQL queries against the melosys database, (2) Understanding table relationships and foreign keys, (3) Debugging data issues by querying the database, (4) Understanding what data is stored where, (5) Creating or modifying Flyway migrations, (6) Mapping domain entities to database tables. Triggers: SQL against melosys DB, table/column lookup, FK relationships, "where is X stored", "what column stores X", "why is data missing", beh_resultat_id, behandlingsresultat_id, saksnummer, schema.

The English summary is being prepared. Showing the original description.

navikt/melosys-api2Updated Oct 21, 2026

See all skills by navikt

Report a problem with this skill