Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ DevFocus - Developer Context Intelligence Engine

A full–scale, production‑grade backend architecture made public - because my real projects are private. πŸ”’πŸ”₯


🧩 Problem

As developers, we constantly:

  • Jump between tasks ➑️ lose flow
  • Forget why we context‑switched
  • Scatter links (PRs, Issues, Docs, Research) everywhere
  • Have no metrics on real focus time
  • Work inside private repos where our best architecture never sees daylight
  • Have no unified view of productivity, behavior, or workflow patterns

πŸ‘‰ DevFocus was created to break this invisible wall.
To show the level of engineering I apply daily in my private projects β€” but in a fully open, clean, well‑architected system anyone can inspect.


🌟 Solution

DevFocus is a Context Intelligence Engine that blends:

🧠 Developer workflow tracking

  • ⏱️ Session tracking
  • πŸ”€ Context switching
  • 🧱 Task management (Bug / Feature / Refactor)
  • πŸ”— Resource linking

πŸ‘₯ Team collaboration + RBAC

  • Teams (Owner / Admin / Member / Viewer)
  • Scoped sessions + scoped tasks
  • Permission‑safe domain logic

πŸ“Š Reporting Engine

  • Daily / Weekly reports
  • Programmatic summaries
  • Insight generation

🧬 Insight Engine

Automatic analytics detecting:

  • 🚨 High context switching
  • πŸ’€ Low focus time
  • πŸ“‰ Fragile workflow patterns
  • πŸ” Room for deep‑work improvements

πŸš› Background Jobs (Celery)

  • Non‑blocking report generation
  • Insight analysis
  • Scalable async architecture

πŸ™ GitHub Issue Importer (async httpx)

  • Fetch GitHub issues
  • Auto‑create Tasks
  • Detect + ignore PRs
  • Store external URLs + IDs

πŸ“‘ Observability Layer

  • API Request Logging Middleware
  • Duration, status, user‑agent, IP
  • Full traceability of API usage

πŸ”₯ Realtime Event Stream (SSE)

  • Live reports
  • Live insights
  • Zero WebSocket overhead

πŸ“€ Export System

  • CSV
  • JSON
  • For tasks, sessions, reports, insights

πŸ§ͺ Full Test Suite

  • Unit tests
  • Integration tests
  • Signals tests
  • Celery task pipeline tests
  • GitHub importer tests (mocked async)
  • SSE + middleware tests

🧱 Architecture Overview

devfocus/
 β”œβ”€β”€ core/
 β”‚    β”œβ”€β”€ models.py          # Domain entities
 β”‚    β”œβ”€β”€ services.py        # SOLID service layer
 β”‚    β”œβ”€β”€ signals.py         # Reactive event handling
 β”‚    β”œβ”€β”€ tasks.py           # Celery jobs
 β”‚    β”œβ”€β”€ integrations.py    # GitHub importer
 β”‚    └── ...
 β”‚
 β”œβ”€β”€ api/
 β”‚    β”œβ”€β”€ serializers.py
 β”‚    β”œβ”€β”€ views.py
 β”‚    β”œβ”€β”€ urls.py
 β”‚    └── ...
 β”‚
 β”œβ”€β”€ devfocus/
 β”‚    β”œβ”€β”€ settings.py
 β”‚    β”œβ”€β”€ celery.py
 β”‚    β”œβ”€β”€ middleware.py
 β”‚    └── ...
 β”‚
 β”œβ”€β”€ tests/
 └── README.md

πŸ›  Tech Stack (Full Breakdown)

Backend Core

  • 🐍 Python 3.11+
  • πŸ¦„ Django 5
  • 🌐 Django REST Framework
  • 🧱 Clean Architecture
  • 🧩 SOLID Principles
  • 🧬 Domain‑Driven Components
  • 🧲 Signals for reactive updates

Async & Integrations

  • ⚑ httpx (async)
  • πŸ™ GitHub API integration
  • πŸ”Œ SSE event‑streaming

