scaffold: React 19 + Spring Boot 3.4 + PostgreSQL project
Sets up toolchain pinning, format/lint (Biome + Spotless), lefthook pre-commit hooks, Docker Compose for Postgres, and trivial passing tests for both stacks. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.tar.gz
|
||||
wrapperVersion=3.3.2
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
# Minimal Maven Wrapper — downloads Apache Maven on first run and caches it.
|
||||
set -e
|
||||
|
||||
MAVEN_VERSION="3.9.9"
|
||||
MAVEN_CACHE="${HOME}/.m2/wrapper/dists/apache-maven-${MAVEN_VERSION}"
|
||||
MAVEN_URL="https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/${MAVEN_VERSION}/apache-maven-${MAVEN_VERSION}-bin.tar.gz"
|
||||
|
||||
if [ ! -f "${MAVEN_CACHE}/bin/mvn" ]; then
|
||||
MAVEN_TMP="${MAVEN_CACHE}.tmp.$$"
|
||||
if mkdir "${MAVEN_CACHE}.lock" 2>/dev/null; then
|
||||
echo "Downloading Apache Maven ${MAVEN_VERSION}..." >&2
|
||||
mkdir -p "${MAVEN_TMP}"
|
||||
if command -v curl > /dev/null 2>&1; then
|
||||
curl -fsSL "${MAVEN_URL}" | tar -xz --strip-components=1 -C "${MAVEN_TMP}"
|
||||
elif command -v wget > /dev/null 2>&1; then
|
||||
wget -qO- "${MAVEN_URL}" | tar -xz --strip-components=1 -C "${MAVEN_TMP}"
|
||||
else
|
||||
rm -rf "${MAVEN_TMP}" "${MAVEN_CACHE}.lock"
|
||||
echo "ERROR: curl or wget is required to download Maven" >&2
|
||||
exit 1
|
||||
fi
|
||||
mv "${MAVEN_TMP}" "${MAVEN_CACHE}"
|
||||
rm -rf "${MAVEN_CACHE}.lock"
|
||||
else
|
||||
while [ -d "${MAVEN_CACHE}.lock" ]; do sleep 0.2; done
|
||||
fi
|
||||
fi
|
||||
|
||||
exec "${MAVEN_CACHE}/bin/mvn" "$@"
|
||||
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>app</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>app</name>
|
||||
|
||||
<properties>
|
||||
<java.version>21</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-database-postgresql</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<compilerArgs>
|
||||
<arg>-Xlint:all</arg>
|
||||
<arg>-Xlint:-processing</arg>
|
||||
<arg>-Xlint:-serial</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.diffplug.spotless</groupId>
|
||||
<artifactId>spotless-maven-plugin</artifactId>
|
||||
<version>2.44.0</version>
|
||||
<configuration>
|
||||
<java>
|
||||
<googleJavaFormat>
|
||||
<version>1.23.0</version>
|
||||
<style>GOOGLE</style>
|
||||
</googleJavaFormat>
|
||||
<removeUnusedImports/>
|
||||
<trimTrailingWhitespace/>
|
||||
<endWithNewline/>
|
||||
</java>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.example.app;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class Application {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
spring:
|
||||
application:
|
||||
name: app
|
||||
datasource:
|
||||
url: ${DATABASE_URL:jdbc:postgresql://localhost:5432/app_dev}
|
||||
username: ${DATABASE_USERNAME:app}
|
||||
password: ${DATABASE_PASSWORD:app}
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
open-in-view: false
|
||||
flyway:
|
||||
enabled: true
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: ${LOG_LEVEL:INFO}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.example.app;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class ApplicationTest {
|
||||
@Test
|
||||
void applicationClassLoads() {
|
||||
assertThat(Application.class.getSimpleName()).isEqualTo("Application");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user