Spring Community ships with two deployment paths: a Docker Compose setup that orchestrates the Spring Boot application and PostgreSQL 15 together in isolated containers, and a direct Maven Wrapper run for developers who prefer a local database. Both approaches rely on the same set of environment variables and produce an identical API surface. Docker Compose is recommended for the fastest, most reproducible setup.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/CristianRR94/springCommunity/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- Docker 24+ with the Docker Engine running.
- Docker Compose v2 — included with Docker Desktop on macOS and Windows, and available as the
docker composeplugin on Linux.
Docker Compose Setup
Thedocker-compose.yml at the root of the repository defines two services: app (the Spring Boot API) and postgres (the database). Here is the complete file:
app— builds from the localDockerfile, exposes the Spring Boot API on port 8080, and mounts the project root and local Maven cache (.m2) into the container so that the Maven Wrapper can resolve dependencies without downloading them again on every restart. The service starts only after thepostgresservice is up.postgres— runs PostgreSQL 15 Alpine, creates a database namedcommunitydbon first boot, and persists data to the named volumepostgres_data. Note that the host port is 5433 (mapped to internal container port 5432), so local clients should connect tolocalhost:5433.
Required Environment Variables
Set these variables before runningdocker compose up. Variables marked required have no default and will cause the application to fail to start if omitted.
| Variable | Required | Default | Description |
|---|---|---|---|
JWT_SECRET | ✅ Required | — | Base64-encoded HMAC secret key used to sign and verify JWTs. Must be sufficiently long (≥ 64 bytes before encoding) for security. |
SPRING_DATASOURCE_PASSWORD | ✅ Required | — | Password for the PostgreSQL postgres user inside the app container. Must match DB_PASSWORD. |
DB_PASSWORD | ✅ Required | — | Password set on the PostgreSQL container itself (POSTGRES_PASSWORD). Must match SPRING_DATASOURCE_PASSWORD. |
JWT_EXPIRATION | Optional | 3600000 (1 hour) | Access token lifetime in milliseconds. Overridden to 36000000 (10 hours) in docker-compose.yml. |
JWT_REFRESH_EXPIRATION | Optional | 604800000 (7 days) | Refresh token lifetime in milliseconds. |
Creating a .env file
Docker Compose automatically loads a .env file in the same directory as docker-compose.yml. Create one to avoid exporting variables manually each time:
--build flag rebuilds the app image. On subsequent starts where the source has not changed you can omit it:
-d (detach) flag:
http://localhost:8080 once you see Started CommunityApplication in the community-app container logs.
Manual Build (No Docker)
If you have Java 25 and PostgreSQL 15 installed locally, you can run the application directly with the Maven Wrapper. Export the required environment variables in your shell first:application.properties resolves the datasource URL from DB_URL (falling back to jdbc:postgresql://localhost:5432/communitydb) and the username from DB_USER (falling back to postgres). Override them if your local setup differs:
Database
Spring Community uses PostgreSQL 15 with a database namedcommunitydb. All schema management is handled by Hibernate DDL auto-update — the entity model is the source of truth for the database schema.
| Setting | Value |
|---|---|
| Database engine | PostgreSQL 15 Alpine (Docker) |
| Database name | communitydb |
| Default username | postgres |
| Internal container port | 5432 |
| Exposed host port (Docker Compose) | 5433 |
| Schema management | Hibernate ddl-auto=update |
| Data persistence | Named Docker volume postgres_data |
Production Considerations
Before deploying to a public-facing environment, review and update the following: CORS allowed origins —AuthController carries a @CrossOrigin("http://localhost:4200") annotation targeting the default Angular development server. Change this to your actual frontend domain, or replace the per-controller annotation with a centralised CORS configuration in WebSecurityConfig:
changeme password with a strong, randomly generated password. Ensure the .env file (or your secrets manager) is never committed to source control.
Volume and storage — Uploaded images are stored in the storage.location directory (default: images/). In production, mount this path to persistent external storage or an object storage bucket to avoid data loss on container restarts.