Workers & Scalability

  • 🐳 Celery 5
  • πŸ”΄ Redis (Broker + Result backend)
  • 🧡 Background report generation
  • βš™οΈ Long-running async workflows

Database / ORM

  • πŸ’Ύ SQLite (dev)
  • βž• Ready for PostgreSQL
  • πŸ” ORM optimization (annotate, select_related, prefetch)

Observability

  • πŸ“˜ Structured API logs
  • πŸ•΅οΈ Request duration tracking
  • πŸ” Per‑user analytics

Testing

  • πŸ§ͺ pytest / Django TestCase
  • ⚑ async test support
  • 🧱 full coverage on:
    • core domain
    • services
    • insights
    • Celery tasks
    • GitHub importer
    • SSE
    • permissions + teams

Run Guide & API Reference

This document contains only the two requested sections:

  1. How to Run the Project\
  2. Full API Endpoint Reference

🟩 1) How to Run DevFocus

1️⃣ Create & Activate Virtual Environment

macOS / Linux

python3 -m venv venv
source venv/bin/activate

Windows (PowerShell)

python -m venv venv
.\venv\Scripts\activate

2️⃣ Install Dependencies

pip install -r requirements.txt

3️⃣ Run Database Migrations

python manage.py makemigrations
python manage.py migrate

4️⃣ Create Superuser (Optional)

python manage.py createsuperuser

5️⃣ Start Development Server

python manage.py runserver

Your API will be served at:

http://127.0.0.1:8000/api/

6️⃣ Start Celery Worker (Background Jobs)

In a second terminal:

celery -A devfocus worker -l info

Ensure Redis is running:

redis-server

7️⃣ Optional: Update Requirements

pip freeze > requirements.txt

🟦 2) API Endpoints (Full Reference)

πŸ”Ή Authentication

(Using default Django session authentication or token if enabled)


πŸ“ TASKS

➀ List Tasks

GET /api/tasks/

➀ Filter / Search / Order

GET /api/tasks/?type=BUG
GET /api/tasks/?priority=HIGH
GET /api/tasks/?search=login
GET /api/tasks/?ordering=-created_at

➀ Create Task

POST /api/tasks/

➀ Retrieve Task

GET /api/tasks/{id}/

➀ Update Task

PATCH /api/tasks/{id}/

➀ Delete Task

DELETE /api/tasks/{id}/

➀ Export Tasks

GET /api/tasks/export/?format=csv
GET /api/tasks/export/?format=json

➀ Import GitHub Issues (async)

POST /api/tasks/import_github/

Body:

{
  "owner": "django",
  "repo": "django",
  "team_id": 1
}

🧩 DEV SESSIONS

➀ List Sessions

GET /api/sessions/

➀ Filter / Order

GET /api/sessions/?status=OPEN
GET /api/sessions/?date_from=2025-01-01
GET /api/sessions/?ordering=-switch_count

➀ Create Session

POST /api/sessions/

➀ Retrieve Session

GET /api/sessions/{id}/

➀ Close Session

POST /api/sessions/{id}/close/

➀ Attach Task to Session

POST /api/sessions/{id}/attach_task/

Body:

{
  "task_id": 5,
  "role": "MAIN"
}

➀ Export Sessions

GET /api/sessions/export/?format=csv
GET /api/sessions/export/?format=json

πŸ”„ CONTEXT SWITCHES

➀ List

GET /api/context-switches/

➀ Create

POST /api/context-switches/

Body:

{
  "dev_session": 1,
  "from_task": 2,
  "to_task": 3,
  "reason": "INTERRUPT"
}

πŸ”— RESOURCE LINKS

➀ List

GET /api/resources/

➀ Create

POST /api/resources/


πŸ“Š REPORTS

➀ List Reports

GET /api/reports/

➀ Generate Daily Report (Sync)

POST /api/reports/daily/

Body (optional):

{
  "date": "2025-01-30"
}

➀ Generate Daily Report (Async)

POST /api/reports/daily-async/


