Spaces:
Runtime error
Runtime error
|
Download IMPLEMENTATION_ROADMAP.md from Oheha/cybully-api: direct link, hf CLI and curl.
- Browser
- Download file 6.39 kB
-
https://huggingface.co/spaces/Oheha/cybully-api/resolve/main/IMPLEMENTATION_ROADMAP.md
- Command line
-
hf download hf://spaces/Oheha/cybully-api/IMPLEMENTATION_ROADMAP.md
-
curl -L -o IMPLEMENTATION_ROADMAP.md https://huggingface.co/spaces/Oheha/cybully-api/resolve/main/IMPLEMENTATION_ROADMAP.md
6.39 kB
Cybully MVP Implementation and Roadmap
Current State
The MVP scaffold has been implemented in C:\Users\HP\Desktop\cybully.
Completed:
- Root monorepo structure with
apps/web,services/api, andscripts. - Supabase direct mode for hosted Postgres without requiring Docker Desktop.
- Optional Docker Compose for the fuller queue-based stack, but it is no longer the default path.
- FastAPI backend with:
POST /api/v1/analyze/textGET /api/v1/incidentsGET /api/v1/incidents/{id}PATCH /api/v1/incidents/{id}GET /api/v1/alerts- Supabase bearer-token validation against Supabase Auth
X-Internal-Tokenfallback for local service-to-service calls
- Direct text moderation mode that analyzes and persists in the API request.
- RabbitMQ queue abstraction and optional worker entrypoints:
app.workers.inferenceapp.workers.persistenceapp.workers.alerts
- SQLAlchemy models, Alembic migration, repository helpers, and severity scoring.
- Auto scorer selection with Detoxify primary and heuristic fallback for mini-project resilience.
- Supabase schema SQL in
supabase/schema.sql. - Next.js app shell with:
- Supabase email/password auth
- public landing page at
/ /sign-in/sign-up/app/moderation/moderation/incidents/[id]/settings- BFF API routes that proxy authenticated frontend requests to FastAPI
- Manual demo payloads in
scripts/demo_payloads.http. - Localization benchmark fixture in
scripts/localization_samples.json. - Root README with setup and demo instructions.
Verification completed:
npm run lint:webpassed with no warnings or errors.python -m pytestpassed for backend tests.POST /api/v1/analyze/textreturned202 Acceptedagainst the live FastAPI service.- Incident rows are persisting into Supabase Postgres in direct mode.
- Live setup works with the Supabase Session Pooler connection string.
Verification not completed:
- Real end-to-end browser verification of the signed-in submit flow after the final API restart has not yet been repeated.
- Moderator review actions against real signed-in traffic still need one focused pass.
Immediate Continuation Instructions
- Create the local environment file if it does not exist yet.
Copy-Item .env.example .env
Fill in:
MODERATOR_EMAILS=your-google-email@example.com
DATABASE_URL=postgresql://postgres.YOUR_PROJECT_REF:YOUR_PERCENT_ENCODED_PASSWORD@aws-1-YOUR-REGION.pooler.supabase.com:5432/postgres?sslmode=require
PIPELINE_MODE=direct
SCORER_PROVIDER=auto
Run supabase/schema.sql in the Supabase SQL editor before the first API write.
If the password contains $ or %, percent-encode it before placing it into DATABASE_URL.
- Re-run frontend checks after any further UI changes.
npm run lint:web
npm run build:web
npm run test:web
- Re-run backend checks after backend changes. Prefer Python 3.11 because the Docker image and ML stack target 3.11.
cd services/api
python -m pip install -e ".[dev]"
pytest
- Run the mini-project backend locally.
cd services/api
uvicorn app.main:app --port 8000
If you update .env, restart the API process so the engine is rebuilt with the new DATABASE_URL.
- Run the frontend.
npm run dev:web
- Optional: run the full queue stack later.
cd C:\Users\HP\Desktop\cybully
docker compose up --build
- Open the local services.
- Web app:
http://localhost:3000 - FastAPI docs:
http://localhost:8000/docs
Roadmap
Phase 0: Stabilize the Scaffold
- Keep README, env examples, and roadmap aligned with the Supabase mini-project path.
- Keep the live API process restarted after env changes.
- Re-run one signed-in browser submit after backend restarts to confirm the BFF path is healthy.
Phase 1: Validate Supabase Direct Backend
- Start the FastAPI backend locally with
PIPELINE_MODE=direct. - Submit sample payloads from
scripts/demo_payloads.httpor/app. - Confirm FastAPI intake, scoring, Supabase incident rows, and high-severity alert stub rows.
- Confirm moderator review status changes persist to Supabase.
Phase 1B: Optional Queue Pipeline
- Run RabbitMQ and workers only if the project grows beyond direct mode.
- Set
PIPELINE_MODE=queueand chooseSCORER_PROVIDER=detoxifyorSCORER_PROVIDER=auto.
Phase 2: Validate Frontend App Shell
- Sign in with a Supabase email/password account listed in
MODERATOR_EMAILS. - Submit text from
/app. - Verify
/moderationpolls incident and alert APIs every few seconds. - Open
/moderation/incidents/[id]and testreviewed,dismissed, andescalatedactions. - Confirm non-moderator users are redirected away from
/moderation.
Phase 3: MVP Acceptance Pass
- Run one benign sample, one toxic sample, one repeated-user sample, and one identity-attack sample.
- Confirm each accepted submission returns a tracking id.
- Confirm incidents persist with model scores and severity levels.
- Confirm high-severity incidents create stub alerts.
- Confirm moderator status updates persist after refresh.
- Run the samples in
scripts/localization_samples.jsonand document false negatives as Detoxify baseline gaps.
Phase 4: Hardening After MVP
- Replace stub email alerts with SendGrid.
- Add a proper localization benchmark runner and report artifact.
- Add retry/dead-letter handling for worker failures.
- Add API pagination controls to the frontend.
- Add structured app logging and request correlation ids.
- Add production auth hardening if the FastAPI backend becomes directly reachable from browsers or external clients.
Known Implementation Notes
- The preferred auth path is now Supabase bearer token forwarding from the Next.js BFF to FastAPI.
X-Internal-Tokenremains available for local scripts and internal calls.- Detoxify downloads model weights on first inference. The first worker run can be slow and requires network access.
- The current app shell is intentionally lean and operational. It is not a full social product.
- Email delivery is stubbed by design; alert events are stored in PostgreSQL instead of being sent.
- The local machine currently reports Python 3.13. The heavier ML path is still safer on Python 3.11 if you later enable Detoxify.