Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

852 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codion Chinook Demo

A comprehensive demonstration of the Codion Application Framework, showcasing how a single codebase can seamlessly deploy as desktop, client-server, web service, and serverless applications.

Chinook Application

Overview

The Chinook demo is a full-featured enterprise application based on the Chinook music store database. It demonstrates the complete capabilities of the Codion framework through a real-world business application managing artists, albums, tracks, customers, and invoices.

Quick Start

Run Locally (Desktop Mode)

The simplest way to experience Chinook—no server required:

./gradlew chinook-client-local:run

This launches the full desktop application with an embedded in-memory H2 database.

Run as Client-Server

Start the server:

./gradlew chinook-server:run

Then connect with a client:

# Connect via RMI
./gradlew chinook-client-remote:run

# Or connect via HTTP
./gradlew chinook-client-http:run

Architecture

Domain-Driven Design

The domain model defines entities with type-safe attributes and relationships:

interface Album extends EntityDefinition {
    EntityType TYPE = DOMAIN.entityType("chinook.album");

    Column<Long> ID = TYPE.longColumn("albumid");
    Column<String> TITLE = TYPE.stringColumn("title");
    Column<byte[]> COVER = TYPE.byteArrayColumn("cover");
    ForeignKey ARTIST_FK = TYPE.foreignKey("artist_fk", ARTIST_ID, Artist.ID);

    // Derived attribute calculated from track ratings
    Attribute<Double> RATING = TYPE.doubleAttribute("rating");
}

Deployment Architecture

┌─────────────────┐     ┌─────────────────┐
│  Desktop Client │     │  Desktop Client │
│  (Swing UI)     │     │  (Swing UI)     │
└────────┬────────┘     └────────┬────────┘
         │                       │
         ▼                       ▼
┌─────────────────┐     ┌─────────────────┐
│  Local JDBC     │     │  Entity Server  │
│  (Embedded H2)  │     │  (RMI/HTTP)     │
└─────────────────┘     └─────────────────┘
         │                       │
         ▼                       ▼
   ┌──────────┐            ┌──────────┐
   │    H2    │            │    H2    │
   │ In-Memory│            │PostgreSQL│
   └──────────┘            └──────────┘

Features Demonstrated

Domain Layer

  • Entity Definitions: Type-safe column definitions with validation

  • Foreign Key Relationships: Automatic referential integrity

  • Derived Attributes: Calculated fields with dependency tracking

  • Custom Types: Array columns for tags, byte arrays for images

  • Database Functions: Stored procedures and functions integration

  • Migration System: Version-controlled schema evolution

UI Layer

  • Master-Detail Views: Synchronized selection and editing

  • Advanced Components: Custom editors, renderers, and input controls

  • Keyboard Navigation: Comprehensive shortcuts for power users

  • Search and Filtering: Powerful condition-based queries

  • Internationalization: Full i18n support

  • Preferences: User settings persistence

Infrastructure

  • Connection Modes: Local JDBC, RMI, HTTP

  • Authentication: Pluggable authentication with user management

  • Connection Pooling: HikariCP integration

  • Load Testing: Comprehensive scenarios with real-world patterns

  • Monitoring: Server monitoring UI and metrics

  • Native Packaging: Platform-specific installers via jpackage

Module Structure

The modular architecture demonstrates clean separation of concerns:

Core Modules

  • chinook-domain-api: Domain model interfaces and contracts

  • chinook-domain: Domain implementation with business logic

  • chinook-client: Swing UI implementation

Deployment Configurations

  • chinook-client-local: Desktop with embedded database

  • chinook-client-remote: RMI client configuration

  • chinook-client-http: HTTP client configuration

  • chinook-server: Multi-protocol server (RMI + HTTP)

  • chinook-service: REST API with Javalin

Supporting Modules

  • chinook-load-test: Application load testing

  • chinook-service-load-test: REST API load testing

  • chinook-server-monitor: Server monitoring UI

  • chinook-server-docker: Containerized server deployment

Building and Packaging

Generate Native Installers

Create platform-specific installers with custom runtime:

# Windows: MSI installer
# Linux: DEB package
# macOS: DMG installer
./gradlew chinook-client-local:jpackage

Create Docker Image

./gradlew chinook-server-docker:buildDockerImage

Build Documentation

./gradlew documentation:asciidoctor
# View at: documentation/build/docs/asciidoc/chinook.html

Testing

Load Test Scenarios

The load tests simulate realistic usage patterns:

  • User authentication cycles

  • Concurrent data modifications

  • Report generation

  • Complex searches

  • Bulk operations

Run load tests:

# Test RMI server
./gradlew chinook-load-test-remote:run

# Test HTTP server
./gradlew chinook-load-test-http:run

# Test REST service
./gradlew chinook-service-load-test:run

Configuration

Key configuration properties in gradle.properties:

# Server configuration
serverHost=localhost
serverPort=2223
serverHttpPort=8088
serverRegistryPort=1098
serverAdminPort=4445

# REST service configuration
servicePort=8089

# Database configuration (via system properties)
codion.db.url=jdbc:h2:mem:chinook
codion.db.initScripts=classpath:create_schema.sql

Requirements

  • Java 25 or higher

  • Gradle 8.5 or higher

  • Docker (for container deployment)

License

This demo is licensed under the GNU General Public License v3.0. See the COPYING file for details.

About

Codion Chinook Demo

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages