How open-ent-ng/nextcloud works
Project Type and Purpose
• This is a full-stack microservice providing:
• An AngularJS sniplet plugin for ENT’s workspace module (under angularjs/).
• A React/TypeScript “Nextcloud Console” standalone frontend (under frontend/, an Nx monorepo).
• A Spring Boot backend service (backend/) that mediates between the frontends and an external Nextcloud server (via OCS and WebDAV), plus a PostgreSQL database for triggers.
File Structure
• Top-level directories:
• .github, JenkinsFile, docker-compose.yml, CI/CD configs.
• angularjs/: Legacy plugin code—SASS, HTML templates, TypeScript services/controllers/tests.
• backend/: Maven Spring Boot app—controllers, services, helpers, models, security, SQL scripts, test cases.
• frontend/: Modern React/TS/Nx app—components, containers, API services, global providers, styling, Vite config, env templates.
• Notice deployment artifacts:
• Docker Compose files in each folder, build.sh scripts, Kubernetes/Nextcloud configs in backend/deployment/nextcloud.
Pull Key Insights from the README
• Purpose: “Online document space management service for ENT synchronized on different devices using Nextcloud.”
• Two use cases:
a. Embedding Nextcloud-powered file management in the ENT workspace via sniplets.
b. Serving Nextcloud desktop client configuration (Console) protected by SSO/workflow.
• External dependencies: Nextcloud OCS API, WebDAV API, PostgreSQL DB, SAML plugin on Nextcloud server.
Main Components & Their Interactions
A. Frontends
1. ENT Workspace (hosted elsewhere)
• Loads AngularJS sniplet from angularjs/ via <sniplet template="...">.
• Communicates over HTTP/JSON to the Backend’s REST controllers (/nextcloud/...).
2. Nextcloud Console (React app in frontend/)
• Served as a standalone SPA.
• Calls backend endpoint /nextcloud/desktop/config using client-id credentials for SSO.
B. Backend Service (Spring Boot in backend/)
• Exposes REST controllers: DocumentsController, NextcloudController, UserController, NextcloudDesktopController.
• Implements MVC, DI, ServiceFactory pattern.
• Connects to:
• External Nextcloud server over OCS API and WebDAV (configurable URLs).
• PostgreSQL database for persisting/trigging SAML user replication (SQL triggers in sql/).
C. External Systems
• Nextcloud Server (OCS + WebDAV)
• PostgreSQL DB (schema migrations + trigger functions)
• SAML/SSO provider plugin for Nextcloud
D. CI/CD & Deployment
• Jenkins pipeline & GitHub Actions (.github/workflows/dev-check-repository.yml).
• Docker Compose for local/dev in each module.
• backend/deployment/nextcloud/conf.json.template for production.
Architectural Patterns & Design Principles
• Modular separation: two distinct frontends sharing one backend service.
• Backend uses layered architecture: Controller → Service → Helper → External API.
• AngularJS plugin follows MVC in TypeScript + templates + SASS.
• React frontend follows component/container pattern + global context/provider + RTK Query (emptySplitApi).
• Use of configuration-as-code (.env, ${...} placeholders) and feature flags (enable-nextcloud).
• Test coverage: unit tests in both frontends and backend.
Detail Is Key
• In the UI, differentiate between the AngularJS components (sniplets, templates, services) and React sub-modules (API service, stores, components).
• Feature flag flows (e.g., “enable-nextcloud” in ent-core.json).