Skip to content
View AlexDjangoX's full-sized avatar

Block or report AlexDjangoX

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Maximum 250 characters. Please don't include any personal information such as legal names or email addresses. Markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
AlexDjangoX/README.md

πŸš€ AlexDjangoX

Full-Stack Developer | AI Solutions

Next.js 16 React 19 TypeScript 5.9 Tailwind CSS 4.1 Prisma 7 OpenAI Stripe Zuplo Lexical Editor

⚑ Quick Facts

🎯 Focus πŸ—οΈ Architecture πŸ€– AI Integration πŸ§ͺ Testing
Full-Stack Development Multi-Tenant Systems OpenAI GPT-4 100% Test Coverage
Enterprise Solutions Real-time Features Realtime API E2E Testing
Polish Language Learning Secure API Gateway Stream Chat TypeScript

πŸ’‘ About Me

I am a Full-Stack Developer specializing in enterprise AI solutions and multi-tenant applications.

🎯 My Expertise:

  • Modern Web Technologies - Next.js 16, React 19, TypeScript 5.9
  • AI Integration - OpenAI GPT-4, Realtime API, Whisper, TTS, custom prompts
  • Enterprise Architecture - Multi-tenant systems, secure APIs, payment processing
  • Polish Language Learning - Combined technical & linguistic expertise with 20+ interactive learning modules

πŸš€ Current Project: PoliLex - A sophisticated AI-powered language learning platform demonstrating enterprise-level architecture, multi-tenancy, real-time AI integration, and production-ready DevOps practices.


🎯 Current Project: PoliLex

PoliLex Platform

Polish language learning platform with sophisticated full-stack architecture


πŸ”— Resources & Links

Watch Demo


πŸ›‘οΈ Battle-Tested Payment Infrastructure

Production-grade Stripe integration built with financial software engineering standards

A payment system engineered for correctness, security, and reliabilityβ€”where money is involved, there's zero tolerance for bugs.

Architecture Overview

Component Responsibility Design Pattern
Stripe Client Singleton Centralized SDK configuration Singleton with API version pinning
Error Handling Layer Standardized error classification Custom error types with user-safe messages
Retry Logic Transient failure recovery Exponential backoff with jitter
Idempotency Service Duplicate operation prevention Deterministic key generation
Webhook Handler Asynchronous event processing Event-driven with idempotency
Token Balance Calculator Subscription credit management Pure function with state preservation

πŸ”§ Core Engineering Principles

  • Idempotency Guarantees β€” All Stripe API calls use deterministic idempotency keys (SHA-256 hashed from operation type, user ID, and relevant data) ensuring safe retries without duplicate charges
  • Webhook Idempotency β€” Dual-layer event deduplication using in-memory cache (O(1) lookup) with database persistence for cross-restart consistency
  • Fail-Open Design β€” Idempotency database checks fail-open to prevent blocking legitimate transactions during transient DB issues
  • Token Balance Preservation β€” Subscription changes preserve top-up tokens using pure calculation: newBalance = newCredits + max(0, currentBalance - oldCredits)

πŸ” Security Implementation

  • Signature Verification β€” All webhook payloads verified against HMAC signatures before processing
  • Price ID Validation β€” Two-layer validation: Zod schema format check + business logic allowlist verification
  • User Authentication β€” Server actions enforce Clerk authentication with automatic sign-in redirects
  • No Internal Secrets Exposed β€” User-facing error messages sanitized through dedicated getUserErrorMessage() function

πŸ“ˆ Retry & Error Strategy

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Retry Strategy: Exponential Backoff with Jitter            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Attempt 0: baseDelay Γ— 2⁰ = 1000ms + jitter (0-10%)        β”‚
β”‚  Attempt 1: baseDelay Γ— 2ΒΉ = 2000ms + jitter (0-10%)        β”‚
β”‚  Attempt 2: baseDelay Γ— 2Β² = 4000ms + jitter (0-10%)        β”‚
β”‚  Max Delay: Capped at configurable ceiling                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Retryable: 5xx errors, 429 rate limits, network timeouts   β”‚
β”‚  Non-Retryable: 4xx client errors (card declined, invalid)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🎯 Webhook Event Processing

Event Type Handler Action
customer.subscription.created Allocate tier credits, set plan ID, sync Clerk metadata
customer.subscription.updated Recalculate balance preserving top-ups, update tier
customer.subscription.deleted Downgrade to free tier, clear subscription fields
invoice.payment_succeeded Reset subscription credits on renewal, preserve top-ups
invoice.payment_failed Update payment failure status, manage grace period
checkout.session.completed Process one-time top-up purchases, increment balance

