No description
Find a file
mihai205 077b08dcdc
Merge pull request #27 from mihai205/dev
feat: add VITE_ANALYTICS_API_KEY and VITE_ANALYTICS_ENDPOINT to front…
2026-06-26 16:36:11 +03:00
.githooks chore(security): secret-handling hardening (gitignore, env examples, dockerignore, gitleaks) 2026-06-15 19:25:18 +03:00
.github chore(deps): bump actions/checkout from 4 to 6 2026-06-16 11:51:12 +00:00
.dockerignore chore(security): secret-handling hardening (gitignore, env examples, dockerignore, gitleaks) 2026-06-15 19:25:18 +03:00
.env.example feat: add auto highlight-video service and update environment variables in docker-compose 2026-06-20 20:43:41 +03:00
.gitignore chore(security): secret-handling hardening (gitignore, env examples, dockerignore, gitleaks) 2026-06-15 19:25:18 +03:00
.gitleaks.toml chore(security): secret-handling hardening (gitignore, env examples, dockerignore, gitleaks) 2026-06-15 19:25:18 +03:00
docker-compose.dev.yml fix: update DATABASE_URL_ANALYTICS to use encoded password for security in docker-compose files 2026-06-26 14:54:04 +03:00
docker-compose.yml feat: add VITE_ANALYTICS_API_KEY and VITE_ANALYTICS_ENDPOINT to frontend environment variables in docker-compose 2026-06-26 16:35:40 +03:00
mailserver.env.example chore(security): secret-handling hardening (gitignore, env examples, dockerignore, gitleaks) 2026-06-15 19:25:18 +03:00
moveit.dev.sh feat: add standalone analytics service and update deployment scripts 2026-06-21 16:08:44 +03:00
moveit.sh fix: rename ANALYTICS_SDK_DIR to FACES_DIR for consistency in moveit.sh 2026-06-25 10:42:15 +03:00
README.md fix: update Dockerfile contexts and enhance moveit scripts for shared package handling 2026-06-15 21:03:09 +03:00

sharevent-infra

Orchestration for the Sharevent stack: Postgres, Redis, backend, frontend, nudenet, cron, watcher, mailserver, focalboard and cloudflare-ddns.

Sharevent is multi-repo. Two shared packages are consumed by the apps via a local file: dependency and must be present at build time:

  • @sharevent/contracts (PACKAGES/sharevent-contracts) — shared zod schemas / DTOs / enums. Must be built (its dist/) before FE/BE install.
  • @sharevent/config (PACKAGES/sharevent-config) — shared ESLint, Prettier and TypeScript base configs. Source-only (no build).

One-command local bring-up (Windows, host-based)

For day-to-day development, run the apps directly on the host (fastest HMR):

# from the repo root E:\WEB\sharevent.ro
./dev.ps1            # build contracts, install config, start DB/Redis, migrate, launch BE+FE
./dev.ps1 -Stop      # stop the DB/Redis containers
./dev.ps1 -Reset     # wipe volumes and restart

dev.ps1:

  1. builds @sharevent/contracts and installs @sharevent/config,
  2. starts Postgres + Redis in Docker (loopback-bound),
  3. runs prisma migrate deploy,
  4. opens terminals for the contracts watcher, the backend (pnpm dev) and the frontend (pnpm dev).

Each app validates its environment at startup and fails fast if a required variable is missing (BE: src/config/env.ts, WATCHER: src/env.ts, FE: src/env.ts + vite.config.ts). Copy each service's .env.example to .env first:

Service Env file location Notes
Backend BE/sharevent-be/.env DB, Redis, SESSION_SECRET (≥16 chars), SMTP, SENTRY_DSN (optional)
Watcher WATCHER/sharevent-watcher/.env DATABASE_URL, Redis host/port
Frontend FE/sharevent-fe/.env VITE_API_BASE_URL, VITE_APP_BASE_URL, VITE_SENTRY_DSN (optional)
Infra INFRA/sharevent-infra/.env values consumed by docker-compose*.yml

Full stack via Docker Compose

The compose files expect a flat deploy layout (what moveit.sh produces):

$PROJECT_ROOT/
  docker-compose.yml          # copied from sharevent-infra
  sharevent-contracts/        # shared package (built inside the image)
  sharevent-config/           # shared package
  sharevent-be/               sharevent-fe/        sharevent-watcher/
  sharevent-cron/             sharevent-nudenet/   sharevent-infra/

The backend / frontend / watcher images set build.context: . (the deploy root) and dockerfile: sharevent-<svc>/Dockerfile. Each Dockerfile recreates the nested PACKAGES/* + <SVC>/<svc> layout inside the image so the file: deps (@sharevent/* -> ../../PACKAGES/*) resolve, builds @sharevent/contracts first, then installs and builds the service.

Production / staging bring-up

# from $PROJECT_ROOT (after sharevent-infra is cloned)
./sharevent-infra/moveit.sh        # clone/update every repo (incl. contracts + config), build & up
# dev variant:
./sharevent-infra/moveit.dev.sh

moveit.sh fetches all service repos plus sharevent-contracts and sharevent-config as flat siblings, copies the compose file to the root, then runs docker compose up -d --build and migrates + seeds the DB.

Manual compose (when repos are already in place)

docker compose -f docker-compose.yml up -d --build          # prod
docker compose -f docker-compose.dev.yml up -d --build      # dev

Required compose env (INFRA/sharevent-infra/.env): DB_*, DATABASE_URL, SHADOW_DATABASE_URL, REDIS_PASSWORD, VITE_API_BASE_URL, VITE_APP_BASE_URL, VITE_SENTRY_DSN, API_KEY (Cloudflare), etc. Secrets are injected via env_file, never baked into images.


CI

Each repo's .github/workflows/ci.yml runs on PRs and:

  1. reconstructs the umbrella layout (checks out sharevent-contracts + sharevent-config),
  2. builds @sharevent/contracts,
  3. installs, typechecks, lints, and tests the service,
  4. runs a secret-scan job (gitleaks) that fails on any committed secret.