# prashantnegi11/higgsfield architecture

> Architecture diagram of the GitHub repository prashantnegi11/higgsfield, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prashantnegi11/higgsfield
- Repository: https://github.com/prashantnegi11/higgsfield

## Overview

This repository contains a small media-generation backend: clients submit signup, avatar, and video requests to an Express API, which validates signup data, persists users, and delegates media generation to external services. Avatar generation also saves returned image bytes locally; video generation returns the external provider’s response. Several authentication, profile, model, and avatar retrieval routes are registered but have empty handlers in the sampled source. The README describes a generic Turborepo starter and does not document this backend; relationships below are based on the sampled backend source.

Main entry points: [`apps/backend/src/index.ts`](https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/src/index.ts) (Express Server), [`apps/backend/image.ts`](https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/image.ts) (Image Generation), [`apps/backend/video.ts`](https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/video.ts) (Video Generation), [`apps/backend/db.ts`](https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/db.ts) (Prisma Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_server["Express Server<br/>[index.ts]"]
  node_signup["Signup Handler<br/>[index.ts]"]
  node_auth_stub["Signin Stub<br/>[index.ts]"]
  node_avatar_route["Avatar Handler<br/>[index.ts]"]
  node_video_route["Video Handler<br/>[index.ts]"]
  node_read_stubs["Read Route Stubs<br/>[index.ts]"]
  node_user_schema["User Validation<br/>[types.ts]"]
end

subgraph group_generation["Media Generation"]
  node_image_gen["Image Generation<br/>[image.ts]"]
  node_image_service["Image Provider"]
  node_video_gen["Video Generation<br/>[video.ts]"]
  node_video_service["Video Provider"]
end

subgraph group_persistence["Persistence"]
  node_local_assets[("Saved Images")]
  node_prisma_client["Prisma Client<br/>[db.ts]"]
  node_user_store[("User Store<br/>[schema.prisma]")]
end

node_client(("API Client"))

node_client -->|"sends requests"| node_server
node_server -->|"routes signup"| node_signup
node_server -->|"routes signin"| node_auth_stub
node_server -->|"routes avatar"| node_avatar_route
node_server -->|"routes video"| node_video_route
node_server -->|"routes reads"| node_read_stubs
node_signup -->|"validates with"| node_user_schema
node_signup -->|"creates user"| node_prisma_client
node_prisma_client -->|"stores user"| node_user_store
node_avatar_route -->|"requests image"| node_image_gen
node_image_gen -->|"requests generation"| node_image_service
node_image_gen -->|"writes image"| node_local_assets
node_video_route -->|"requests video"| node_video_gen
node_video_gen -->|"requests generation"| node_video_service

click node_server "https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/src/index.ts"
click node_signup "https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/src/index.ts"
click node_auth_stub "https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/src/index.ts"
click node_avatar_route "https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/src/index.ts"
click node_video_route "https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/src/index.ts"
click node_read_stubs "https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/src/index.ts"
click node_user_schema "https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/types.ts"
click node_image_gen "https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/image.ts"
click node_video_gen "https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/video.ts"
click node_local_assets "https://github.com/prashantnegi11/higgsfield/tree/main/apps/backend/assets"
click node_prisma_client "https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/db.ts"
click node_user_store "https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/prisma/schema.prisma"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_signup,node_auth_stub,node_avatar_route,node_video_route,node_read_stubs,node_user_schema,node_client toneBlue
class node_image_gen,node_image_service,node_video_gen,node_video_service toneAmber
class node_local_assets,node_prisma_client,node_user_store toneMint
```

## Components

### HTTP API

- [Express Server](https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/src/index.ts): `apps/backend/src/index.ts`
- [Signup Handler](https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/src/index.ts): `apps/backend/src/index.ts`
- [Signin Stub](https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/src/index.ts): `apps/backend/src/index.ts`
- [Avatar Handler](https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/src/index.ts): `apps/backend/src/index.ts`
- [Video Handler](https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/src/index.ts): `apps/backend/src/index.ts`
- [Read Route Stubs](https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/src/index.ts): `apps/backend/src/index.ts`
- [User Validation](https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/types.ts): `apps/backend/types.ts`

### Media Generation

- [Image Generation](https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/image.ts): `apps/backend/image.ts`
- **Image Provider**
- [Video Generation](https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/video.ts): `apps/backend/video.ts`
- **Video Provider**

### Persistence

- [Saved Images](https://github.com/prashantnegi11/higgsfield/tree/main/apps/backend/assets): `apps/backend/assets`
- [Prisma Client](https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/db.ts): `apps/backend/db.ts`
- [User Store](https://github.com/prashantnegi11/higgsfield/blob/main/apps/backend/prisma/schema.prisma): `apps/backend/prisma/schema.prisma`

### Other components

- **API Client**

## Connections

- API Client → Express Server: sends requests (evidence: `apps/backend/src/index.ts`)
- Express Server → Signup Handler: routes signup (evidence: `apps/backend/src/index.ts`)
- Express Server → Signin Stub: routes signin (evidence: `apps/backend/src/index.ts`)
- Express Server → Avatar Handler: routes avatar (evidence: `apps/backend/src/index.ts`)
- Express Server → Video Handler: routes video (evidence: `apps/backend/src/index.ts`)
- Express Server → Read Route Stubs: routes reads (evidence: `apps/backend/src/index.ts`)
- Signup Handler → User Validation: validates with (evidence: `apps/backend/src/index.ts`)
- Signup Handler → Prisma Client: creates user (evidence: `apps/backend/src/index.ts`)
- Prisma Client → User Store: stores user (evidence: `apps/backend/db.ts`)
- Avatar Handler → Image Generation: requests image (evidence: `apps/backend/src/index.ts`)
- Image Generation → Image Provider: requests generation (evidence: `apps/backend/image.ts`)
- Image Generation → Saved Images: writes image (evidence: `apps/backend/image.ts`)
- Video Handler → Video Generation: requests video (evidence: `apps/backend/src/index.ts`)
- Video Generation → Video Provider: requests generation (evidence: `apps/backend/video.ts`)
