# πŸ” EnvSync ## 🚧 Under Development ### Encrypted `.env` Collaboration β€” Git for your secrets. [![Next.js](https://img.shields.io/badge/Next.js-15-black?style=flat-square&logo=next.js)](https://nextjs.org/) [![Spring Boot](https://img.shields.io/badge/Spring_Boot-3.x-6DB33F?style=flat-square&logo=springboot)](https://spring.io/projects/spring-boot) [![PostgreSQL](https://img.shields.io/badge/PostgreSQL-16-4169E1?style=flat-square&logo=postgresql)](https://www.postgresql.org/) [![Redis](https://img.shields.io/badge/Redis-7-DC382D?style=flat-square&logo=redis)](https://redis.io/) [![MinIO](https://img.shields.io/badge/MinIO-Object_Storage-C72E49?style=flat-square&logo=minio)](https://min.io/) [![Keycloak](https://img.shields.io/badge/Keycloak-IAM-4D9B9B?style=flat-square)](https://www.keycloak.org/) [![NGINX](https://img.shields.io/badge/NGINX-Reverse_Proxy-009639?style=flat-square&logo=nginx)](https://nginx.org/) [![Docker](https://img.shields.io/badge/Docker-Compose-2496ED?style=flat-square&logo=docker)](https://www.docker.com/) > Stop sending `.env` files over Slack. Stop wondering if your teammate has the latest secrets. EnvSync is a CLI + web dashboard that gives your team a single encrypted source of truth for environment variables β€” with diffing, versioning, and real-time notifications. **100% self-hosted. Zero cloud dependencies.**
--- ## 🚨 The Problem Every dev team has this conversation: > _"Hey did you add the new `STRIPE_WEBHOOK_SECRET` to your `.env`?"_ > _"Wait there's a new one? Since when?"_ Environment variable drift causes bugs that are impossible to reproduce, broken local setups, and secrets leaking through Slack DMs. EnvSync fixes this β€” and keeps everything on your own infrastructure. --- ## ✨ Features - **CLI-first workflow** β€” `envsync push`, `envsync pull`, `envsync diff` β€” feels like git for your `.env` - **End-to-end encryption** β€” secrets encrypted client-side with `libsodium` before ever hitting the server - **Real-time notifications** β€” teammates get notified instantly via Redis pub/sub when variables change - **Environment scoping** β€” separate vaults for `development`, `staging`, `production` - **Audit log** β€” full history of who changed what, when, and from where - **`.env` diff viewer** β€” visual diff in the web dashboard showing exactly what changed between versions - **Org & project management** β€” multi-team support with role-based access control (Admin, Editor, Viewer) - **MinIO backups** β€” encrypted vault snapshots stored in self-hosted S3-compatible object storage - **Keycloak SSO** β€” enterprise-grade identity: OIDC login, MFA, LDAP, team provisioning --- ## πŸ—οΈ Architecture ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ CLI Tool β”‚ β”‚ envsync push / pull / diff β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ HTTPS (via NGINX) β”‚ E2E Encrypted Payload β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ NGINX β”‚ β”‚ Reverse Proxy / TLS termination β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Spring Boot API β”‚ β”‚ Auth Β· Vault CRUD Β· Audit Logging β”‚ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”‚ PostgreSQL β”‚ β”‚ Redis β”‚ β”‚ MinIO β”‚ β”‚ Vaults & β”‚ β”‚ Pub/Sub β”‚ β”‚ Encrypted β”‚ β”‚ Audit Logs β”‚ β”‚ Notificationsβ”‚ β”‚ Backups β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Keycloak β”‚ β”‚ SSO Β· OIDC Β· Role Management Β· User Provisioning β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Next.js Dashboard β”‚ β”‚ Web UI Β· Real-time updates Β· Diff viewer β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` --- ## πŸ› οΈ Tech Stack | Layer | Technology | Self-Hosted Replaces | |---|---|---| | **Frontend** | Next.js 15 (App Router) | β€” | | **Backend** | Spring Boot 3 (Java) | β€” | | **Database** | PostgreSQL 16 | AWS RDS | | **Cache / Pub-Sub** | Redis 7 | AWS ElastiCache / SQS | | **Object Storage** | MinIO | AWS S3 | | **Identity / Auth** | Keycloak (OIDC) | AWS IAM / Cognito | | **Reverse Proxy** | NGINX | AWS CloudFront | | **Encryption** | libsodium / TweetNaCl.js | AWS KMS | | **ORM** | Hibernate / Spring Data JPA | β€” | | **CLI** | Node.js (npm package) | β€” | | **Containerization** | Docker Compose | AWS ECS / Fargate | --- ## πŸš€ Getting Started ### Prerequisites - Docker & Docker Compose - Java 21+ - Node.js 20+ ### 1. Clone & Start Infrastructure ```bash git clone https://github.com/yourusername/envsync.git cd envsync docker compose up -d # Starts: PostgreSQL, Redis, MinIO, Keycloak, NGINX ``` ### 2. Configure Keycloak ``` Open http://localhost:8180 Admin console β†’ Create realm: "envsync" Create client: "envsync-api" Set redirect URIs: http://localhost:3000/* ``` ### 3. Configure MinIO ``` Open http://localhost:9001 (MinIO Console) Create bucket: "envsync-backups" Generate access key β†’ paste into backend .env ``` ### 4. Start the Backend ```bash cd backend cp .env.example .env # fill in Keycloak + MinIO credentials ./mvnw spring-boot:run # API at http://localhost:8080 ``` ### 5. Start the Frontend ```bash cd frontend npm install npm run dev # Dashboard at http://localhost:3000 ``` ### 6. Install the CLI ```bash npm install -g envsync-cli envsync login # OIDC flow via Keycloak envsync init # initialize in your project envsync push # push your .env to the vault envsync pull # pull latest secrets envsync diff # see what changed ``` --- ## πŸ“– CLI Reference ```bash envsync init --project my-app --env development envsync push # push local .env β†’ vault envsync pull # pull vault β†’ local .env envsync diff # diff local vs vault envsync log # view audit log envsync set DATABASE_URL "postgres://..." envsync unset OLD_API_KEY envsync envs # list environments (dev/staging/prod) envsync history # version history of the vault envsync rollback --version 12 # restore a previous vault version ``` --- ## πŸ“ Project Structure ``` envsync/ β”œβ”€β”€ frontend/ # Next.js 15 dashboard β”‚ β”œβ”€β”€ app/ β”‚ β”‚ β”œβ”€β”€ (auth)/ # Keycloak OIDC login flow β”‚ β”‚ β”œβ”€β”€ dashboard/ # Overview & notifications β”‚ β”‚ β”œβ”€β”€ projects/ # Project vault management β”‚ β”‚ └── audit/ # Audit log viewer β”‚ └── components/ β”‚ β”œβ”€β”€ DiffViewer/ # .env diff component β”‚ └── VaultEditor/ # Secret CRUD UI β”‚ β”œβ”€β”€ backend/ # Spring Boot API β”‚ └── src/main/java/ β”‚ β”œβ”€β”€ auth/ # Keycloak + Spring Security OIDC β”‚ β”œβ”€β”€ vault/ # Vault CRUD & versioning β”‚ β”œβ”€β”€ audit/ # Audit log service β”‚ β”œβ”€β”€ notification/ # Redis pub/sub notifications β”‚ └── storage/ # MinIO backup service β”‚ β”œβ”€β”€ cli/ # Node.js CLI tool β”‚ └── src/ β”‚ β”œβ”€β”€ commands/ # push, pull, diff, set, unset, rollback β”‚ └── crypto/ # libsodium client-side encryption β”‚ β”œβ”€β”€ nginx/ β”‚ └── nginx.conf # Reverse proxy + TLS config β”‚ └── docker-compose.yml # Full self-hosted stack ``` --- ## πŸ”’ Security Model EnvSync uses a **zero-knowledge encryption** model: 1. Secret key derived locally from your password using **Argon2** 2. Secrets encrypted **before** leaving your machine using **XChaCha20-Poly1305** 3. Server only ever stores ciphertext β€” it physically cannot read your secrets 4. Team sharing via asymmetric encryption β€” each member's public key wraps the vault key 5. Identity via **Keycloak** β€” supports MFA, LDAP federation, and social login out of the box ---
Built to solve a real problem every dev team faces. No cloud required.