150 lines
2.5 KiB
Markdown
150 lines
2.5 KiB
Markdown
# b0esche.cloud
|
|
|
|
A self-hosted, SaaS-style document platform with Go backend and Flutter web frontend.
|
|
|
|
## Project Structure
|
|
|
|
- `go_cloud/`: Go backend (control plane) with REST API
|
|
- `b0esche_cloud/`: Flutter web frontend with BLoC architecture
|
|
- Supporting services: Nextcloud (storage), Collabora (editing), PostgreSQL (database)
|
|
|
|
## Prerequisites
|
|
|
|
- Go 1.21+
|
|
- Flutter 3.10+
|
|
- Docker and Docker Compose
|
|
- PostgreSQL (or Docker)
|
|
- Nextcloud instance
|
|
- Collabora Online instance
|
|
|
|
## Local Development Setup
|
|
|
|
### 1. Start Supporting Services
|
|
|
|
Use Docker Compose to start PostgreSQL, Nextcloud, and Collabora:
|
|
|
|
```bash
|
|
docker-compose up -d db nextcloud collabora
|
|
```
|
|
|
|
### 2. Backend Setup
|
|
|
|
```bash
|
|
cd go_cloud
|
|
cp .env.example .env
|
|
# Edit .env with your configuration (DB URL, Nextcloud URL, etc.)
|
|
go run ./cmd/api
|
|
```
|
|
|
|
Or use the provided script:
|
|
|
|
```bash
|
|
./scripts/dev-backend.sh
|
|
```
|
|
|
|
### 3. Frontend Setup
|
|
|
|
```bash
|
|
cd b0esche_cloud
|
|
flutter pub get
|
|
flutter run -d chrome
|
|
```
|
|
|
|
Or use the script:
|
|
|
|
```bash
|
|
./scripts/dev-frontend.sh
|
|
```
|
|
|
|
### 4. Full Development Environment
|
|
|
|
To start everything:
|
|
|
|
```bash
|
|
./scripts/dev-all.sh
|
|
```
|
|
|
|
This will bring up all services, backend, and frontend.
|
|
|
|
## Configuration
|
|
|
|
### Backend (.env)
|
|
|
|
Copy `go_cloud/.env.example` to `go_cloud/.env` and fill in:
|
|
|
|
- `DATABASE_URL`: PostgreSQL connection string
|
|
- `JWT_SECRET`: Random secret for JWT signing
|
|
- `OIDC_*`: OIDC provider settings
|
|
- `NEXTCLOUD_*`: Nextcloud API settings
|
|
- `COLLABORA_*`: Collabora settings
|
|
|
|
### Frontend
|
|
|
|
The frontend uses build-time environment variables for API base URL. For dev, it's hardcoded in `ApiClient` constructor.
|
|
|
|
For production builds, update accordingly.
|
|
|
|
## Running Tests
|
|
|
|
### Backend
|
|
|
|
```bash
|
|
cd go_cloud
|
|
go test ./...
|
|
```
|
|
|
|
### Frontend
|
|
|
|
```bash
|
|
cd b0esche_cloud
|
|
flutter test
|
|
```
|
|
|
|
## Building for Production
|
|
|
|
### Backend
|
|
|
|
```bash
|
|
cd go_cloud
|
|
go build -o bin/api ./cmd/api
|
|
```
|
|
|
|
### Frontend
|
|
|
|
```bash
|
|
cd b0esche_cloud
|
|
flutter build web
|
|
```
|
|
|
|
## Database Migrations
|
|
|
|
Migrations are in `go_cloud/migrations/`.
|
|
|
|
To apply:
|
|
|
|
```bash
|
|
# Dev
|
|
go run github.com/pressly/goose/v3/cmd/goose@latest postgres "$DATABASE_URL" up
|
|
|
|
# Production
|
|
# Use your deployment tool to run the migration command
|
|
```
|
|
|
|
## Backup Strategy
|
|
|
|
- **Database**: Regular PostgreSQL dumps of orgs, memberships, activities
|
|
- **Files**: Nextcloud/S3 backups handled at storage layer
|
|
- **Recovery**: Restore DB, then files; Go control plane is stateless
|
|
|
|
## Contributing
|
|
|
|
1. Clone the repo
|
|
2. Follow local setup
|
|
3. Make changes
|
|
4. Run tests
|
|
5. Submit PR
|
|
|
|
## License
|
|
|
|
[License here]
|