Skip to content

fix: slim Docker Compose for dev and restore Prisma/backend imports - #1032

Merged
ayomideadeniran merged 1 commit into
StellarDevHub:mainfrom
king-aj-the-first:fix/infra-prisma
Aug 3, 2026
Merged

fix: slim Docker Compose for dev and restore Prisma/backend imports#1032
ayomideadeniran merged 1 commit into
StellarDevHub:mainfrom
king-aj-the-first:fix/infra-prisma

Conversation

@king-aj-the-first

Copy link
Copy Markdown
Contributor

closes #947
closes #948
closes #951
closes #952

PR description

## Summary
- Add Docker Compose overrides so local development starts only PostgreSQL + standalone Redis, while keeping the full Sentinel/Cluster stack available for production-like and HA testing.
- Confirm Prisma schema is present and generates successfully; confirm broken Prisma client and auth middleware imports in the affected backend services are resolved.

## Changes

### Task 1 — Docker Compose (dev vs full vs HA)
- **`docker-compose.dev.yml`**: override that disables read-replica, Sentinels, Cluster nodes, and backend via Compose profiles so only `db` + `redis` start.
- **`docker-compose.prod.yml`**: HA override that wires the backend to Sentinel/Cluster (`REDIS_MODE` default `sentinel`) and adds healthcheck dependencies on Sentinel/Cluster services.
- **`docker-compose.yml`**: unchanged as the full production-like stack.
- **Docs**: README, Redis setup/caching guides, and architecture/general READMEs updated with the recommended workflow:
  `docker compose -f docker-compose.yml -f docker-compose.dev.yml up`

### Task 2 — Prisma schema
- `backend/prisma/schema.prisma` already defines models used by the seed script and services (`Student`, `Course`, `Enrollment`, `Idea`, `Vote`, `HashSimulation`, `P2PNode`, `P2PMessage`, etc.).
- Verified: `npx prisma validate` and `npx prisma generate` succeed.
- `npx prisma db push` requires a running Postgres (start via the new dev compose), then:
  ```bash
  cd backend && npx prisma db push

Task 3 — Prisma imports

  • Fixed paths in:
    • backend/src/dashboard/hash.service.ts
    • backend/src/infrastructure/p2p.service.ts
    • backend/src/simulator/voting.service.ts
  • All import from ../db/index.js (Prisma client singleton). No remaining ../db/prisma.js references under backend/src.

Task 4 — Auth middleware import

  • backend/src/infrastructure/infrastructure.routes.ts imports authenticate from ../auth/auth.middleware.js (correct module; ../middleware/auth.ts exports a different helper and is not the app-wide auth middleware).
  • tsc no longer reports TS2307 for this import.

Test plan

  • docker compose -f docker-compose.yml -f docker-compose.dev.yml config --services → only db and redis
  • docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d starts Postgres + Redis without Sentinels/Cluster
  • docker compose -f docker-compose.yml up -d still brings up the full stack
  • docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d starts HA-oriented stack
  • cd backend && npx prisma generate succeeds
  • cd backend && npx prisma db push creates tables against local Postgres
  • npx tsc --noEmit has no TS2307 for db/prisma or auth middleware on the four task files

@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

@king-aj-the-first is attempting to deploy a commit to the Ayomide Adeniran's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@king-aj-the-first Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@ayomideadeniran

Copy link
Copy Markdown
Contributor

pr under review

@ayomideadeniran
ayomideadeniran merged commit f5ec447 into StellarDevHub:main Aug 3, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants