Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

MdRimon29/SeeMyBodyAI

Open more actions menu

Repository files navigation

SeeMyBodyAI Backend

License

A backend platform built for AI-driven clinic workflows, with a strong focus on RAG based chatbot agent interaction, image generation/editing, and a robust production-ready API.

What this project does

SeeMyBodyAI Backend powers the AI and ML experience for medical aesthetics clinics by combining:

  • a chatbot/RAG agent for clinic assistant interaction and guided conversational workflows
  • image generation using Google Gemini to simulate patient transformation results
  • image editing workflows for refined simulated outputs
  • secure admin and user authentication with JWT tokens
  • lead capture and analytics through simulation details and consultation records
  • payment orchestration using Stripe checkout

Why this project is useful

AI & ML-first capabilities

  • Chatbot assistant: provides an authenticated /user/agent endpoint for natural language, clinic-specific responses.
  • Generative image pipeline: supports uploading real patient photos, generating a simulation, and editing the output.
  • Prompt-driven experience: integrates prompt logic that is ready for extension and experimentation.

Strong backend foundation

  • FastAPI-based API with clean routing and dependency injection
  • SQLAlchemy ORM for relational database management
  • Role-based access with admin and normal user separation
  • AWS S3 storage for image upload management
  • Stripe payment endpoints for checkout and purchase flows

Getting started

Prerequisites

  • Python 3.11+
  • A database connection via DATABASE_URL (SQLite, PostgreSQL, etc.)
  • Google API key for Gemini image generation
  • Stripe secret key and optional PRICE_ID
  • AWS credentials and S3 bucket configuration for file uploads

Install dependencies

python -m venv .venv
.\.venv\Scripts\activate
pip install -r requirements.txt

Configure environment

Create a .env file in the repository root with the required settings:

DATABASE_URL=sqlite:///./app.db
SECRET_KEY=your-secret-key
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=60
OPEN_AI=your-openai-key
GOOGLE_API_KEY=your-google-api-key
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=your-aws-key
AWS_SECRET_ACCESS_KEY=your-aws-secret
S3_BUCKET_NAME=your-s3-bucket
SECRET_KEY_STRIPE=your-stripe-secret-key
PRICE_ID=your-stripe-price-id
WOMPI_PUBLIC_KEY=your-wompi-public-key
WOMPI_PRIVATE_KEY=your-wompi-private-key

Note: There is no .env.example file included, so create .env manually.

Run the application

uvicorn app.main:app --reload

Open the local API docs:

  • Swagger UI: http://127.0.0.1:8000/docs
  • ReDoc: http://127.0.0.1:8000/redoc

Docker support

A docker-compose.yml file is present for containerized startup. Configure environment values before running.

Key features and API surface

AI chatbot & agent

  • POST /user/agent — authenticated agent endpoint for clinic chatbot interactions

Image generation and editing

  • POST /ai-simulation/simulate/image — generate a simulation image from an uploaded photo
  • POST /ai-simulation/edit_simulated_image — edit an existing generated image using prompt input
  • POST /ai-simulation/in_out_img_store — store generated simulation results for a user

Authentication and admin management

  • POST /auth/login — admin login
  • POST /auth/token — admin OAuth2 token endpoint
  • GET /admin/admin_dashboard — admin overview metrics
  • GET /admin/search_leads — search leads and simulation records

Payments and checkout

  • POST /stripe/create-checkout-session — create a Stripe checkout session
  • GET /stripe/success — payment success callback
  • GET /stripe/cancel — payment cancel callback

Project structure

  • app/ — main application package
  • app/api/ — FastAPI routers for auth, admin, agent, simulation, payments, and health
  • app/core/ — configuration, logging, and application bootstrap
  • app/db/ — SQLAlchemy engine, session, and database dependencies
  • app/models/ — ORM model definitions
  • app/schemas/ — request and response schemas
  • app/services/ — security, authentication, and application business logic
  • app/agents/ — RAG and agent orchestration code
  • app/storage/ — S3 upload utilities
  • app/ml/notebooks/ — AI experimentation and demo notebooks
  • docs/ARCHITECTURE.md — architecture notes and refactor roadmap
  • tests/ — test suites and integration tests

Where to get help

  • Use docs/ARCHITECTURE.md for architecture and migration guidance.
  • Inspect app/api/ for route behavior and app/services/ for core logic.
  • Run the app locally and use FastAPI documentation at /docs.

Contribution

  • Fixes, enhancements, and AI pipeline improvements are welcome.
  • Open issues for new features or backend changes.
  • Reference docs/ARCHITECTURE.md before reorganizing major components.
  • Keep new API endpoints in app/api/ and business logic in app/services/.

Maintainers

  • Primary maintainer: Md Raisul Islam Rimon

Notes

  • app/main.py is the preferred structured entrypoint.
  • new_main.py and legacy root modules are preserved for compatibility.
  • Production deployments should transition from Base.metadata.create_all() to Alembic migrations.

About

AI-first FastAPI backend for clinic workflows with Google Gemini image generation/editing, LangChain/RAG chatbot assistant, Stripe payment integration, AWS S3 storage, and secure SQLAlchemy authentication.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.