{"id":28218885,"url":"https://github.com/twfksh/assesment-python-django-api","last_synced_at":"2025-06-11T05:32:11.340Z","repository":{"id":293403435,"uuid":"983463021","full_name":"twfksh/assesment-python-django-api","owner":"twfksh","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-15T06:03:26.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-15T07:21:55.328Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/twfksh.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,"zenodo":null}},"created_at":"2025-05-14T12:21:22.000Z","updated_at":"2025-05-15T06:03:30.000Z","dependencies_parsed_at":"2025-05-15T07:21:57.641Z","dependency_job_id":"f6bb8915-2426-4d8d-85d1-2c5ed5885bef","html_url":"https://github.com/twfksh/assesment-python-django-api","commit_stats":null,"previous_names":["twfksh/assesment-python-django-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twfksh%2Fassesment-python-django-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twfksh%2Fassesment-python-django-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twfksh%2Fassesment-python-django-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twfksh%2Fassesment-python-django-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twfksh","download_url":"https://codeload.github.com/twfksh/assesment-python-django-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twfksh%2Fassesment-python-django-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259207463,"owners_count":22821671,"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-05-18T02:10:46.951Z","updated_at":"2025-06-11T05:32:11.332Z","avatar_url":"https://github.com/twfksh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django-Blog-API\n\nA RESTful Blog API built with Django and Django REST Framework, supporting user authentication (with JWT), user profiles, posts, tags, comments, and post likes.\n\n## Features\n\n- **User Registration \u0026 Authentication**\n  - Register, login, logout, and refresh JWT tokens (using HttpOnly cookies for security)\n  - Custom user model with email as the primary identifier\n  - User profile with avatar and bio\n\n- **Blog Posts**\n  - CRUD operations for posts (authenticated users can create, update, and delete their own posts)\n  - Tagging system for posts\n  - Like/unlike posts\n\n- **Comments**\n  - CRUD operations for comments on posts\n  - Only authenticated users can comment\n\n- **API Permissions**\n  - Only authors can modify or delete their own posts/comments\n  - Read-only access for unauthenticated users\n\n- **CORS Support**\n  - Configured for cross-origin requests\n\n## Project Structure\n\n```\n.\n├── apps/\n│   ├── posts/\n│   └── users/\n├── config/\n├── db.sqlite3\n├── manage.py\n├── requirements.txt\n├── pyproject.toml\n└── .env.sample\n```\n\n## Setup\n\n1. **Clone the repository**\n\n   ```sh\n   git clone https://github.com/twfksh/assesment-python-django-api.git\n   cd assesment-python-django-api\n   ```\n\n2. **Create and activate a virtual environment**\n\n   ```sh\n   uv venv\n   source .venv/bin/activate  # On Windows: .venv\\Scripts\\activate\n   ```\n\n3. **Install dependencies**\n\n   ```sh\n   uv pip install -r requirements.txt\n   ```\n\n4. **Configure environment variables**\n\n   - Copy `.env.sample` to `.env` and fill in your values:\n\n     ```\n     DEBUG=True\n     SECRET_KEY=your_secret_key\n     ```\n\n5. **Apply migrations**\n\n   ```sh\n   python manage.py migrate\n   ```\n\n6. **Create a superuser (optional, for admin access)**\n\n   ```sh\n   python manage.py createsuperuser\n   ```\n\n7. **Run the development server**\n\n   ```sh\n   python manage.py runserver\n   ```\n\n## API Endpoints\n\n### User Endpoints\n\n- `POST /api/users/register/` — Register a new user\n- `POST /api/users/login/` — Login and receive JWT tokens (set as HttpOnly cookies)\n- `POST /api/users/logout/` — Logout and blacklist refresh token\n- `POST /api/users/refresh-token/` — Refresh JWT tokens\n- `GET/PUT /api/users/` — Get or update user info\n- `GET/PUT /api/users/profile/` — Get or update user profile\n- `GET/PUT /api/users/profile/avatar/` — Get or update user avatar\n\n### Post \u0026 Tag Endpoints\n\n- `GET /api/posts/tags/` — List all tags\n- `GET/POST /api/posts/` — List or create posts\n- `GET/PUT/PATCH/DELETE /api/posts/\u003cid\u003e/` — Retrieve, update, or delete a post\n- `POST /api/posts/like/\u003cid\u003e/` — Like or unlike a post\n\n### Comment Endpoints\n\n- `GET/POST /api/posts/\u003cpost_id\u003e/comment/` — List or create comments for a post\n- `GET/PUT/PATCH/DELETE /api/posts/\u003cpost_id\u003e/comment/\u003cid\u003e/` — Retrieve, update, or delete a comment\n\n## Customization\n\n- **User model:** See [`apps.users.models.UserAccount`](apps/users/models.py)\n- **Authentication:** Custom JWT authentication using HttpOnly cookies ([`apps.users.authentication.HttpOnlyJWTAuthentication`](apps/users/authentication.py))\n- **Permissions:** Custom permission classes for post/comment authorship ([`apps.posts.permissions.IsAuthorOrReadOnly`](apps/posts/permissions.py))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwfksh%2Fassesment-python-django-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwfksh%2Fassesment-python-django-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwfksh%2Fassesment-python-django-api/lists"}