Backend2025

EQi30Emotional Intelligence Guided Journey API

A Django REST backend for a personalized emotional intelligence learning platform where users complete a 30-day guided journey prioritized by AI assessment, with transactional registration, OTP-based security, deterministic daily scheduling, and progress tracking.

Primary technologies

  • Python
  • Django
  • Django REST Framework
  • SimpleJWT
  • drf-spectacular
  • PostgreSQL
  • SQLite
EQi30 emotional intelligence guided journey API documentation

What this project is

EQi30 is a Django REST backend powering a personalized emotional intelligence learning platform where users engage in a structured 30-day guided journey organized across six competencies and 30 abilities, with AI-driven assessment and personalized prioritization.

Engineering problem

The platform needed to coordinate anonymous onboarding with AI assessment, transactional user registration with linked onboarding data, deterministic daily content scheduling across variable growth paces, secure session lifecycle management, and role-based content administration—all while maintaining strict user-owned data isolation and preventing orphaned temporary data.

Success criteria

Provide a production-ready REST API supporting unauthenticated onboarding flows, atomic user registration, AI-personalized journey routing, deterministic daily content delivery, progress tracking with badges, and secure administrative operations.

The implementation uses domain-oriented Django applications with transactional workflows for registration, OTP-based security for email verification and password recovery, deterministic algorithms for daily scheduling, queryset-enforced ownership boundaries, and OpenAPI documentation with Swagger and ReDoc interfaces.

What I designed, built, and shipped

The areas I owned end to end as Backend Engineer.

  1. Designed domain-oriented REST APIs for registration, onboarding, journey delivery, learning sessions, progress tracking, and content management across 12 focused Django applications

  2. Implemented atomic registration workflows with transactional session claiming, automatic profile creation, and email OTP verification in a single database transaction

  3. Built deterministic daily scheduling algorithm that adapts session distribution and content progression across variable growth paces (1–3 sessions per day over 30 days)

  4. Developed secure OTP-based authentication flows for email verification and password reset with single-use codes and configurable expiration windows

  5. Engineered AI assessment storage layer that decouples backend from provider, enabling personalized journey prioritization without coupling to specific AI platform

How the system is structured

  1. Layer 01

    Domain-oriented REST API

    Twelve focused Django applications (users, profiles, abilities, journey, learning, progress, resources, notifications, subscriptions, support, feedback, legal) organize models, serializers, views, and routes by responsibility, enabling clear boundaries and maintainability.

  2. Layer 02

    Transactional registration pipeline

    User creation, UserProfile instantiation (via Django signals), and AnonymousOnboardingSession claiming occur within a single atomic database transaction, preventing orphaned sessions or incomplete account state.

  3. Layer 03

    AI assessment storage & routing

    AssessmentResult model stores competency scores and AI priorities without coupling to a specific AI provider; user journeys can reorder competencies based on AI recommendations or custom preferences while preserving immutable AI priorities.

  4. Layer 04

    Deterministic daily scheduling

    Algorithm maps 30 abilities across variable daily session counts (growth paces: 1, 2, or 3 per day) using mathematical slot-to-ability-to-content-day mapping, ensuring consistent distribution and content progression regardless of pace.

Key technical decisions

Atomic transactional registration

User creation, profile generation, and onboarding session claiming occur in a single transaction to ensure consistency and prevent orphaned temporary data or incomplete account setup.

Ownership enforced at the queryset boundary

User-scoped resources are filtered through authenticated request context at the data access layer to prevent unauthorized cross-account access and reduce reliance on client-supplied ownership identifiers.

Provider-independent AI architecture

Backend stores AI assessment results without coupling to a specific provider, enabling future provider changes and reducing deployment complexity by decoupling the API from external AI dependencies.

Single-use OTP security

Email verification and password reset use time-limited, single-use one-time passwords instead of persistent tokens, reducing exposure window and improving auditability of authentication events.

Technology stack

Backend

  • Python
  • Django
  • Django REST Framework
  • drf-spectacular

Authentication & Security

  • SimpleJWT
  • OTP Email Verification
  • Token Blacklisting
  • CORS

Data & Persistence

  • PostgreSQL
  • SQLite (Development)
  • Django ORM

