How It Works
PackVault is designed to act as an intelligent intermediary between your package manager (like npm, yarn, or pnpm) and the upstream registry (like registry.npmjs.org).
The Architecture
npm Registry
│
▼
PackVault Sync
│
▼
Local Vault
│
┌────┴────┐
▼ ▼
Offline LAN
Install Sharing
│
▼
Peer Sync
1. The Sync Phase
When you run packvault sync, PackVault reaches out to the upstream registry to:
- Fetch the package metadata (versions, dependencies).
- Download the actual tarballs (
.tgzfiles) for the requested packages. - Recursively resolve and download all necessary dependencies.
- Store everything in a structured format in your local
~/.packvaultdirectory.
2. The Local Vault
Your local vault acts as a highly-optimized, offline database. It stores:
- Package tarballs.
- Pre-computed dependency graphs.
- Integrity hashes (SHA-512) for security verification.
PackVault uses a local SQLite database to index this information, allowing for lightning-fast lookups even with tens of thousands of cached packages.
3. The Install Phase
When you run packvault install, PackVault intercepts the installation request. Instead of reaching out to the internet, it:
- Queries the local vault database for the requested package and version constraints.
- Resolves the dependency tree completely locally.
- Extracts the cached tarballs directly into your
node_modulesfolder (or equivalent). - Updates your lockfile if necessary.
Because everything happens locally, installations are significantly faster and, most importantly, require zero network connectivity.