Skip to content
ContraillPublic

About

Self-hosted, multi-user file storage that pools several Google Drive accounts into one encrypted store (AES-256-GCM chunks, Go + React, CasaOS-ready)

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Pinakes

Self-hosted, multi-user file storage that pools several Google Drive accounts into one encrypted store. Files are split into 64 MiB chunks and encrypted on your server (AES-256-GCM) before they ever reach Google. Each Drive only ever sees opaque .pnk objects.

Status: 0.9.0, production-readiness release (CHANGELOG.md). Pinakes keeps files only on the Drive accounts you connect, so keep another copy of anything irreplaceable.

Pinakes needs no domain, reverse proxy or internet exposure. Run it on a home server (CasaOS works well) and use it over your LAN or Tailscale. A domain with HTTPS can be added later without touching stored data.

Features

  • Multi-user accounts: on a fresh server the first registered account becomes the owner (no token or CLI step, see docs/INITIAL_SETUP.md); registration is then closed by default. The owner has no quota limit; other users get a personal quota. Users can change their password, the owner can reset others, and a reset-password command covers a forgotten owner password (docs/PASSWORD_RESET.md).
  • Encrypted, resumable chunked uploads with end-to-end SHA-256 verification (choose the same file again to resume), plus verified downloads.
  • Google Drive connection over OAuth with the narrow drive.file scope. Pinakes can only see files it created.
  • A storage pool of any number of Drive accounts: chunks go to the account with the lowest projected fill ratio, physical space is reserved atomically, and full, throttled or signed-out accounts are routed around.
  • Account health at a glance, with separate authorization and storage states, guided reconnect (the wrong Google account is refused), and Owner notifications.
  • Respectful use of Google's API: quota-unit rate limits, retries with backoff, a circuit breaker per account and a daily download cap kept below Google's billing threshold.
  • Move data off an account and Rebalance the pool: restart-safe jobs that copy encrypted chunks, verify them and switch files atomically. Check files on Drive finds orphaned and missing chunks.
  • Share links (off by default): optional password, expiry and download limit, with HTTP Range so videos can seek.
  • Optional encrypted vault for each Drive's sign-in details, off until the owner turns it on. Every vault action needs the owner password again, reveals are logged, and Pinakes never sends these details to Google.
  • Garbage collection for deleted files and abandoned uploads, plus a security log.
  • Encrypted recovery bundles (master key and a consistent, checksummed snapshot of the metadata): download from Settings or schedule pinakes backup, check with pinakes restore --dry-run, and restore onto a fresh installation. An interrupted restore is detected and can simply be re-run. See docs/BACKUP_AND_RECOVERY.md.
  • Hardened by default: CSP, session management, password re-confirmation for sensitive actions, read-only and capability-free containers, nothing exposed to the internet (docs/SECURITY.md).
  • Web UI in English, with Turkish selectable in Settings.

Quick start (Docker)

make up        # app + MongoDB replica set (auth on; password in .env) on http://localhost:8080
# open http://localhost:8080 and register: the first account becomes the owner

To connect Drives, set PINAKES_GOOGLE_CLIENT_ID and PINAKES_GOOGLE_CLIENT_SECRET (see Google OAuth).

Development

The only hard requirement is Docker. CI runs these same targets.

make test      # Go unit + Mongo integration tests, gofmt/vet, web lint/build, OpenAPI lint
make e2e       # Playwright against a throwaway stack (own volumes, port 8081)
make test-unit # quick Go tests without Docker (Mongo tests are skipped)

Laptop + remote runtime (e.g. a Raspberry Pi with CasaOS)

Builds and tests run on the fast machine; the app runs on the remote host, which only needs Docker.

make test-remote-db REMOTE=<ssh-host>  # Go tests locally, throwaway Mongo on the host via SSH tunnel
make deploy         REMOTE=<ssh-host>  # cross-compile arm64, ship, install/update the CasaOS app (port 8080)
make e2e-remote     REMOTE=<ssh-host>  # throwaway stack on the host (port 8081), Playwright locally

make deploy installs Pinakes as a CasaOS app under /var/lib/casaos/apps/pinakes, with data in /DATA/AppData/pinakes. The CasaOS definition is self-contained: passwords are generated on first start into /DATA/AppData/pinakes/secrets, and deploy/casaos/ is a one-app CasaOS store: add https://github.com/Contraill/pinakes/archive/refs/heads/main.zip as an App Store source and CasaOS installs and updates Pinakes from it (images ghcr.io/contraill/pinakes and pinakes-mongo, published by CI for arm64 and amd64). CasaOS only offers updates for store apps. Upgrades, rollback and CasaOS details are in docs/DEPLOYMENT.md.

For backend-only work you can also run cd backend && go run ./cmd/pinakes with cd web && npm run dev; Vite proxies /api to :8080.

Configuration

Variable Default
PINAKES_ADDR :8080 listen address
PINAKES_MONGO_URI mongodb://localhost:27017/?directConnection=true must point at a replica set
PINAKES_MONGO_DB pinakes
PINAKES_MONGO_USERNAME / _PASSWORD empty MongoDB credentials (authSource admin). The Compose and CasaOS setups run the app as pinakes_app, which may only read and write the pinakes database
PINAKES_DATA_DIR /data holds master.key; back it up (Settings → Recovery bundle)
PINAKES_WEB_DIR empty built SPA to serve
PINAKES_APP_URL empty where users open the UI (optional; used as the default share link base)
PINAKES_OAUTH_REDIRECT_URL http://localhost:8080/api/v1/drive/callback must match the OAuth client
PINAKES_SHARE_BASE_URL empty base for share links; empty uses PINAKES_APP_URL, then the browser's address
PINAKES_GOOGLE_CLIENT_ID / _SECRET empty enables connecting Drives
PINAKES_COOKIE_SECURE true set to false only for plain-HTTP LAN access
PINAKES_CLIENT_IP_HEADER empty e.g. CF-Connecting-IP or X-Forwarded-For behind a proxy
PINAKES_TRUSTED_PROXIES empty IPs/CIDRs of your proxies; the header above is ignored unless the request comes from one of them
PINAKES_DEFAULT_QUOTA_BYTES 5368709120 (5 GiB) quota for newly registered users (-1 = unlimited)
PINAKES_DAILY_EGRESS_BYTES 966367641600 (900 GiB) bytes Pinakes may download from Google per UTC day; -1 disables the cap (read Google's pricing first)
PINAKES_FAKE_DRIVE empty 1 = in-memory test Drive for E2E stacks; never in production

Settings are validated at startup; a malformed value stops the app with a message naming it. The three URLs are independent and only affect links and redirects. Changing them, for example when moving to https://pinakes.example.com, never affects stored files, OAuth tokens or keys.

Google OAuth

Each installation uses its own Google Cloud project and OAuth client; Pinakes ships no defaults. Follow docs/GOOGLE_OAUTH_SETUP.md. It takes about ten minutes, covers the localhost SSH-tunnel callback, and explains how to avoid the 7-day token expiry of "Testing" apps.

Documentation

Licence

Pinakes is licensed under the Apache License 2.0. Third-party components and their licences are listed in THIRD_PARTY_NOTICES.md.

About

Self-hosted, multi-user file storage that pools several Google Drive accounts into one encrypted store (AES-256-GCM chunks, Go + React, CasaOS-ready)

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Packages

Contributors

Languages