πŸ§ͺ Testing Philosophy

  • 100% Test Coverage β€” 177 tests covering all Stripe-related code paths
  • External API Mocking Only β€” Tests mock Stripe SDK, Prisma, and Clerk, but execute all internal business logic with real implementations
  • Financial Software Standards β€” Zero tolerance for test failures; all edge cases and error paths verified
  • Concurrent Processing Tests β€” Race condition and duplicate event handling validated

πŸ’Ž Credit System Architecture

  • Single Source of Truth β€” tokenBalance field is authoritative; no derived calculations in business logic
  • Tier-Based Allocation β€” Credits mapped from price IDs via environment-configured lookup table
  • Top-Up Preservation β€” One-time purchases survive subscription changes through stateless balance calculation
  • Transaction Audit Trail β€” All balance mutations recorded with Stripe event IDs for reconciliation

πŸ—οΈ Tech Stack Overview

Category Technology / Tools Purpose
Frontend Next.js 16, React 19 Core application shell and interactive UI
TypeScript 5.9 Type-safe client-side development
Tailwind CSS 4, ShadCN Design system, layout, and reusable UI components
Lexical Editor, Framer Motion Rich authoring experience and high-quality motion
Backend & Infrastructure Prisma 7, PostgreSQL, Supabase Type-safe data access and relational persistence
Clerk Auth, Stripe, Stream Chat, Redis Authentication, payments, real-time messaging, cache
Testing & Quality Jest, React Testing Library Unit and integration coverage for components & logic
Playwright End-to-end browser regression on critical journeys
k6, Artillery Load and performance validation for APIs and flows
TypeScript (strict), Prisma, Zod, @t3-oss/env-nextjs Static typing and schema validation across the stack
ESLint, Prettier, import-sorting plugins Automated linting, formatting, and code consistency
AI & Integrations OpenAI GPT-4, DALL-E 3 Language processing and image generation
OpenAI Realtime API, Whisper API, OpenAI TTS Real-time voice, speech-to-text, and text-to-speech
Stream Chat Real-time chat and collaboration

🌟 Key Achievements

🏒 Multi-Tenant Architecture

  • Authentication & Database Integration - Sophisticated user management with role-based access control
  • Company portals with isolated data and secure tenant boundaries
  • Multi-Organization Support - Seamless switching between different company portals
  • Permission Management - Granular access control for teachers, students, and admins
  • Data Isolation - Company-specific data segregation with secure tenant boundaries

πŸ” Enterprise Security & API Management

  • Zuplo API Gateway - Secure API management, rate limiting, and enterprise-grade security
  • Enterprise Security - Role-based access control & secure authentication
  • Performance Optimized - SSR, edge caching, optimized database queries
  • Comprehensive Testing - Unit, integration, and E2E test coverage

πŸ€– AI-Powered Features

  • GPT-4 Integration - Personalized instruction and content generation
  • OpenAI Realtime API - Voice conversations with real-time streaming responses
  • Whisper API - Audio transcription for podcasts and video content
  • Text-to-Speech (TTS) - AI-generated audio pronunciation
  • Stream Chat - Real-time messaging with AI assistance
  • Custom AI Prompts - Specialized language learning prompts and instructions

πŸ“š Comprehensive Learning Modules

Grammar Labs:

  • Aspect Master - Verb aspect practice with quizzes, challenges, and timeline visualization
  • Reflexive Lab - Reflexive verb journeys with categories and templates
  • Preposition Lab - Interactive preposition challenges with case governance
  • Motion Lab - Verbs of motion (unidirectional/multidirectional pairs)
  • Verb Prefixes - Perfective prefix forms and transformations
  • Conjugator - Interactive Kanban board for verb conjugation practice

Vocabulary & Practice:

  • Counting - Grammatical cases through counting 1-21 with contextual examples
  • Adjectives - Comparative forms and interactive exercises
  • Adverbs - Comparative and superlative forms practice
  • Nouns - Auto-generated flashcards with translations
  • Occupations - 5 interactive games (Flashcards, Quiz, Memory, Drag & Drop, Sentence Builder)
  • Word Wizard - AI-assisted vocabulary building with audio pronunciation
  • Flashcards - Customizable flashcards with example sentences
  • Cases - Grammatical case mastery through fill-in-the-blank exercises
  • Days & Months - Temporal vocabulary practice
  • Genealogy - Interactive family tree drag-and-drop game

Interactive Content:

  • Lexical Editor - Rich text editing with collaborative features
  • PDF Processing - Document processing and annotation
  • Portable Documents - PDF viewer with highlighting capabilities
  • Podcasts - Audio content with transcription
  • Videos - Video learning with interactive features
  • Audio Transcript - Speech-to-text processing

