# Mitgliederverwaltung

A Nextcloud app for managing members, families, fees, camps and more for scouting associations (_Pfadfindervereine_). Integrates with Nextcloud Calendar, Contacts and Files.

## Prerequisites

- Docker & Docker Compose
- Node.js (for building the frontend)

## Quick Start

```bash
# 1. Create your .env from the example and adjust passwords
cp .env.example .env

# 2. Build frontend + vendor deps, start containers, install Nextcloud, enable app
make deploy
```

Nextcloud will be available at **http://localhost:8080**.
Log in with the `NEXTCLOUD_ADMIN_USER` / `NEXTCLOUD_ADMIN_PASSWORD` from your `.env`.

## Make Targets

| Target | Description |
|---|---|
| `make deploy` | Full first-time setup: install deps, build frontend, start containers, install Nextcloud, copy & enable app |
| `make redeploy` | Rebuild frontend and re-copy the app into a running Nextcloud (use after code changes) |
| `make build` | Install deps and build the frontend (production) |
| `make deps` | Install npm and Composer dependencies only |
| `make up` | Start containers in the background |
| `make down` | Stop containers |
| `make logs` | Tail Nextcloud container logs |
| `make clean` | Stop containers **and delete all volumes** (full reset) |
| `make package` | Build and create a distributable `tar.gz` (optionally Ed25519-signed) |
| `make release` | Package, tag, and upload as a Gitea release |

## Production Installation

To install on an existing Nextcloud 28+ instance (without Docker):

1. Download the latest release tarball from the [Releases page](https://git.shahondin1624.de/shahondin1624/Mitgliederverwaltung/releases), or build it yourself with `make package`
2. Extract into your Nextcloud `custom_apps` directory:
   ```bash
   tar -xzf mitgliederverwaltung-*.tar.gz -C /path/to/nextcloud/custom_apps/
   chown -R www-data:www-data /path/to/nextcloud/custom_apps/mitgliederverwaltung
   ```
3. Enable the app:
   ```bash
   sudo -u www-data php /path/to/nextcloud/occ app:enable mitgliederverwaltung
   ```

## Development Workflow

After the initial `make deploy`, the typical cycle is:

```bash
# Watch for frontend changes (auto-rebuilds on save)
npm run watch

# After changes, copy the rebuilt app into the running container
make redeploy
```

### npm Scripts

| Script | Description |
|---|---|
| `npm run build` | Production webpack build |
| `npm run dev` | Development webpack build (once) |
| `npm run watch` | Development build with file watching |

## Environment Variables

Copy `.env.example` to `.env` and set your values:

| Variable | Description |
|---|---|
| `MYSQL_ROOT_PASSWORD` | MariaDB root password |
| `MYSQL_DATABASE` | Database name (default: `nextcloud`) |
| `MYSQL_USER` | Database user (default: `nextcloud`) |
| `MYSQL_PASSWORD` | Database user password |
| `NEXTCLOUD_ADMIN_USER` | Nextcloud admin username |
| `NEXTCLOUD_ADMIN_PASSWORD` | Nextcloud admin password |

## Architecture

- **Backend**: PHP (Nextcloud app framework), served by Nextcloud 28 (Apache)
- **Frontend**: Vue 3 + Pinia + Vue Router, using `@nextcloud/vue` components
- **Database**: MariaDB 10.11
- **Build**: Webpack 5, Babel, Sass

## License

AGPL
