Skip to content

raducrs/tableta-inmultirii-spring-backend

Repository files navigation

Tableta Inmultirii Spring Backend

Spring backend for website Tableta Inmultirii.

Uses Java 11 JPMS modules and applies DDD design rules.

Features:

  • API Key security

  • DynamoDB using AWS 2 SDK

  • S3 Cache

  • ETags

  • Circuit Breaker pattern

Code organization

Domain Schools

Domain of schools, pure Java implementation without any framework dependencies

Links: domain-schools - src, module

Domain Stats

Domain of stats, pure Java implementation without any framework dependencies

Links: domain-stats - src, module

Application

Spring application

Links: application - src, module, application properties

Controller

REST controller part of the hexagon ports and adapters architecture

Links: controller - src, module, application properties

Security

Spring Security layer part of the hexagon ports and adapters architecture

Implements API key authorization

Links: security - src, module, application properties

S3 Cache

Implementation that saves cache entry to S3 bucket. This allows implementation of the circuit breaker pattern in the UI, using the static image of the cache response from the S3 bucket.

Links: s3cache - src, module, application properties

Infrastructure

Domain repositories implementation part of the hexagon ports and adapters architecture

Abstracts and hides repository implementation details from the application

Links: infrastructure - src, module

  • DynamoDB Schools Repository

    Implements schools domain repositories and uses DynamoDB

    Active in profiles local and local-prod

    Links: repository-schools-dynamodb - src, module, application properties

  • DynamoDB Stats Repository

    Implements stats domain repositories and uses DynamoDB

    Active in profiles local and local-prod

    Links: [repository-stats-dynamodb](repository-stats-dynamodb - src, module, application properties

  • Test repository

    Implements stats and schools domain repositories and uses in memory DB

    Active in profiles "dev and default

    Links: [repository-test](repository-test - src, module

Deployment

Deployment as a Docker container using the provided Dockerfile based on Amazon Corretto

Production deployment requires the following environment variables (provided by docker parameter --env-file local.env )

Example file local.env

# repository-stats-dynamodb
AMAZON_AWS_ACCESSKEY_STATS=<accesskey>
AMAZON_AWS_SECRETKEY_STATS=<secretkey>
AMAZON_DYNAMODB_TABLE_STATS=<tablename>

# repository-schools-dynamodb
AMAZON_AWS_ACCESSKEY_SCHOOLS=<accesskey>
AMAZON_AWS_SECRETKEY_SCHOOLS=<secretkey>
AMAZON_DYNAMODB_TABLE_SCHOOLS=<tablename>

# cache
AMAZON_AWS_ACCESSKEY=<accesskey>
AMAZON_AWS_SECRETKEY=<secretkey>
AMAZON_S3_BUCKET=<bucketname>

# security
API_ACCESS_TOKEN=<apikey>

Releases

No releases published

Packages

No packages published