Skip to content

A clean and secure ToDo App built with Django REST Framework, HTMX , DaisyUI-Tailwind, featuring JWT Authentication, advanced filtering, search, ordering, and auto-generated documentation with drf-spectacular.

License

Notifications You must be signed in to change notification settings

alanhasn/Task-manager-using-Django-HTMX-and-DRF

Repository files navigation

πŸ“ ToDo Manager – API & Interactive UI

A clean, secure, and dynamic ToDo Management App built with Django, Django REST Framework, HTMX, and TailwindCSS (DaisyUI).
It supports both a fully-documented RESTful API and an interactive web UI without heavy JavaScript.


πŸ“Έ Project Preview

Dashboard

Dashboard| No task Dashboard| List of tasks

Modals

Create Task Modal

Edit Task Modal

Authentcation

Login Page

Register Page


πŸš€ Features

βœ… Backend API (DRF + JWT)

  • Register / Login via JWT
  • Create / Read / Update / Delete your tasks
  • Tasks are user-specific (private per user)
  • Filtering, searching, ordering support
  • Swagger / ReDoc auto documentation

🌐 Frontend UI (HTMX + TailwindCSS)

  • Dynamic task list
  • Modal for create / update tasks
  • Built using HTMX + Django Partials
  • Fully responsive with DaisyUI design

🧰 Tech Stack

Layer Tools Used
Backend Django 5.2.3, Django REST Framework
Auth Simple JWT (Access/Refresh tokens)
API Docs drf-spectacular (OpenAPI/Swagger/ReDoc)
UI Framework Django Templates + HTMX
CSS Styling TailwindCSS + DaisyUI
Filtering django-filter

πŸ“¦ Installation

# 1. Clone repo
git clone https://github.com/alanhasn/Task-manager-using-Django-HTMX-and-DRF
cd Task-manager-using-Django-HTMX-and-DRF

# 2. Create virtual env
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# 3. Install dependencies
pip install -r requirements.txt

# 4. Apply migrations
python manage.py migrate

# 5. Run server
python manage.py runserver

πŸ” Authentication (JWT)

βœ… Register

POST /api/register/

{
  "username": "mohammed doe",
  "email": "doela@example.com",
  "password": "StrongPassword123"
}

πŸ”‘ Login

POST /api/login/

{
  "username": "mohammed doe",
  "password": "StrongPassword123"
}

πŸ”„ Refresh Token

POST /api/token/refresh/

{
  "refresh": "<your_refresh_token>"
}

πŸ“š API Documentation

Swagger UI Redoc

Access the API documentation at:


πŸ§ͺ API Endpoints

Method Endpoint Description Auth
GET /api/todos/ List current user’s todos βœ…
POST /api/todos/ Create a new todo βœ…
GET /api/todos/{id}/ Retrieve a specific todo βœ…
PUT /api/todos/{id}/ Update a todo βœ…
DELETE /api/todos/{id}/ Delete a todo βœ…
GET /api/users/ Get authenticated user + related todos βœ…

πŸ” Filtering, Searching, Ordering

Search Example

Feature Example
Filter /api/todos/?completed=true
Date Range /api/todos/?created_at__gte=2024-01-01
Search /api/todos/?search=meeting
Order /api/todos/?ordering=-updated_at

🌐 Frontend (HTMX UI)

πŸ’» Key UI Pages

Page Description
πŸ” Login / Register Forms for Session authentication , login and registration
🏠 Dashboard List of tasks for logged-in user
πŸ†• Create Task Form to add new task using hx-post
πŸ“ Update Task Inline or modal form using hx-post
❌ Delete Task Deletion via hx-delete with confirmation

βš™οΈ HTMX Interactions Used

  • hx-get β†’ Load dynamic content (e.g. task table)
  • hx-post β†’ Create task
  • hx-delete β†’ Delete task
  • hx-target, hx-swap β†’ Update DOM elements
  • hx-trigger β†’ triggers like load, submit, change

🧩 Best Practices Followed

  • Separation of API & UI logic
  • Modularized app using todo/api/
  • DRY templates using partials/
  • Auth-protected views and endpoints
  • Password validation with strong rules
  • HTMX + Django used progressively (no JS frameworks)

πŸ§‘β€πŸ’» Author


πŸ“ƒ License

This project is licensed under the MIT License. See LICENSE file for more details.

About

A clean and secure ToDo App built with Django REST Framework, HTMX , DaisyUI-Tailwind, featuring JWT Authentication, advanced filtering, search, ordering, and auto-generated documentation with drf-spectacular.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published