{"id":24971230,"url":"https://github.com/proofoftom/hf-image-monorepo","last_synced_at":"2025-03-29T05:36:13.669Z","repository":{"id":273606236,"uuid":"920267347","full_name":"proofoftom/hf-image-monorepo","owner":"proofoftom","description":"Express.js server paired with React.js frontend for AI image generation workflows using text-to-image models hosted on Hugging Face. Manages API requests, model inference, and response handling.","archived":false,"fork":false,"pushed_at":"2025-01-29T03:37:19.000Z","size":2122,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-03T16:09:59.586Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/proofoftom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-21T21:10:58.000Z","updated_at":"2025-01-29T03:37:22.000Z","dependencies_parsed_at":"2025-01-25T18:24:37.793Z","dependency_job_id":null,"html_url":"https://github.com/proofoftom/hf-image-monorepo","commit_stats":null,"previous_names":["proofoftom/image-wizard","proofoftom/hf-image-monorepo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proofoftom%2Fhf-image-monorepo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proofoftom%2Fhf-image-monorepo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proofoftom%2Fhf-image-monorepo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proofoftom%2Fhf-image-monorepo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/proofoftom","download_url":"https://codeload.github.com/proofoftom/hf-image-monorepo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246145017,"owners_count":20730494,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-03T16:10:04.498Z","updated_at":"2025-03-29T05:36:13.647Z","avatar_url":"https://github.com/proofoftom.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hugging Face Image Generator\n\n![Mountain Sunset](./mountain_sunset.png)\n\n### Quick start with Docker\n\nFor quickly testing out the app:\n\n```bash\ngit clone https://github.com/proofoftom/hf-image-monorepo image-wizard\ncd image-wizard\n. ./docker-run.sh\n```\n\nFor development, see below.\n\n## [Backend](./backend)\n\n### Overview\n\nExpress.js server handling AI image generation workflows using text-to-image models hosted on Hugging Face. Manages API requests, model inference, and response handling.\n\n### Structure\n\n```\nsrc/\n├── __tests__/                   - Jest test suites\n├── config/                      - Environment configuration\n│   └── env.ts                   - Config validation and setup\n├── controllers/                 - Route handlers\n│   └── image.controller.ts      - Image processing endpoints\n├── middlewares/                 - Express middleware\n│   ├── error.middleware.ts      - Global error handler\n│   ├── rateLimit.middleware.ts  - Request throttling\n│   └── validation.middleware.ts - Request validation\n├── routes/                      - API endpoint definitions\n│   └── api.ts                   - Main router configuration\n├── services/                    - Business logic layer\n│   └── huggingface.service.ts   - Hugging Face model integration\n├── types/                       - TypeScript type definitions\n│   └── requests.d.ts            - API request payload types\n└── server.ts                    - Main application entry point\n```\n\n### Starting the server\n\n```bash\ncd backend\npnpm install\ncp .env.example .env # Update with your Hugging Face Access Token and model\npnpm dev\n```\n\n### Configuration\n\n**Environment variables (via `.env`):**\n\n- PORT: Server port (default: 3000)\n- CORS_ORIGIN: Allowed origins (default: localhost:5173)\n- HUGGINGFACE_ACCESS_TOKEN: Access token for AI services\n- HUGGINGFACE_MODEL: Model identifier (used as fallback if not provided in request)\n\n### API Documentation\n\n#### Middleware stack\n\n- CORS with configurable origins\n- 10MB JSON payload limit\n- URL-encoded body parsing\n- Rate limiting\n- Request validation\n- Error handling with structured responses\n\n#### Health Check Endpoint\n\nEnsure the API is running and responsive.\n\nPOST `/api/health-check`\n\n#### Generate Image Endpoint\n\nPOST `/api/generate`\n\n**Request Body:**\n\n```json\n{\n  \"model\": \"string (optional, default from .env)\",\n  \"prompt\": \"string (required, max 500 chars)\",\n  \"negativePrompt\": \"string (optional, max 500 chars)\",\n  \"width\": \"number (optional, 256-1024)\",\n  \"height\": \"number (optional, 256-1024)\",\n  \"format\": \"string (optional, 'jpeg' or 'png')\"\n}\n```\n\n**Example Negative Prompts:**\n\n- For portraits: \"blurry, distorted face, extra fingers\"\n- For landscapes: \"low quality, oversaturated, unrealistic\"\n- For objects: \"poorly drawn, cartoonish, low detail\"\n\n### Testing\n\n```bash\ncd backend\npnpm test\n```\n\n- Jest test framework\n- Tests located in `backend/src/__tests__/` directory\n\n## [Frontend](./frontend)\n\n![App Screenshot](./screenshot.png)\n\n### Starting the frontend\n\nAfter [starting the server](#starting-the-server):\n\n```bash\ncd frontend\npnpm install\npnpm dev\n```\n\n## Potential Future Features\n\n- Store and display generated image history\n- Mint NFT from generated image\n\n## Contact\n\nLooking for a rock-star Backend AI/Web3 Engineer? [Let's connect!](mailto:hf-image-monorepo.prowling715@passinbox.com)\n\n[LinkedIn](https://linkedin.com/in/proofoftom)\n\n---\n\n**Note:** This project is under active development. Please report any issues or suggestions in the [issues section](https://github.com/proofoftom/hf-image-monorepo/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproofoftom%2Fhf-image-monorepo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproofoftom%2Fhf-image-monorepo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproofoftom%2Fhf-image-monorepo/lists"}