API Documentation

  • OpenAPI 3.0
  • Swagger UI
  • ReDoc

What the system does

Anonymous AI-driven onboarding

Unauthenticated users create temporary sessions, submit AI assessment results (all 6 competencies with priorities), select growth plan and practice time, and have up to 10 minutes to convert session into an account.

Atomic registration with onboarding claiming

User registration transactionally attaches an anonymous onboarding session if provided, linking assessment data, preferences, and priorities to the new account in a single operation.

Personalized 30-day guided journey

Each user receives a journey ordered by AI-recommended or custom competency priorities, delivering 30 distinct abilities across configurable daily session counts (Low: 1, Medium: 2, High: 3).

Daily learning content with progression tracking

AbilityDayContent provides teaching materials, practice plans, and reflection prompts for each ability-day combination; UserDailySession tracks completion and updates progress, streaks, and badge eligibility.

Email-verified accounts with OTP security

New users receive a time-limited 6-digit email verification code; account remains inactive until verified. Password reset and resend flows use separate, single-use OTP codes.

Progress tracking and badge system

BadgeCondition model defines milestone rewards (first session, streaks, abilities completed, journeys completed); evaluate_badges service checks conditions after each session completion and awards UserBadges.

Admin-managed content and metadata

Django admin interface enables management of competencies, abilities, lessons, guided journey images, badges, subscription plans, and legal documents without modifying backend code.

Challenges & solutions

Challenge 01

Atomic registration with multi-entity orchestration

Problem

User creation, profile instantiation, and transactional onboarding session claiming must succeed or fail together without leaving orphaned sessions or incomplete accounts.

Solution

Implemented database-level transactions wrapping user creation (with UserManager.create_user), signal-triggered profile generation, and explicit session claiming within a single atomic block, with rollback on any failure.

Challenge 02

Deterministic daily scheduling across variable growth paces

Problem

Delivering consistent content progression and ability distribution when users can select 1, 2, or 3 sessions per day requires precise mathematical mapping of slots to abilities to content days.

Solution

Implemented slot-mapping algorithm that computes ability index and content day for each slot deterministically, ensuring 30-ability coverage and proper content day sequencing regardless of growth pace.

Challenge 03

Expired session lifecycle and data cleanup

Problem

Anonymous sessions and their temporary assessment data must be cleaned up after 10-minute expiration without affecting global catalog or user journeys.

Solution

Implemented opportunistic purge on new session creation and a Django management command for periodic cron-based cleanup, with cascading deletes preserving only non-temporary data.

Challenge 04

Secure onboarding-to-user binding

Problem

Prevent unauthorized session claims and ensure users cannot claim sessions belonging to other users or complete registrations without linking valid assessment data.

Solution

Session UUID is opaque and time-limited; claiming is transaction-protected and validates assessment completion; API returns clear error states for expired, claimed, or missing sessions.

What was delivered

  1. Delivered a comprehensive REST API covering 12 domain areas with 40+ endpoints supporting registration, onboarding, personalized journey delivery, daily learning, progress tracking, and administration.

  2. Established transactional workflows ensuring consistency across multi-entity operations, preventing orphaned data and incomplete account states.

  3. Implemented AI-personalized journey routing without provider coupling, enabling future AI integrations and reducing external dependencies.

  4. Created deterministic scheduling algorithm supporting multiple growth paces across a fixed 30-ability, 6-competency curriculum with correct content progression.

  5. Established secure user-scoped access controls through queryset filtering and authenticated boundary enforcement across all protected resources.

What I took away

  1. Atomic transactional workflows at the database boundary are essential for multi-entity operations; attempting consistency at the application layer is fragile and error-prone compared to database-enforced transactions.

  2. Deterministic algorithms require rigorous mathematical verification; off-by-one errors in slot-to-ability mapping or content-day calculation compound across thousands of user journeys.

  3. Decoupling from external dependencies (AI providers, payment processors) through result storage enables testing, flexibility, and deployment without requiring active provider connections.

Next step

Building something that needs this kind of backend?

I take on backend, API, and DevOps work — from data modelling and REST design through containerization and production deployment.

A project case study by Md Fahad MirBackend & DevOps Engineer, Dhaka, Bangladesh.