SculptFlowApp

MySculptFlow (SculptFlow)

Multi-tenant SaaS for plastic surgery clinics. A lead messages a clinic on WhatsApp or Telegram, an AI agent (orchestrated by n8n) answers from the clinic’s Knowledge Base, qualifies the lead and books consultations, and staff can take over any conversation from the dashboard Inbox. Clinics also run WhatsApp template campaigns (especially old-lead reactivation) against their existing leads.

For the full, current state of the project read PROJECT_HANDOFF.md first. It is the single source of truth for architecture, tables, endpoints, config keys, migrations, decisions and open TODOs. This README is only a short orientation.

Stack

Main features

Local setup

  1. Database. Run against a Postgres instance with pgvector (Supabase or local), in order:
    psql "<connection string>" -f Database/schema.sql
    psql "<connection string>" -f Database/seed-config.sql   # every setting with its default (never overwrites)
    psql "<connection string>" -f Database/seed.sql   # optional demo clinic, procedures and leads
    psql "<connection string>" -f Database/seed-demo.sql   # optional fully populated demo clinic (re-runnable, dummy data; sign-in and placeholder password in the file header, change it)
    

    Both are idempotent. Tables live in one Postgres schema per area (core, crm, billing, …); running schema.sql on a database created before 2026-10-07 moves its tables out of public (back it up first).

  2. Secrets. From the PlasticSurgery project folder, use user-secrets (never commit real values):
    dotnet user-secrets set "ConnectionStrings:Postgres" "Host=...;Port=5432;Database=...;Username=...;Password=..."
    

    Use key=value format (not a postgresql:// URI) and, for Supabase, the session pooler host. The other secrets (Meta:*, N8n:*; the embeddings API key is set on the admin portal’s Configuration page) are listed in PROJECT_HANDOFF.md §20.

  3. Run.
    dotnet build
    dotnet run --project PlasticSurgery --launch-profile https
    

    Open https://localhost:7276, register an account (this creates a new clinic) and you land on /dashboard. Swagger is at /swagger in Development only. There is no Razor runtime compilation, so .cshtml/.cs changes need a stop, build and run.

  4. Tests. dotnet test PlasticSurgery.Tests. The billing database tests need SCULPTFLOW_TEST_DB set to a throwaway local PostgreSQL server (e.g. Host=localhost;Port=5432;Username=postgres;Password=...); each run creates and drops its own database. Without it those tests are skipped. Never point it at Supabase.

Known gaps

See PROJECT_HANDOFF.md §17 (pending work) and §22 (TODOs). The most important: rotate the secrets that were once in git history, derive clinicId server-side for the AI endpoints, verify Meta webhook signatures, add forwarded-headers handling and persistent DataProtection keys, and protect the anonymous POST /api/leads. Only the billing module has automated tests so far.