Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
6.9 KiB
Design
Context
See proposal.md for the motivation. The phase 1 design is in docs/superpowers/specs/2026-11-26-co-lite-foundation-and-leads-design.md.
What Tastefully looks like today (commit 8bd93d15):
- There is no root pom. Each module is a standalone Spring Boot 3.2.8 app with its own parent and pulls
com.solvway.core:solvway-core-libs:${core-project.version}(tastefully-v1) from~/.m2. Babyboo usesbabyboo-v1at the same coordinates. - Every service listens on port 80. The gateway resolves services by hostname from
app.services.name.*:service-auth,service-system,service-counterand so on. These are the k8s service names. - MySQL holds one schema per service (
service-system,service-counter,service-member,service-log,service-email). Tables are managed by hand-written DDL; there is noddl-autoand no Flyway. No full DDL exists in the repo. - Config comes from environment variables:
MYSQLHOST,MYSQLPORT,MYSQLUSER,MYSQLPWD,REDISHOST,GCP_PROJECT,GCP_CREDENTIAL_FILE,APIGATEWAYURLandAES_SECRET_KEY. - Pub/Sub inbound adapters are declared in each service's
PubSubConfig(system 7, counter 12, member 12, log 3, email 3). Some serve flows Co-Lite drops (stockist, Jumio, Camunda). They stay, so each subscription must exist in the emulator. - The Dockerfiles use the base image
gitea.containerverse.dev/solvway/docker-java-21,ADD target/*.jarand-Dspring.profiles.active=$BUILD_PROFILE.
Goals / Non-Goals
Goals:
- Bring the stack up from a clean clone with two commands: build, then up.
- Use the same hostnames and ports as k8s, so change 5 reuses the images and env contract unchanged.
Non-Goals:
- Any admin API, lead table or portal trimming. Those belong to changes 2–4.
- Removing dead code inside kept modules beyond what stops compilation or startup.
- Running the Next.js apps inside compose. They run with
npm run dev.
Decisions
-
Copy with
git archiveat pinned commits. Tastefully8bd93d15and babyboof64d096ea. Only tracked files come across: nonode_modules,targetor stray files.- Alternative:
cp -r. Rejected because it drags in untracked junk and possibly local secrets.
- Alternative:
-
Root aggregator pom. Add a
pom.xmlwith<packaging>pom</packaging>that lists the kept modules, withsolvway-core-libsandsolvway-core-sessionfirst. Module poms keep their own Spring Boot parent. The aggregator only orders the reactor, somvn -T 1C verifyat the root builds everything.- Alternative: a shared parent. Rejected because it would rewrite every module pom for no phase-1 gain.
-
core-libs version
colite-v1. Set it insolvway-core-libs/pom.xml, and setcore-project.versionin every kept module. The same applies tosolvway-core-sessionif it is versioned the same way. -
Compose mirrors k8s. Compose service names equal the k8s names (
service-auth,service-system,service-counter,service-member,service-log,service-email,api-gateway,mobile-api). Each service listens on port 80 inside its container. Onlymobile-apiandapi-gatewayare published to the host, on 8080 and 8081.- Images are built from the existing Dockerfiles with
BUILD_PROFILE=local.
- Images are built from the existing Dockerfiles with
-
localSpring profile per module. Add anapplication-local.ymlthat setsspring.cloud.gcp.pubsub.emulator-host: pubsub:8085andspring.cloud.gcp.project-id: co-lite-local. It also disables the credentials-file requirement where the emulator needs that. All other values still come from the env filelocal/.env.example, with dev-only values; a copied.envis git-ignored. -
Pub/Sub emulator plus an init job. A one-shot container creates every topic and subscription from
local/pubsub/topics.txt, onetopic subscriptionpair per line, before the services start (depends_on: condition: service_completed_successfully). The list is extracted from the kept modules'PubSubConfigclasses and resolved property values. -
Seed from the user's Tastefully dump. MySQL runs its official image's
/docker-entrypoint-initdb.d. It runs only on an empty volume, which gives first-start seeding for free.- Files, in run order:
01-schema.sql: schema-only dump of the five schemas.02-reference.sql: reference-table rows (roles, modules/menus, system_property, location_hierarchy and other lookup tables, chosen per table).03-colite.sql: one company and one admin user, with a bcrypt hash of a dev-only password documented inlocal/README.md.
- Reset is
docker compose down -v. - Location:
local/seed/. Decided by the user: runnable dev seed files are a documented exception to the SQL-placement rule (seeCLAUDE.md), because the change folder moves when the change is archived and would break the compose mount. - Source: the user supplies a schema-only dump and a reference-table data dump, not a full dump. Customer data from Tastefully never enters this repo or the local database.
- Files, in run order:
-
Smoke check is
local/smoke.sh. It makes three calls and exits non-zero, naming the failing call, if any of them fails:- Admin login:
POST /auth/authenticateon the gateway (auth → system → MySQL). GET /counter/event/findCurrentEventon the gateway, with the admin token (counter → MySQL).GET /api/public/messages/en_USon mobile-api (mobile-api → gateway → system → MySQL).
- The originally planned
GET /api/event/upcomingEventreturns a hardcoded URL and never reaches a service. mobile-api has no public endpoint backed by counter; its counter calls need a member token. That is why the counter call goes through the gateway directly.
- Admin login:
-
Dropped-service references. HTTP calls to dropped services are strings; they compile and only fail if called, so they stay. Remove only these:
- gateway routes whose
uripoints at a dropped service (bonus, payment, inventory, stockist, wallet and similar); - any bean or config that fails at startup without a dropped service.
- Each removal is listed in the task's commit message.
- gateway routes whose
Risks / Trade-offs
- [The base image
gitea.containerverse.dev/solvway/docker-java-21needs registry access] → The README documentsdocker login gitea.containerverse.dev. If access is a blocker, useeclipse-temurin:21-jrelocally only. - [The dump may contain customer data in tables thought to be reference data] → Reference rows are dumped per table from an allow-list, and the diff is reviewed before commit (spec scenario "Seed contains no customer data").
- [The schema dump drifts from the entity mappings] → The smoke check and service startup catch it, and change 2–4 tests run against the seeded schema.
- [Subscriptions are missed in the emulator] → The services fail at startup. The "stack starts healthy" scenario checks the logs.
- [Six JVMs plus MySQL use about 6 GB of RAM] → Set
JAVA_OPTS=-Xmx384mper service in compose.
Migration Plan
None. This is a new repo with nothing deployed. Rollback is reverting the commits.