πŸŽ›οΈ REPORT REQUESTS (Celery Jobs)

➀ Create Report Request

POST /api/report-requests/

Body:

{
  "type": "DAILY",
  "day": "2025-01-30"
}

➀ List Requests

GET /api/report-requests/


🧠 INSIGHTS

➀ List

GET /api/insights/


πŸ‘₯ TEAMS

➀ List Teams

GET /api/teams/

➀ Create Team

POST /api/teams/

➀ Team Members

GET /api/teams/{id}/members/


πŸ“‘ SSE Event Stream

➀ Live Stream

GET /api/events/stream/

Returns: - latest reports\

  • latest insights
    as text/event-stream.

πŸ“˜ LOGGING (internal middleware)

All API calls generate an ApiRequestLog entry locally.


πŸš€ Why I Built This (The Real Reason)

Most of my engineering work happens inside private, enterprise‑grade repositories
β€” where I build:

  • structured clean architectures
  • high‑scale backends
  • domain‑driven systems
  • async microservices
  • data pipelines
  • CI/CD workflows

…but none of that can be shown publicly.
So I created DevFocus to expose the quality, architecture, principles, and engineering depth
I actually use daily.

This project is not a toy it is a public representation of how I design real systems.


🐺 Author’s Note

πŸ–€ I build systems that keep developers sharp, teams aligned, and architectures clean.
DevFocus is just a glimpse - the real power lives in private repos.

-- Soroosh Morshedi (https://sorooshmorshedi.ir)

πŸ”₯πŸš¬πŸ’»πŸ–€


 β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   β–ˆβ–ˆ   β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    β–ˆβ–ˆ   β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆ   β–ˆβ–ˆ
β–ˆβ–ˆ        β–ˆβ–ˆ β–ˆβ–ˆ   β–ˆβ–ˆ  β–ˆβ–ˆ   β–ˆβ–ˆ       β–ˆβ–ˆ  β–ˆβ–ˆ   β–ˆβ–ˆβ–ˆ  β–ˆβ–ˆ    β–ˆβ–ˆβ–ˆ      β–ˆβ–ˆβ–ˆ    β–ˆβ–ˆ   β–ˆβ–ˆ
β–ˆβ–ˆ         β–ˆβ–ˆβ–ˆ    β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    β–ˆβ–ˆ β–ˆ β–ˆβ–ˆ    β–ˆβ–ˆβ–ˆ      β–ˆβ–ˆβ–ˆ    β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
β–ˆβ–ˆ          β–ˆ     β–ˆβ–ˆ  β–ˆβ–ˆ   β–ˆβ–ˆ       β–ˆβ–ˆ β–ˆβ–ˆ    β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆ    β–ˆβ–ˆβ–ˆ      β–ˆβ–ˆβ–ˆ    β–ˆβ–ˆ   β–ˆβ–ˆ
β–ˆβ–ˆ          β–ˆ     β–ˆβ–ˆ  β–ˆβ–ˆ   β–ˆβ–ˆ       β–ˆβ–ˆ  β–ˆβ–ˆ   β–ˆβ–ˆ   β–ˆβ–ˆ    β–ˆβ–ˆβ–ˆ      β–ˆβ–ˆβ–ˆ    β–ˆβ–ˆ   β–ˆβ–ˆ
 β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ      β–ˆ     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   β–ˆβ–ˆ   β–ˆβ–ˆ  β–ˆβ–ˆ   β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    β–ˆβ–ˆβ–ˆ    β–ˆβ–ˆ   β–ˆβ–ˆ

                    C Y B E R N I T H
                 
> ⚑ Crafted & unleashed by Soroosh morshedi ~ ( Cybernith ) ~
>  🌐  https://sorooshmorshedi.ir
> ❀️ Built with passion 

About

Developer Context Intelligence Engine - clean Django architecture with session tracking, context-switch analytics, team RBAC, async GitHub integration, background reporting (Celery), insights, SSE streaming, advanced filtering/export, and full test coverage πŸ”— https://sorooshmorshedi.ir

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages