summaryrefslogtreecommitdiff
path: root/CLAUDE.md
blob: 3b3ea10ac054a4b7aa091a6da16ad07d5e98b5e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Development Commands

### Running the Application
```bash
./mvnw quarkus:dev
```
Run with live reloading enabled for development.

### Building and Testing
```bash
./mvnw package                    # Build JAR and Docker image
./mvnw package -Pnative          # Build native image with GraalVM
./mvnw spotless:apply            # Apply Google Java Format
./mvnw spotless:check            # Check code formatting
ant web                          # Bundle web scripts and stylesheets
ant clean                        # Clean all build artifacts
```

### Web Resources
```bash
ant web                          # Build web resources (CSS, JS)
ant web.resources               # Generate web resources only
ant web.check                   # Run Flow and ESLint checks
```

### Database
```bash
./mvnw liquibase:update         # Apply database migrations
./mvnw liquibase:rollback       # Rollback database changes
```

### Deployment
```bash
ant deploy                      # Deploy to Kubernetes
```

## Project Architecture

MulkCMS2 is a Java-based CMS built with Quarkus, featuring a hybrid architecture with two main systems:

### Core Packages
- **benki/** - Modern CMS functionality (posts, bookmarks, wiki, users, chat)
- **cms/** - Legacy CMS system (articles, traditional pages, legacy journal)
- **common/** - Shared utilities (markdown, hibernate, logging, templates)

### Key Architectural Patterns
- **Post Abstraction**: All content types inherit from `Post` base class
- **Dual User Systems**: Both `benki.users.User` and `cms.users.User` exist for legacy compatibility
- **Panache ORM**: Uses Quarkus Panache for simplified Hibernate operations
- **Role-based Security**: Complex visibility controls (PUBLIC, SEMIPRIVATE, PRIVATE, DISCRETIONARY)

### Technology Stack
- **Framework**: Quarkus 3.24.2
- **Database**: PostgreSQL with Hibernate ORM 7.0.4
- **Authentication**: OIDC/Keycloak (prod), embedded users (dev)
- **Templates**: Qute
- **Build**: Maven + Ant for web resources
- **Containerization**: Docker via Jib

## Development Environment

### Database Setup
- Development: PostgreSQL at localhost:5432/mulkcms
- Production: PostgreSQL at postgresql.system:5432/mulkcms
- Uses Liquibase for schema management

### Authentication
- Development: Embedded user system (user: mulk, password: mulk, role: Admin)
- Production: OIDC with Keycloak at login.benkard.de

### Configuration Profiles
- `%dev.*` - Development configuration
- `%prod.*` - Production configuration
- Configuration in `src/main/resources/application.properties`

## Important File Locations

### Configuration
- `src/main/resources/application.properties` - Main configuration
- `src/main/resources/db/changeLog.xml` - Liquibase migrations
- `pom.xml` - Maven dependencies and build configuration
- `build.xml` - Ant build script for web resources

### Templates
- `src/main/resources/templates/` - Qute templates
- `src/main/resources/META-INF/resources/` - Static web resources

### Entity Packages
- `src/main/java/eu/mulk/mulkcms2/benki/` - Entities for microblogging, inherited from Benki
- `src/main/java/eu/mulk/mulkcms2/cms/` - Entities for ordinary blogging, inherited from MulkCMS 1.x

## Code Style and Standards

- **Google Java Format**: Enforced via Spotless plugin
- **Import Order**: java,javax,org,com,de,io,dagger,eu.mulk
- **Java**: Target version 17; prefer to use the newest features
- **Annotations**: Uses JetBrains, JSR305, and basic annotations

## Common Development Tasks

### Adding New Content Types
1. Create entity extending `Post` in benki/ package
2. Add corresponding REST resource class
3. Create Qute templates if needed
4. Update database schema via Liquibase

### Working with Database
- All entities use Panache for simplified ORM
- PostgreSQL-specific features extensively used
- Full-text search available via custom Hibernate functions

### Frontend Development
- Web resources managed by Ant build script
- Uses Snowpack for module bundling
- Parcel for final asset bundling
- ESLint and Flow for code quality

### Security Considerations
- Role-based access control throughout
- Visibility controls on all content
- CSRF protection via Quarkus security
- Multiple authentication backends supported