{"id":26090546,"url":"https://github.com/badar25/journal-backend","last_synced_at":"2026-05-02T11:39:30.871Z","repository":{"id":280138794,"uuid":"939812745","full_name":"Badar25/Journal-backend","owner":"Badar25","description":"AI Journal is a stateless API that brings your journal entries to life! Powered by FastAPI, Google’s Gemini LLM, and Qdrant, it delivers context-aware insights through Retrieval-Augmented Generation (RAG).","archived":false,"fork":false,"pushed_at":"2025-03-03T14:07:47.000Z","size":177,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-09T09:34:29.739Z","etag":null,"topics":["fastapi","qdrant","rag"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Badar25.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-02-27T06:33:47.000Z","updated_at":"2025-03-03T14:07:50.000Z","dependencies_parsed_at":"2025-03-01T14:32:27.768Z","dependency_job_id":"ab3870d1-6079-4366-978d-a7f7f327638c","html_url":"https://github.com/Badar25/Journal-backend","commit_stats":null,"previous_names":["badar25/journal-backend"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Badar25%2FJournal-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Badar25%2FJournal-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Badar25%2FJournal-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Badar25%2FJournal-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Badar25","download_url":"https://codeload.github.com/Badar25/Journal-backend/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242673793,"owners_count":20167294,"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":["fastapi","qdrant","rag"],"created_at":"2025-03-09T09:34:31.480Z","updated_at":"2026-05-02T11:39:30.798Z","avatar_url":"https://github.com/Badar25.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Journal AI Backend\n\nA FastAPI-based backend service that provides AI-enhanced journaling capabilities with semantic search, summarization, and interactive chat features.\n\n## ⚡ Tech Stack\n-\tFastAPI - High-performance Python backend\n-\tGoogle Gemini LLM - AI-driven journal insights\n-\tQdrant + SentenceTransformers - Vector search for context retrieval\n-\tVersioning + Testing - Scalable API\n\n## 🚀 Features\n\n- Journal entry creation and management\n- Semantic search using Qdrant vector database\n- AI-powered journal summarization using Google's Gemini Pro\n- Interactive chat with your journal entries\n- Firebase authentication\n- Structured error handling and logging\n- API versioning\n\n## 🛠 Tech Stack\n\n- **Framework:** FastAPI\n- **Authentication:** Firebase Admin SDK\n- **Vector Database:** Qdrant\n- **AI Models:**\n  - Google Gemini 1.5 Pro (for chat and summarization)\n  - Sentence Transformer (all-MiniLM-L6-v2 for embeddings)\n- **Logging:** Custom colored logging with rotation\n- **Validation:** Pydantic\n\n## 📁 Project Structure\n\n```plaintext\nsrc/\n├── api/\n│   └── v1/\n│       ├── endpoints/\n│       │   └── journals.py\n│       └── router.py\n├── core/\n│   ├── config.py\n│   ├── firebase.py\n│   ├── logger.py\n│   └── prompt_templates.py\n├── models/\n│   ├── journal.py\n│   └── response.py\n├── services/\n│   ├── gemini_service.py\n│   └── qdrant_service.py\n├── utils/\n│   └── journal_validator.py\n└── main.py\n```\n\n## ⚙️ Environment Variables\n\nCreate a `.env` file with:\n\n```plaintext\nQDRANT_URL=http://localhost:6333\nFIREBASE_CREDENTIALS_BASE64=\u003cbase64_encoded_firebase_credentials\u003e\nGEMINI_API_KEY=\u003cyour_gemini_api_key\u003e\n```\n\n## 🚀 Getting Started\n\n1. Clone the repository\n```bash\ngit clone https://github.com/Badar25/Journal-backend\n```\n\n2. Install dependencies\n```bash\npip install -r requirements.txt\n```\n\n3. Start Qdrant (using Docker)\n```bash\ndocker run -p 6333:6333 qdrant/qdrant\n```\n\n4. Run the application\n```bash\nuvicorn src.main:app --reload --host 0.0.0.0 --port 8000\n```\n\n## 📌 API Endpoints\n\n### Authentication\nAll endpoints require Firebase authentication token in the header:\n```\nAuthorization: Bearer \u003cfirebase_token\u003e\n```\n\n### Journals\n\n#### Create Journal\n- **POST** `/v1/journals/`\n- **Body:**\n```json\n{\n    \"title\": \"string\",\n    \"content\": \"string\"\n}\n```\n\n#### Update Journal\n- **PUT** `/v1/journals/{journal_id}`\n- **Body:**\n```json\n{\n    \"title\": \"string (optional)\",\n    \"content\": \"string (optional)\"\n}\n```\n\n#### Get Journals\n- **GET** `/v1/journals/`\n- **Query Params:** `days` (optional, int)\n\n#### Get Summary\n- **GET** `/v1/journals/summary`\n- **Query Params:** `days` (optional, int, default=7)\n\n#### Search Journals\n- **GET** `/v1/journals/search`\n- **Query Params:** `query` (required), `limit` (optional, default=3)\n\n## 🔒 Validation Rules\n\n### Journal Content\n- Title: Max 200 characters\n- Content: Max 999 words\n- At least one field (title or content) must be provided\n\n## ⚠️ Error Codes\n\n| Code | Description |\n|------|-------------|\n| TOKEN_EXPIRED | Authentication token has expired |\n| TOKEN_REVOKED | Authentication token has been revoked |\n| TOKEN_INVALID | Invalid authentication token |\n| AUTH_ERROR | General authentication failure |\n| EMPTY_FIELDS | Required fields are empty |\n| TITLE_TOO_LONG | Title exceeds 200 characters |\n| CONTENT_TOO_LONG | Content exceeds 999 words |\n| MISSING_FIELDS | Required fields are missing |\n| JOURNAL_NOT_FOUND | Requested journal doesn't exist |\n| UNAUTHORIZED | Not authorized to access the journal |\n| GEMINI_ERROR | AI processing error |\n| SEARCH_ERROR | Vector search failed |\n| INITIALIZATION_ERROR | Service initialization failed |\n\n## 📊 Response Format\n\nAll API responses follow this structure:\n```json\n{\n    \"success\": boolean,\n    \"message\": string,\n    \"data\": object | null,\n    \"error\": string | null\n}\n``` \n## 🧪 Testing\n\nRun tests using pytest:\n```bash\npytest tests -v\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadar25%2Fjournal-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbadar25%2Fjournal-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadar25%2Fjournal-backend/lists"}