2025-12-18 00:11:30 +01:00
|
|
|
# b0esche.cloud
|
|
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
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) │
|
|
|
|
|
└──────────┘ └──────────┘ └──────────┘
|
|
|
|
|
```
|
2025-12-18 00:11:30 +01:00
|
|
|
|
|
|
|
|
## Project Structure
|
|
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
```
|
|
|
|
|
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
|
|
|
|
|
│ │ └── 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
|
2025-12-18 00:11:30 +01:00
|
|
|
|
|
|
|
|
## Prerequisites
|
|
|
|
|
|
|
|
|
|
- Go 1.21+
|
|
|
|
|
- Flutter 3.10+
|
2026-01-13 19:23:33 +01:00
|
|
|
- Docker & Docker Compose
|
|
|
|
|
- PostgreSQL 15+
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
## Local Development
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
### Quick Start
|
2025-12-18 00:11:30 +01:00
|
|
|
|
|
|
|
|
```bash
|
2026-01-13 19:23:33 +01:00
|
|
|
# Start everything
|
|
|
|
|
./scripts/dev-all.sh
|
2025-12-18 00:11:30 +01:00
|
|
|
```
|
|
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
### Manual Setup
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
**Backend:**
|
2025-12-18 00:11:30 +01:00
|
|
|
```bash
|
|
|
|
|
cd go_cloud
|
|
|
|
|
cp .env.example .env
|
2026-01-13 19:23:33 +01:00
|
|
|
# Edit .env with your configuration
|
2025-12-18 00:11:30 +01:00
|
|
|
go run ./cmd/api
|
|
|
|
|
```
|
|
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
**Frontend:**
|
2025-12-18 00:11:30 +01:00
|
|
|
```bash
|
|
|
|
|
cd b0esche_cloud
|
|
|
|
|
flutter pub get
|
|
|
|
|
flutter run -d chrome
|
|
|
|
|
```
|
|
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
## Configuration
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
### Backend Environment Variables
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
| 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 |
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
## Production Deployment
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
The project runs on a VPS with Docker containers behind Traefik reverse proxy.
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
### Services & Domains
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
| 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) |
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
### Server Directory Structure
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
```
|
|
|
|
|
/opt/
|
|
|
|
|
├── traefik/ # Reverse proxy + SSL
|
|
|
|
|
├── go/ # Go backend + PostgreSQL
|
|
|
|
|
├── flutter/ # Flutter web build + Nginx
|
|
|
|
|
├── scripts/ # Operations scripts
|
|
|
|
|
└── auto-deploy/ # Auto-deployment workspace
|
|
|
|
|
```
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
### Server Scripts
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
| 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 |
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
### Deployment Commands
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
```bash
|
|
|
|
|
# Trigger immediate deploy
|
|
|
|
|
ssh b0esche-cloud '/opt/scripts/deploy-now.sh'
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
# Check backend logs
|
|
|
|
|
ssh b0esche-cloud 'docker logs go-backend -f'
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
# Check service status
|
|
|
|
|
ssh b0esche-cloud 'docker ps --format "table {{.Names}}\t{{.Status}}"'
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
# Health checks
|
|
|
|
|
curl -s https://go.b0esche.cloud/health
|
|
|
|
|
curl -s https://www.b0esche.cloud | grep -o '<title>.*</title>'
|
2025-12-18 00:11:30 +01:00
|
|
|
```
|
|
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
### Starting Services (Manual)
|
2025-12-18 00:11:30 +01:00
|
|
|
|
|
|
|
|
```bash
|
2026-01-13 19:23:33 +01:00
|
|
|
# Start all services in order
|
|
|
|
|
ssh b0esche-cloud 'cd /opt/traefik && docker-compose up -d'
|
|
|
|
|
ssh b0esche-cloud 'cd /opt/go && docker-compose up -d'
|
|
|
|
|
ssh b0esche-cloud 'cd /opt/flutter && docker-compose up -d'
|
2025-12-18 00:11:30 +01:00
|
|
|
```
|
|
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
## Database Migrations
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
Migrations are in `go_cloud/migrations/`:
|
2025-12-18 00:11:30 +01:00
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
cd go_cloud
|
2026-01-13 19:23:33 +01:00
|
|
|
go run github.com/pressly/goose/v3/cmd/goose@latest postgres "$DATABASE_URL" up
|
2025-12-18 00:11:30 +01:00
|
|
|
```
|
|
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
## Backup & Recovery
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
Backups run daily and include:
|
|
|
|
|
- PostgreSQL database dumps
|
|
|
|
|
- Nextcloud database
|
|
|
|
|
- Traefik certificates
|
|
|
|
|
- Docker volumes
|
|
|
|
|
- Configuration files
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
Backups are retained for 30 days.
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
```bash
|
|
|
|
|
# Manual backup
|
|
|
|
|
ssh b0esche-cloud '/opt/scripts/backup.sh'
|
|
|
|
|
```
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
## Testing
|
2025-12-18 00:11:30 +01:00
|
|
|
|
|
|
|
|
```bash
|
2026-01-13 19:23:33 +01:00
|
|
|
# Backend tests
|
|
|
|
|
cd go_cloud && go test ./...
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
# Frontend tests
|
|
|
|
|
cd b0esche_cloud && flutter test
|
2025-12-18 00:11:30 +01:00
|
|
|
```
|
|
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
## Tech Stack
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
| Component | Technology |
|
|
|
|
|
|-----------|------------|
|
|
|
|
|
| Frontend | Flutter Web, BLoC |
|
|
|
|
|
| Backend | Go, Chi Router |
|
|
|
|
|
| Database | PostgreSQL |
|
|
|
|
|
| Storage | Nextcloud (WebDAV) |
|
|
|
|
|
| Office | Collabora Online |
|
|
|
|
|
| Auth | OIDC, WebAuthn |
|
|
|
|
|
| Proxy | Traefik |
|
|
|
|
|
| CI/CD | GitLab + Webhooks |
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
## Documentation
|
2025-12-18 00:11:30 +01:00
|
|
|
|
2026-01-13 19:34:46 +01:00
|
|
|
| Document | Description |
|
|
|
|
|
|----------|-------------|
|
|
|
|
|
| [ARCHITECTURE.md](docs/ARCHITECTURE.md) | System architecture, components, data flows |
|
|
|
|
|
| [API.md](docs/API.md) | Complete API endpoint reference |
|
|
|
|
|
| [AUTH.md](docs/AUTH.md) | Authentication system (Passkeys, OIDC, roles) |
|
2026-01-13 22:11:02 +01:00
|
|
|
| [SECURITY.md](docs/SECURITY.md) | Security architecture, hardening, best practices |
|
2026-01-13 19:34:46 +01:00
|
|
|
| [DEVELOPMENT.md](docs/DEVELOPMENT.md) | Local setup, coding conventions, testing |
|
|
|
|
|
| [DEPLOYMENT.md](docs/DEPLOYMENT.md) | Production deployment, operations, troubleshooting |
|
2025-12-18 00:11:30 +01:00
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
2026-01-13 19:23:33 +01:00
|
|
|
Private project - All rights reserved
|