# b0esche.cloud A self-hosted, SaaS-style cloud storage and document platform with a Go backend and Flutter web frontend. π **Live:** [b0esche.cloud](https://b0esche.cloud) ## Architecture ``` βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β Flutter Web ββββββΆβ Go Backend ββββββΆβ PostgreSQL β β (b0esche_cloud)β β (go_cloud) β β β βββββββββββββββββββ ββββββββββ¬βββββββββ βββββββββββββββββββ β ββββββββββββββΌβββββββββββββ βΌ βΌ βΌ ββββββββββββ ββββββββββββ ββββββββββββ βNextcloud β βCollabora β β Traefik β β(Storage) β β (Office) β β (Proxy) β ββββββββββββ ββββββββββββ ββββββββββββ ``` ## Project Structure ``` b0esche_cloud/ βββ b0esche_cloud/ # Flutter web frontend β βββ lib/ β β βββ blocs/ # BLoC state management β β βββ models/ # Data models β β βββ pages/ # UI pages β β βββ repositories/ # Data repositories β β βββ services/ # API services β β βββ theme/ # App theming β β βββ viewmodels/ # View models β β βββ widgets/ # Reusable widgets β βββ web/ # Web assets βββ go_cloud/ # Go backend β βββ cmd/api/ # Main entry point β βββ internal/ β β βββ auth/ # Authentication (OIDC, Passkeys) β β βββ files/ # File management β β βββ org/ # Organization management β β βββ storage/ # Nextcloud/WebDAV integration β β βββ http/ # HTTP handlers & WOPI β β βββ ... β βββ migrations/ # Database migrations β βββ pkg/jwt/ # JWT utilities βββ scripts/ # Deployment & operations scripts βββ docs/ # Documentation βββ AUTH.md # Authentication system docs ``` ## Features - π **Authentication**: OIDC via Nextcloud + WebAuthn Passkeys - π **File Management**: Upload, download, organize files - π₯ **Organizations**: Multi-tenant with roles (Owner, Admin, Member) - π **Document Viewing**: PDF viewer, Office document preview - π **Real-time Sync**: Nextcloud/WebDAV backend storage - π **Auto-deployment**: Daily 3AM deployments via GitLab webhooks ## Prerequisites - Go 1.21+ - Flutter 3.10+ - Docker & Docker Compose - PostgreSQL 15+ ## Local Development ### Quick Start ```bash # Start everything ./scripts/dev-all.sh ``` ### Manual Setup **Backend:** ```bash cd go_cloud cp .env.example .env # Edit .env with your configuration go run ./cmd/api ``` **Frontend:** ```bash cd b0esche_cloud flutter pub get flutter run -d chrome ``` ## Configuration ### Backend Environment Variables | Variable | Description | |----------|-------------| | `SERVER_ADDR` | Server address (default: `:8080`) | | `DATABASE_URL` | PostgreSQL connection string | | `JWT_SECRET` | Secret for JWT signing | | `OIDC_ISSUER_URL` | OIDC provider URL | | `OIDC_CLIENT_ID` | OIDC client ID | | `OIDC_CLIENT_SECRET` | OIDC client secret | | `NEXTCLOUD_URL` | Nextcloud instance URL | | `NEXTCLOUD_USERNAME` | Nextcloud admin username | | `NEXTCLOUD_PASSWORD` | Nextcloud admin password | | `COLLABORA_URL` | Collabora Online URL | ## Production Deployment The project runs on a VPS with Docker containers behind Traefik reverse proxy. ### Services & Domains | Domain | Service | |--------|---------| | `www.b0esche.cloud` | Flutter Web (Nginx) | | `go.b0esche.cloud` | Go API Backend | | `storage.b0esche.cloud` | Nextcloud (Storage + OIDC) | | `of.b0esche.cloud` | Collabora Online (Office) | ### Server Directory Structure ``` /opt/ βββ traefik/ # Reverse proxy + SSL βββ go/ # Go backend + PostgreSQL βββ flutter/ # Flutter web build + Nginx βββ scripts/ # Operations scripts βββ auto-deploy/ # Auto-deployment workspace ``` ### Server Scripts | Script | Description | |--------|-------------| | `auto-deploy.sh` | Daily automated deployment (runs at 3AM) | | `deploy-now.sh` | Trigger immediate deployment | | `backup.sh` | Full backup (DB, configs, volumes) | | `monitor.sh` | Health monitoring & alerts | | `webhook-server.py` | GitLab webhook receiver | ### Deployment Commands ```bash # Trigger immediate deploy ssh b0esche-cloud '/opt/scripts/deploy-now.sh' # Check backend logs ssh b0esche-cloud 'docker logs go-backend -f' # Check service status ssh b0esche-cloud 'docker ps --format "table {{.Names}}\t{{.Status}}"' # Health checks curl -s https://go.b0esche.cloud/health curl -s https://www.b0esche.cloud | grep -o '