# Dev Container — Familienarchiv

VS Code Dev Container configuration for a pre-configured development environment. Includes Java 21, Maven, and Node.js 24 — everything needed to work on both backend and frontend.

## Configuration

File: `.devcontainer/devcontainer.json`

### Included Features

| Feature | Version                   | Purpose             |
| ------- | ------------------------- | ------------------- |
| Java    | 21                        | Spring Boot backend |
| Maven   | bundled with Java feature | Build tool          |
| Node.js | 24                        | SvelteKit frontend  |

### VS Code Extensions (Auto-installed)

| Extension                   | Purpose                                       |
| --------------------------- | --------------------------------------------- |
| `vscjava.vscode-java-pack`  | Java language support, debugging, testing     |
| `vmware.vscode-spring-boot` | Spring Boot tooling                           |
| `gabrielbb.vscode-lombok`   | Lombok annotation support                     |
| `humao.rest-client`         | HTTP request files (for `backend/api_tests/`) |

### Ports

- `8080` forwarded to host — access backend at `http://localhost:8080`

### User

Runs as `vscode` user (not root) for security.

## How to Use

### Prerequisites

- VS Code with the **Dev Containers** extension installed
- Docker running locally

### Open in Dev Container

1. Open the project in VS Code
2. Press `F1` → type "Dev Containers: Reopen in Container"
3. VS Code will:
   - Build the container using the root `docker-compose.yml`
   - Install Java 21, Maven, and Node 24
   - Install the listed extensions
   - Mount the workspace folder

### Working Inside the Container

Once inside the container, you have access to both stacks:

```bash
# Backend
cd backend
./mvnw spring-boot:run

# Frontend (in a new terminal)
cd frontend
npm install
npm run dev
```

The container reuses the `docker-compose.yml` services, so PostgreSQL and MinIO are available automatically.

### Forwarding Frontend Port

The devcontainer config only forwards port 8080 by default. To access the frontend dev server (port 5173 or 3000), either:

1. Add `5173` to `forwardPorts` in `devcontainer.json`, or
2. Use the VS Code "Ports" panel to forward it dynamically

## Limitations

- The devcontainer attaches to the `backend` service from `docker-compose.yml`, so it inherits those environment variables
- OCR service and other containers should be started separately via `docker-compose up -d`
- GPU passthrough for OCR training is not configured

## Customization

To add more tools or extensions, edit `.devcontainer/devcontainer.json`:

```json
{
  "features": {
    "ghcr.io/devcontainers/features/python:1": {
      "version": "3.11"
    }
  },
  "forwardPorts": [8080, 5173, 3000]
}
```
