mirror of
https://github.com/harivansh-afk/betterNAS.git
synced 2026-04-19 17:04:44 +00:00
update docs
This commit is contained in:
parent
c5be520772
commit
5bc24fa99d
11 changed files with 591 additions and 632 deletions
189
skeleton.md
189
skeleton.md
|
|
@ -7,17 +7,17 @@ Its job is simple:
|
|||
- lock the repo shape
|
||||
- lock the language per runtime
|
||||
- lock the first shared contract surface
|
||||
- give agents a safe place to work in parallel
|
||||
- keep the list of upstream references we are stealing from
|
||||
- keep the self-hosted stack clear
|
||||
- make later scoped execution runs easier
|
||||
|
||||
## Repo shape
|
||||
|
||||
```text
|
||||
betterNAS/
|
||||
├── apps/
|
||||
│ ├── web/ # Next.js control-plane UI
|
||||
│ ├── control-plane/ # Go control-plane API
|
||||
│ ├── node-agent/ # Go NAS runtime + WebDAV surface
|
||||
│ ├── web/ # Next.js web control plane
|
||||
│ ├── control-plane/ # Go control-server
|
||||
│ ├── node-agent/ # Go node-service and WebDAV runtime
|
||||
│ └── nextcloud-app/ # optional Nextcloud adapter
|
||||
├── packages/
|
||||
│ ├── contracts/ # canonical OpenAPI, schemas, TS types
|
||||
|
|
@ -25,23 +25,64 @@ betterNAS/
|
|||
│ ├── eslint-config/ # shared lint config
|
||||
│ └── typescript-config/ # shared TS config
|
||||
├── infra/
|
||||
│ └── docker/ # local runtime stack
|
||||
├── docs/ # architecture and part docs
|
||||
├── scripts/ # local helper scripts
|
||||
├── go.work # Go workspace
|
||||
├── turbo.json # Turborepo task graph
|
||||
└── skeleton.md # this file
|
||||
│ └── docker/ # self-hosted stack for local proof
|
||||
├── docs/ # architecture and build docs
|
||||
├── scripts/ # bootstrap, verify, and stack helpers
|
||||
├── go.work # Go workspace
|
||||
├── turbo.json # Turborepo task graph
|
||||
└── skeleton.md # this file
|
||||
```
|
||||
|
||||
## Runtime and language choices
|
||||
|
||||
| Part | Language | Why |
|
||||
| -------------------- | ---------------------------------- | -------------------------------------------------------------------- |
|
||||
| `apps/web` | TypeScript + Next.js | best UI velocity, best admin/control-plane UX |
|
||||
| `apps/control-plane` | Go | strong concurrency, static binaries, operationally simple |
|
||||
| `apps/node-agent` | Go | best fit for host runtime, WebDAV service, and future Nix deployment |
|
||||
| `apps/nextcloud-app` | PHP | native language for the Nextcloud adapter surface |
|
||||
| `packages/contracts` | OpenAPI + JSON Schema + TypeScript | language-neutral source of truth with practical TS ergonomics |
|
||||
| Part | Language | Why |
|
||||
| -------------------- | ---------------------------------- | ------------------------------------------------------------------- |
|
||||
| `apps/web` | TypeScript + Next.js | fastest way to build the control-plane UI |
|
||||
| `apps/control-plane` | Go | strong backend baseline, static binaries, simple self-hosting |
|
||||
| `apps/node-agent` | Go | best fit for NAS runtime, WebDAV serving, and future Nix deployment |
|
||||
| `apps/nextcloud-app` | PHP | native language for an optional Nextcloud adapter |
|
||||
| `packages/contracts` | OpenAPI + JSON Schema + TypeScript | language-neutral source of truth with practical frontend ergonomics |
|
||||
|
||||
## Default deployment model
|
||||
|
||||
The default product story is self-hosted:
|
||||
|
||||
```text
|
||||
self-hosted betterNAS stack on user's NAS
|
||||
|
||||
+--------------------------------------------+
|
||||
| web control plane |
|
||||
| user opens this in browser |
|
||||
+-------------------+------------------------+
|
||||
|
|
||||
v
|
||||
+--------------------------------------------+
|
||||
| control-server |
|
||||
| auth / nodes / exports / grants |
|
||||
| mount profile issuance |
|
||||
+-------------------+------------------------+
|
||||
|
|
||||
v
|
||||
+--------------------------------------------+
|
||||
| node-service |
|
||||
| WebDAV export runtime |
|
||||
| real NAS files |
|
||||
+--------------------------------------------+
|
||||
|
||||
user Mac
|
||||
|
|
||||
+--> browser -> web control plane
|
||||
|
|
||||
+--> Finder -> issued WebDAV mount URL
|
||||
```
|
||||
|
||||
Optional later shape:
|
||||
|
||||
- hosted control-server
|
||||
- hosted web control plane
|
||||
- optional Nextcloud adapter for cloud/mobile/share surfaces
|
||||
|
||||
Those are not required for the core betterNAS product loop.
|
||||
|
||||
## Canonical contract rule
|
||||
|
||||
|
|
@ -52,39 +93,38 @@ The source of truth for shared interfaces is:
|
|||
3. [`packages/contracts/schemas`](./packages/contracts/schemas)
|
||||
4. [`packages/contracts/src`](./packages/contracts/src)
|
||||
|
||||
Agents must not invent private shared request or response shapes outside those
|
||||
Agents must not invent shared request or response shapes outside those
|
||||
locations.
|
||||
|
||||
## Parallel lanes
|
||||
## Implementation lanes
|
||||
|
||||
```text
|
||||
shared write surface
|
||||
shared write surface
|
||||
+-------------------------------------------+
|
||||
| docs/architecture.md |
|
||||
| packages/contracts/ |
|
||||
+----------------+--------------------------+
|
||||
|
|
||||
+-----------------+-----------------+-----------------+
|
||||
| | | |
|
||||
v v v v
|
||||
NAS node control plane local device cloud layer
|
||||
lane lane lane lane
|
||||
+---------------+----------------+----------------+
|
||||
| | |
|
||||
v v v
|
||||
node-service control-server web control plane
|
||||
|
||||
optional later:
|
||||
nextcloud adapter
|
||||
```
|
||||
|
||||
Allowed ownership:
|
||||
|
||||
- NAS node lane
|
||||
- node-service lane
|
||||
- `apps/node-agent`
|
||||
- future `infra/nix/node-*`
|
||||
- control-plane lane
|
||||
- future `infra/nix` host module work
|
||||
- control-server lane
|
||||
- `apps/control-plane`
|
||||
- DB and queue integration code later
|
||||
- local-device lane
|
||||
- mount docs first
|
||||
- future helper app
|
||||
- cloud layer lane
|
||||
- web control plane lane
|
||||
- `apps/web`
|
||||
- optional adapter lane
|
||||
- `apps/nextcloud-app`
|
||||
- Nextcloud mapping logic
|
||||
- shared contract lane
|
||||
- `packages/contracts`
|
||||
- `docs/architecture.md`
|
||||
|
|
@ -92,24 +132,24 @@ Allowed ownership:
|
|||
## The first verification loop
|
||||
|
||||
```text
|
||||
[node-agent]
|
||||
[node-service]
|
||||
serves WebDAV export
|
||||
|
|
||||
v
|
||||
[control-plane]
|
||||
[control-server]
|
||||
registers node + export
|
||||
issues mount profile
|
||||
|
|
||||
v
|
||||
[local device]
|
||||
mounts WebDAV in Finder
|
||||
[web control plane]
|
||||
shows export and mount action
|
||||
|
|
||||
v
|
||||
[cloud layer]
|
||||
optionally exposes same export in Nextcloud
|
||||
[local device]
|
||||
mounts in Finder
|
||||
```
|
||||
|
||||
If a task does not make one of those steps more real, it is probably too early.
|
||||
This is the main product loop.
|
||||
|
||||
## Upstream references to steal from
|
||||
|
||||
|
|
@ -125,18 +165,14 @@ If a task does not make one of those steps more real, it is probably too early.
|
|||
|
||||
- Next.js backend-for-frontend guide
|
||||
- https://nextjs.org/docs/app/guides/backend-for-frontend
|
||||
- why: keep Next.js as UI/BFF, not the system-of-record backend
|
||||
- why: keep Next.js as UI and orchestration surface, not the source-of-truth backend
|
||||
|
||||
### Go control plane
|
||||
### Go control-server
|
||||
|
||||
- Go routing enhancements
|
||||
- https://go.dev/blog/routing-enhancements
|
||||
- why: stdlib-first routing baseline
|
||||
|
||||
- `chi`
|
||||
- https://github.com/go-chi/chi
|
||||
- why: minimal router if stdlib patterns become too bare
|
||||
|
||||
- `pgx`
|
||||
- https://github.com/jackc/pgx
|
||||
- why: Postgres-first Go driver
|
||||
|
|
@ -153,23 +189,11 @@ If a task does not make one of those steps more real, it is probably too early.
|
|||
- https://github.com/hibiken/asynq
|
||||
- why: practical Redis-backed job system
|
||||
|
||||
- `koanf`
|
||||
- https://github.com/knadh/koanf
|
||||
- why: layered config if env-only config becomes too small
|
||||
|
||||
- `envconfig`
|
||||
- https://github.com/kelseyhightower/envconfig
|
||||
- why: tiny env-only config option
|
||||
|
||||
- `log/slog`
|
||||
- https://pkg.go.dev/log/slog
|
||||
- why: structured logging without adding a logging framework first
|
||||
|
||||
- `oapi-codegen`
|
||||
- https://github.com/oapi-codegen/oapi-codegen
|
||||
- why: generate Go and TS surfaces from OpenAPI
|
||||
- why: generate surfaces from OpenAPI with less drift
|
||||
|
||||
### NAS node and WebDAV
|
||||
### Node-service and WebDAV
|
||||
|
||||
- Go WebDAV package
|
||||
- https://pkg.go.dev/golang.org/x/net/webdav
|
||||
|
|
@ -183,11 +207,7 @@ If a task does not make one of those steps more real, it is probably too early.
|
|||
- https://nixos.org/manual/nixos/stable/
|
||||
- why: declarative host setup and service wiring
|
||||
|
||||
- Nixpkgs
|
||||
- https://github.com/NixOS/nixpkgs
|
||||
- why: service module and packaging reference
|
||||
|
||||
### Local device and mount UX
|
||||
### Local mount UX
|
||||
|
||||
- Finder `Connect to Server`
|
||||
- https://support.apple.com/en-lamr/guide/mac-help/mchlp3015/mac
|
||||
|
|
@ -201,36 +221,20 @@ If a task does not make one of those steps more real, it is probably too early.
|
|||
- https://support.apple.com/guide/security/keychain-data-protection-secb0694df1a/web
|
||||
- why: local credential storage model
|
||||
|
||||
- Finder Sync extensions
|
||||
- https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/Finder.html
|
||||
- why: future helper app / Finder integration reference
|
||||
|
||||
- WebDAV RFC 4918
|
||||
- https://www.rfc-editor.org/rfc/rfc4918
|
||||
- why: protocol semantics and edge cases
|
||||
|
||||
### Cloud and adapter layer
|
||||
### Optional cloud adapter
|
||||
|
||||
- Nextcloud app template
|
||||
- https://github.com/nextcloud/app_template
|
||||
- why: thin adapter app reference
|
||||
|
||||
- AppAPI / External Apps
|
||||
- https://docs.nextcloud.com/server/latest/admin_manual/exapps_management/AppAPIAndExternalApps.html
|
||||
- why: official external-app integration path
|
||||
|
||||
- Nextcloud WebDAV docs
|
||||
- https://docs.nextcloud.com/server/latest/user_manual/en/files/access_webdav.html
|
||||
- why: protocol/client behavior reference
|
||||
|
||||
- Nextcloud external storage
|
||||
- https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/external_storage_configuration_gui.html
|
||||
- why: storage aggregation behavior
|
||||
|
||||
- Nextcloud file sharing config
|
||||
- https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/file_sharing_configuration.html
|
||||
- why: share semantics reference
|
||||
|
||||
## What we steal vs what we own
|
||||
|
||||
### Steal
|
||||
|
|
@ -240,22 +244,21 @@ If a task does not make one of those steps more real, it is probably too early.
|
|||
- Go stdlib and proven Go infra libraries
|
||||
- Go WebDAV implementation
|
||||
- Finder native WebDAV mount UX
|
||||
- Nextcloud shell-app and cloud/web primitives
|
||||
- optional Nextcloud adapter primitives later
|
||||
|
||||
### Own
|
||||
|
||||
- the betterNAS domain model
|
||||
- the control-plane API
|
||||
- the control-server API
|
||||
- the node registration and export model
|
||||
- the mount profile model
|
||||
- the mapping between cloud mode and mount mode
|
||||
- the self-hosted stack wiring
|
||||
- the repo contract and shared schemas
|
||||
- the root `pnpm verify` loop
|
||||
|
||||
## The first implementation slices after this scaffold
|
||||
## The next implementation slices
|
||||
|
||||
1. make `apps/node-agent` serve a real configurable WebDAV export
|
||||
2. make `apps/control-plane` store real node/export records
|
||||
3. issue real mount profiles from the control plane
|
||||
4. make `apps/web` let a user pick an export and request a profile
|
||||
5. keep `apps/nextcloud-app` thin and optional
|
||||
1. make `apps/web` expose the real mount flow to a user
|
||||
2. add durable control-server storage for nodes, exports, and grants
|
||||
3. define the self-hosted NAS install shape for `apps/node-agent`
|
||||
4. keep the optional cloud adapter out of the critical path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue