Files
co-lite/local
ngqileandClaude Opus 5.5 9f1b8de04d feat: whatsapp send, templates and media proxy
- MetaClient: text and template sends, approved templates with bounded paging, streamed media with a 100 MB cap.
- Send endpoint: 24-hour window, template params and supported checks before Meta; pending then sent or failed with Meta's code and title.
- Template sync per company and nightly at 03:30 KL; a failed fetch keeps existing rows.
- Media proxy: 404 without access, 410 when Meta no longer holds the file.
- Mock: Graph send, templates, media and bearer checks; /simulate/inbound and /simulate/status sign with the company secret.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
2026-12-02 11:03:56 +08:00
..

Co-Lite local stack

Runs the whole Co-Lite backend on your machine: MySQL, Redis, the Pub/Sub emulator and the eight Java services, with the same service names as Kubernetes. Everything here is dev-only.

Prerequisites

  • JDK 21 and Maven 3.9+
  • Docker with Compose v2
  • Access to the base image registry: docker login gitea.containerverse.dev
  • About 6 GB of free RAM

Start

From the repository root:

local/up.sh

This copies local/.env.example to local/.env (git-ignored) if it is missing, builds every module with mvn -T 1C -DskipTests package, and starts the stack. The services take about a minute to boot after MySQL finishes seeding.

Then check it:

local/smoke.sh

It prints smoke: OK when admin login, /api/admin/me, the users list, a service-counter read and a public mobile-api call all succeed.

What Where
mobile-api http://localhost:8080 (header api-key: colite-local-app-key)
api-gateway http://localhost:8081 (header api-key: colite-local-gateway-key-000000000000)
MySQL localhost:3307, user root, password colite-dev
Admin login admin / colite-dev-admin

Admin portal

The portal runs outside Docker with npm run dev and talks to mobile-api on port 8080. With the stack up:

cd solvway-admin-portal
cat > .env.local <<'EOF'
MOBILE_API_BASE_URL=http://localhost:8080
MOBILE_API_KEY=colite-local-app-key
SESSION_SECRET=colite-local-session-secret-0123456789abcdef
EOF
npm ci
npm run dev

Open http://localhost:3001 and log in as admin / colite-dev-admin. .env.local is git-ignored. The portal declares Node 24; Node 22 also runs it.

Reset

Deletes the database volume; the next start reseeds from local/seed/:

docker compose -f local/docker-compose.yml down -v
local/up.sh

Seed data

local/seed/ is loaded only when the MySQL volume is empty, in file-name order:

  • 00-schemas.sql: creates the five service schemas.
  • 01-schema.sql: table structure from a Tastefully schema-only dump.
  • 02-reference.sql: allow-listed reference rows (roles, modules, lookups, messages).
  • 03-colite.sql: the Co-Lite company and the dev admin login.

Never put Tastefully customer data (members, users, attendance, orders) in these files.

Rebuild one service after a change

mvn -T 1C -B -q -DskipTests -pl solvway-services-counter -am package
docker compose -f local/docker-compose.yml up -d --build service-counter

-am builds the core library alongside the module; a module cannot be built alone because the colite-v1 core library is not installed in ~/.m2 by default.

Services reach each other by container name (service-system, api-gateway and so on), so a service run from an IDE outside Docker cannot join the stack. Run it inside the stack and attach a debugger instead: add -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 to JAVA_OPTS for that service and publish port 5005.