{"id":31559627,"url":"https://github.com/mhmdd-farhan/ai-companion-api","last_synced_at":"2025-10-05T01:55:09.310Z","repository":{"id":316588897,"uuid":"1062538633","full_name":"mhmdd-farhan/ai-companion-api","owner":"mhmdd-farhan","description":"A smart AI chatbot backend that allows custom AI roles for each chat, providing highly specific interactions tailored to the persona. This is the backend/API service for the AI Companion frontend application.","archived":false,"fork":false,"pushed_at":"2025-09-25T13:48:33.000Z","size":17143,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-25T14:37:36.207Z","etag":null,"topics":["ai","backend","chatbot"],"latest_commit_sha":null,"homepage":"https://ai-companion-api.onrender.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mhmdd-farhan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-23T11:45:11.000Z","updated_at":"2025-09-25T13:48:36.000Z","dependencies_parsed_at":"2025-09-25T14:48:20.173Z","dependency_job_id":null,"html_url":"https://github.com/mhmdd-farhan/ai-companion-api","commit_stats":null,"previous_names":["mhmdd-farhan/ai-companion-api"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/mhmdd-farhan/ai-companion-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhmdd-farhan%2Fai-companion-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhmdd-farhan%2Fai-companion-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhmdd-farhan%2Fai-companion-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhmdd-farhan%2Fai-companion-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mhmdd-farhan","download_url":"https://codeload.github.com/mhmdd-farhan/ai-companion-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhmdd-farhan%2Fai-companion-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278399690,"owners_count":25980332,"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","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ai","backend","chatbot"],"created_at":"2025-10-05T01:55:05.258Z","updated_at":"2025-10-05T01:55:09.305Z","avatar_url":"https://github.com/mhmdd-farhan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI Companion Backend\n\nA smart AI chatbot backend that allows custom AI roles for each chat, providing highly specific interactions tailored to the persona. This is the backend/API service for the AI Companion frontend application.\n\n## Features\n\n- **User Authentication**: Automatic registration and login system - if a username is registered, it automatically logs in\n- **Multi-Chat Support**: Each user can have multiple chat sessions\n- **Custom Personas**: Each chat can have its own specific AI persona and personality\n- **Security Features**:\n  - CORS configuration\n  - Rate limiting for chat and message endpoints\n  - API key header authentication\n- **Testing**: Comprehensive test suite using Jest to prevent bugs and errors\n- **Scalable Architecture**: Built with modern backend best practices\n\n## Tech Stack\n\n- **Runtime**: Node.js\n- **Framework**: Hono.js\n- **Language**: TypeScript\n- **ORM**: Prisma\n- **AI Model**: gpt-4o-mini\n- **Database**: PostgreSQL\n\n## Integrated Frontend Application\n\n[AI Companion Frontend](https://github.com/mhmdd-farhan/ai-companion-frontend)\n\n## API Documentation\n\n### Quick Reference\n\n| URL                                        | Method | Headers                                        | Body                   |\n| ------------------------------------------ | ------ | ---------------------------------------------- | ---------------------- |\n| `http://\u003c\u003clocal-endpoint\u003e\u003e/users`          | POST   | `x-api-key` \u0026 `Content-Type: application/json` | `{ \"name\": \"string\" }` |\n| `http://\u003c\u003clocal-endpoint\u003e\u003e/users`          | GET    | `x-api-key` \u0026 `Content-Type: application/json` | -                      |\n| `http://\u003c\u003clocal-endpoint\u003e\u003e/users/:user_id` | GET    | `x-api-key` \u0026 `Content-Type: application/json` | -                      |\n\n### Complete API Documentation\n\nFor full API documentation including all endpoints, request/response examples, and error codes, please send an email to [fmuh8402@gmail.com](mailto:fmuh8402@gmail.com) to request an invitation to our Hoppscotch documentation workspace.\n\n## How to Contribute\n\nWe welcome contributions! Please follow these steps to set up the development environment:\n\n1. **Clone the repository**\n\n   ```bash\n   git clone https://github.com/mhmdd-farhan/ai-companion-api.git\n   cd ai-companion-api\n   ```\n\n2. **Install dependencies**\n\n   ```bash\n   npm install\n   ```\n\n3. **Set up environment variables**\n\n   ```bash\n   cp .env.example .env\n   # Edit .env with your database credentials and API keys\n   ```\n\n4. **Set up the database**\n\n   ```bash\n   npx prisma generate\n   npx prisma db push\n   ```\n\n5. **Run the development server**\n\n   ```bash\n   npm run dev\n   ```\n\n6. **Run tests**\n\n   ```bash\n   npm test\n   ```\n\n7. **Create a pull request**\n   - Create a feature branch: `git checkout -b feature/your-feature-name`\n   - Make your changes and commit them\n   - Push to your fork and submit a PR\n\n### Development Scripts\n\n- `npm run dev` - Start development server with hot reload\n- `npm run build` - Build the project\n- `npm start` - Start production server\n- `npm test` - Run test suite\n- `npm run test:watch` - Run tests in watch mode\n- `npx prisma studio` - Open Prisma database GUI\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhmdd-farhan%2Fai-companion-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmhmdd-farhan%2Fai-companion-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhmdd-farhan%2Fai-companion-api/lists"}