How finnishtransportagency/digiroad2 works
Project type & purpose
• Digiroad2 is a full-stack, GIS-focused asset management application.
• It comprises:
• A rich client UI (vanilla JS/LESS/HTML built via Grunt)
• A Scala/SBT‐powered REST API server (Scalatra)
• Geo-processing logic (digiroad2-geo)
• Oracle/PostGIS persistence modules (digiroad2-oracle, digiroad2-api-common)
• CI/CD and infra provisioning (AWS CloudFormation, ECS Fargate, CodeArtifact, CodeBuild, RDS/Postgres or Oracle, ElastiCache, SNS, S3, Batch/Lambda)
File structure & architectural hints
• UI/ – front-end code, static assets, tests, Grunt build → client runs in browser
• src/main/scala/ – Scalatra bootstrap & server → single JVM process exposing REST endpoints
• digiroad2-api-* & digiroad2-geo & digiroad2-oracle modules → core libraries packaged/injected at runtime
• aws/cloud-formation & aws/fargate – infra definitions for container deployment, networking, DB, cache, message topics, batch jobs
• local-dev – Docker Compose setup for local PostGIS emulation
• build tooling: Grunt for UI; SBT for server; npm/CodeArtifact for JS packages; CloudFormation/CLI scripts for deployment
Key README insights
• Local setup involves dockerized PostGIS, Grunt watch/server, and running the Scala server via SBT.
• Production uses AWS: ECR/ECS‐Fargate tasks behind an ALB, RDS or Oracle, ElastiCache, SNS, S3 buckets, Parameter Store for secrets.
• CI pipelines defined in CloudFormation (CodeBuild/CodePipeline).
Components
A. Client tier
– Browser: static UI assets (HTML/JS/CSS) served either from S3 (prod) or local Grunt server (dev)
– Integration tests / RobotFramework tests for end-to-end verification
B. API tier
– ECS Fargate task running the Scala Scalatra container
– REST endpoints (Digiroad2Api) serving geo/assets CRUD, import/export, CSV user management
C. Data tier
– RDS Postgres (dev) / Oracle DB (prod via digiroad2-oracle module)
– ElastiCache (Redis) for caching road link data
– S3 buckets for static hosting (UI, swagger UI) and data import/export
D. Infrastructure & services
– ALB (Application Load Balancer) → routes /api/* to ECS tasks, /static to S3
– IAM Roles/Parameter Store for secrets & config
– CloudWatch Logs & Metrics
– CodeArtifact (npm repo) & ECR (Docker images)
– CodeBuild/CodePipeline (CI/CD)
– SNS Topics for user notifications
– BatchSystem & Lambda for scheduled batch processes (e.g., data import/export)
E. External integrations
– VVH & VKM REST APIs (via client modules)
– Google Maps & raster services (apiKey stashed in env)
Relationships & data flows
• Browser → ALB → ECS REST API
• API → RDS/Postgres or Oracle (JDBC via BoneCP)
• API ↔ Redis cache (road link & session caching)
• API → S3 (read/write static assets, CSV import/export)
• API ↔ External REST services (VVH, VKM)
• CI/CD: GitHub → CodeBuild → ECR → ECS (via CloudFormation/CodePipeline)
• Scheduled batch jobs: AWS Batch → Lambdas → Database
Architectural patterns & principles
• Layered monolith: front-end, API, domain logic (geo, import/export), persistence.
• Clear separation of concerns: modules for authentication, authorization policies, geo computations, DB DAO/services.
• Infrastructure-as-code: all AWS resources described in CloudFormation.
• Containerization: UI and API packaged as Docker images (Fargate).
• Caching & asynchronous messaging for scalability (ElastiCache, SNS).