Community & Social:

  • Real-time Chat - Stream Chat integration for user communication
  • Memory Games - Polish language memory recall activities
  • Jira Integration - Project management and task tracking
  • Company Portals - Multi-tenant learning environments with blogs, videos, and PDFs

πŸ’° OpenAI Pricing Strategy

Source of Truth:

  • Database-Driven Pricing - Centralized database table serves as the single source of truth for all OpenAI model costs
  • Manual Admin Management - Pricing is manually updated by administrators through a secure admin interface (no automated scraping or external API dependencies)
  • Performance Optimization - Server-side pricing cached with configurable TTL for optimal performance, with immediate cache invalidation after updates
  • Resilience - Fallback pricing values available if database is temporarily unavailable (with appropriate logging and warnings)

Security Practices:

  • Defense in Depth - Multi-layer security approach combining application-level authorization checks with database-level access controls
  • Row-Level Security - Database policies enforce role-based access control, ensuring only authorized administrators can modify pricing data
  • Read Access - Authenticated users can read active pricing information required for cost calculations
  • Write Access - Strictly limited to authorized administrators through verified authentication mechanisms
  • Secure Initialization - Seed scripts use secure service-level connections for initial data population
  • Token-Based Authorization - Admin privileges verified through secure token claims validated at both application and database layers

✍️ Custom Lexical Editor with Media Integration

  • Rich Text Editing - Full-featured Lexical editor with markdown support, tables, lists, and formatting
  • YouTube Integration - Embed YouTube videos directly in editor content with resizable player controls
  • Audio/Podcast Integration - Seamless audio embedding with Supabase storage integration
    • Audio playback controls with custom player interface
    • Podcast image support with signed URL generation
    • Audio transcription workflow integration
  • Video Content Creation - Link videos to editor content for bilingual text generation
  • Speech-to-Text - Built-in speech recognition plugin for voice input
  • Auto-Embed Plugin - Automatic detection and embedding of YouTube URLs
  • Collaborative Features - Real-time editing capabilities with history tracking
  • Export Capabilities - Export editor content to blog posts and learning materials

πŸ‘¨β€πŸ« Teacher/Tutor Portal (Company System)

  • Dedicated Company Portals - Isolated multi-tenant environments for each teaching organization
  • Blog Management System - Full-featured blog with Lexical editor integration
    • Rich text blog posts with embedded media
    • Tag-based categorization and filtering
    • Comments and reactions system
    • Nested comment threads with real-time updates
    • Author profiles and post attribution
    • Draft and published post status management
  • Video Library Management - Comprehensive video content system
    • YouTube video integration with metadata
    • Difficulty level categorization (A1-C2)
    • Category organization (Grammar, Vocabulary, Pronunciation, etc.)
    • Bilingual text support (Polish/English)
    • Video transcription and summaries
    • Thumbnail and duration tracking
    • Publishing workflow
  • Resource Management - Centralized content hub
    • PDF document management
    • Resource organization by company
    • Access control and permissions
  • Dashboard Analytics - Company-specific insights and user management
  • Multi-User Support - Role-based access for teachers, admins, and students
  • Tenant Isolation - Secure data segregation between different companies

πŸ§ͺ Testing & Quality

PoliLex is validated with a full testing pipeline that combines automated tests, static analysis, and load testing.
Every change is validated through:

  • Automated unit and integration suites using Jest and React Testing Library for components and business logic
  • End-to-end regression tests with Playwright for critical user journeys in the browser
  • Load and performance exercises with k6 and Artillery focused on core APIs, server-side operations, and caching behavior
  • Strict static typing and schema validation with TypeScript (strict mode), Prisma, Zod, and @t3-oss/env-nextjs for data, inputs, and configuration
  • Automated linting and formatting with ESLint, Prettier, and import-sorting to enforce consistent, production-grade code quality

πŸŽ“ Background

Education Training Specialization
Boolean UK Graduate
Full-stack development fundamentals
JS Mastery Graduate
(Feb 2024) - Advanced React & Next.js Masterclass
Polish Language Enthusiast
Combined technical expertise with language learning

πŸ’‘ Always learning, always building. Currently exploring advanced AI integration and enterprise-scale applications.

Pinned Loading

  1. hipnode-2024 hipnode-2024 Public

    TypeScript

  2. morrent-car-hire morrent-car-hire Public

    TypeScript

  3. movie-lovers-app movie-lovers-app Public

    JavaScript

  4. portfolio-alexander portfolio-alexander Public

    TypeScript

  5. portfolio-alexander-mclachlan portfolio-alexander-mclachlan Public

    JavaScript