Beyond a Website.
An Engineered Product.
Studyly is a complete exam preparation platform independently engineered by DollyQx, covering system architecture, full-stack development, database design, secure payment integration, access control, automated testing, and production deployment.
Platform Scope & Functional Specifications
Studyly.online is specifically tailored for state-level competitive examinations (such as Bihar Library Eligibility Test - LET and Bihar Librarian). Rather than being a static content portal, it manages the full lifecycle of student assessment, gated resource distribution, payment operations, and teacher content ingestion.
Interactive CBT Exam Engine
Timed examination sessions with automated submission, question palette navigation, responsive mark-for-review, and instant score computation against negative marking rules.
Protected PDF Delivery
Subject-wise and topic-wise lecture notes delivered via protected server-side streaming headers (`streamMaterial`), preventing unauthorized URL extraction and direct public indexing.
Membership State Engine
Server-enforced 30-day membership model (₹49). Features stacking expiration logic on renewals, automatic guest-fallback, and transactional membership records.
Razorpay Payment Pipeline
Two-phase verification: server-side order generation via authenticated Razorpay Orders API followed by cryptographic HMAC-SHA256 signature verification with timing-attack defense.
Bilingual Content Parser
Custom `QuizTextParser` service featuring multi-pass regex tokenization that understands Devanagari numerals, varied option prefixes (क/ख/ग/घ vs A/B/C/D), and mixed scripts.
Deterministic Help Chatbot
Zero-cost rule-based student support engine matching Hindi & English questions with keyword scoring, automated XSS sanitization, and sensitive OTP warning triggers.
System Architecture & Data Flow
Studyly is built as a high-performance modular monolith in Laravel 12. By consolidating business logic into disciplined domain controllers and dedicated services (`QuizTextParser`, `ChatbotService`), the application avoids network serialization overhead while maintaining clean separation of concerns.
Data Flow Lifecycle:
- Inbound Request: The browser transmits an HTTP request to Nginx/LiteSpeed, which routes through Laravel's `public/index.php`.
- Security Filtering: Route middleware enforces rate limits (`throttle`), validates session tokens, and filters authorization roles (`admin`, `student`).
- Domain Handling: The targeted controller invokes specialized services (e.g., calling `MembershipController` to issue authenticated orders or `StudentController` to strip answer keys).
- Transactional Persistence: Data modifications execute inside atomic database transactions (`DB::transaction`) to prevent partial record creation during imports or payments.
- Sanitized Delivery: The response is rendered via server-side Blade templates or returned as sanitized JSON with HTTP status codes adhering to REST principles.
Payment Engineering & Razorpay Verification
Payment handling in online education platforms is susceptible to client-side price tampering, replay attacks, and man-in-the-middle forging. In Studyly, payment state transitions are strictly server-authoritative, employing constant-time cryptographic verification and idempotency locks.
1. Server-Authoritative Price Handling
The frontend never sends a price parameter to the server. The order creation endpoint reads the constant `MembershipController::MEMBERSHIP_PRICE = 49.00` and calculates 4900 paise server-side.
public const MEMBERSHIP_PRICE = 49.00;
$price = self::MEMBERSHIP_PRICE;
$amountInPaise = (int) round($price * 100); // 4900 paise
$response = Http::withBasicAuth($key, $secret)
->post('https://api.razorpay.com/v1/orders', [
'amount' => $amountInPaise,
'currency' => 'INR',
'receipt' => $orderNumber,
]);
2. Cryptographic Signature Verification
Payment verification recomputes the HMAC-SHA256 signature using the secret key and compares it against Razorpay's signature using `hash_equals()` to prevent timing attacks.
'sha256',
$request->razorpay_order_id . '|' . $request->razorpay_payment_id,
$secret
);
// Constant-time comparison defends against timing side-channel attacks
if (!hash_equals($generatedSignature, $request->razorpay_signature)) {
$order->update(['status' => 'failed']);
return response()->json(['error' => 'Invalid payment signature'], 400);
}
3. Threat Mitigation Matrix
| Threat Vector | Exploit Target | Implemented Defense | Test Verification |
|---|---|---|---|
| Price Tampering | Client sends ₹1 instead of ₹49 | Price is locked server-side; client amount parameter is completely ignored | Passed |
| Signature Forgery | Synthetic confirmation callback | HMAC-SHA256 signature calculated with server secret via `hash_equals()` | Passed |
| Order Hijacking | Student B attempts to verify Student A's order | Order query filtered by authenticated `user_id`; returns 404 on mismatch | Passed |
| Replay Attacks | Multiple POSTs for a single payment | Idempotency gate: if `$order->status === 'paid'`, subsequent calls fail with 400 | Passed |
| Gateway Timeout | Razorpay network latency | HTTP client timeout configured with try/catch; returns 502 with friendly retry notice | Passed |
Expiration Stacking Logic
When an active member renews before expiration, their remaining days are preserved. Instead of overwriting from `now()`, the renewal extends from their existing `expires_at` date:
$expiresAt = $existingActive->expires_at->copy()->addDays(30);
Database Schema & Entity Relationship Design
The database is structured to balance strict 3NF normalization with rapid read performance for high-concurrency exam runs. Crucial user lookups are indexed (such as 10-digit Indian mobile numbers and active membership intervals).
- PK id: bigint (auto)
- name: varchar(255)
- email: varchar(255) (nullable)
- phone: varchar(20) (indexed)
- password: varchar(255) (bcrypt)
- role: enum('student', 'admin')
- status: varchar(50)
- PK id: bigint (auto)
- order_number: varchar(64) (unique)
- FK user_id: bigint -> users.id
- amount: decimal(8,2) [49.00]
- currency: varchar(10) ['INR']
- razorpay_order_id: varchar(100)
- razorpay_payment_id: varchar(100)
- status: enum('created', 'paid', 'failed')
- PK id: bigint (auto)
- FK user_id: bigint -> users.id
- plan_name: varchar(100)
- price: decimal(8,2)
- status: enum('active', 'expired')
- starts_at: timestamp
- expires_at: timestamp (indexed)
- PK id: bigint (auto)
- FK subject_id: bigint -> subjects.id
- FK topic_id: bigint -> topics.id
- title: varchar(255)
- slug: varchar(255) (unique)
- access_type: enum('free', 'membership')
- duration_minutes: int
- pass_percentage: decimal(5,2)
- is_active: boolean
- PK id: bigint (auto)
- FK quiz_id: bigint -> quizzes.id
- question_text: text
- explanation: text
- marks: decimal(4,2)
- order: int
- Options: 1-to-Many
- FK question_id, option_text, is_correct
- PK id: bigint (auto)
- FK user_id: bigint (nullable for guests)
- FK quiz_id: bigint -> quizzes.id
- score: decimal(6,2)
- total_questions: int
- correct_answers: int
- time_taken_seconds: int
- completed_at: timestamp
Key Structural Optimization: Nullable Email Migration
In migration 2026_10_12_000001_make_email_nullable_and_add_phone_index_to_users_table, `users.email` was made nullable while creating a dedicated B-tree index on `users.phone`. This allows students across rural India who register via WhatsApp/mobile to create accounts without artificial placeholder emails, while maintaining zero regression for existing email users.
Testing & Quality Engineering Verification
To guarantee zero financial regressions and prevent unauthorized content leakage, Studyly utilizes an automated test suite executed via PHPUnit. Every payment flow, bilingual parsing scenario, and authorization gate is validated by automated regression suites.
PASS Tests\Feature\TextQuizImportTest (20 tests)
PASS Tests\Feature\EmailOrMobileAuthTest (16 tests)
PASS Tests\Feature\StudentHelpChatbotTest (18 tests)
PASS Tests\Feature\BulkPdfImportTest (14 tests)
PASS Tests\Feature\BulkQuizImportTest (11 tests)
PASS Tests\Feature\EngineeringShowcaseTest (11 tests)
PASS Tests\Feature\MembershipAwareHomepageTest (5 tests)
PASS Tests\Feature\AdSenseReadinessAndContentAuditTest (20 tests)
PASS Tests\Feature\PublicFirstAccessTest (4 tests)
PASS Tests\Feature\AdminContentManagementTest (10 tests)
PASS Tests\Feature\AuthenticationFlowTest (5 tests)
PASS Tests\Unit\ExampleTest (2 tests)
========================================
Tests: 150 passed (953 assertions)
Duration: 3.41s
Status: 100% Green (Zero Failures)
========================================
| Test Suite | Count | Critical Business Rules Covered |
|---|---|---|
| MembershipSystemTest | 14 tests | Order generation, price-tampering rejection, HMAC signature checks, renewal stacking, expired reset, order ownership verification. |
| TextQuizImportTest | 20 tests | Hindi Devanagari parsing, mixed script handling, 4 option patterns, size limits (1MB), question limits (500), atomic rollback on error. |
| EmailOrMobileAuthTest | 16 tests | Indian mobile formats (+91, 0, whitespace), nullable email registration, rate-limiting lockout after 5 failed attempts, password security. |
| StudentHelpChatbotTest | 18 tests | Keyword confidence scoring, Hindi/English multi-token matching, XSS escaping, OTP/password sensitive credential alerts. |
| BulkPdfImportTest | 14 tests | File validation, orphan upload cleanup on transactional rollback, access gate enforcement on imported PDFs. |
| PublicFirstAccessTest | 4 tests | Guest access to free quizzes, syllabus pages, and anonymous scoring results without forced login barrier. |
Production Engineering Journal: Real Challenges & Fixes
True engineering work is reflected in how difficult production edge cases are diagnosed and resolved. Here are 5 verified production challenges encountered and resolved during development:
#01 Shared Hosting Document Root & Missing ads.txt Routing
#02 Answer Key Exposure in Client-Side CBT Palettes
#03 Indian Mobile Authentication with Legacy Data Compatibility
#04 Bilingual (Hindi & English) Raw Text Quiz Parsing Engine
#05 Google Search Console Soft-404 / 302 Redirect Errors in Sitemap
Technical Evidence Library
Razorpay Payment Signature & Timing-Safe Verification
Sanitized implementation from `app/Http/Controllers/Student/MembershipController.php`:
// 1. Retrieve server-configured webhook & payment secret
$secret = config('services.razorpay.secret');
// 2. Compute HMAC-SHA256 signature using order_id and payment_id
$generatedSignature = hash_hmac(
'sha256',
$request->razorpay_order_id . '|' . $request->razorpay_payment_id,
$secret
);
// 3. Constant-time comparison defends against timing attacks
if (!hash_equals($generatedSignature, $request->razorpay_signature)) {
$order->update(['status' => 'failed']);
return response()->json(['error' => 'Payment verification failed'], 400);
}
// 4. Atomic status transition & Idempotency guard
$order->update([
'status' => 'paid',
'razorpay_payment_id' => $request->razorpay_payment_id,
'razorpay_signature' => $request->razorpay_signature,
]);
Devanagari & English Quiz Text Normalization
Sanitized implementation from `app/Services/QuizTextParser.php`:
// Clean Unicode zero-width artifacts (common in copy-pasted text)
$text = str_replace(["\r\n", "\r"], "\n", $rawText);
$text = preg_replace('/[\x{200B}-\x{200D}\x{FEFF}]/u', '', $text);
// Detect question headers supporting both English and Devanagari numerals
// e.g. "Q.1", "Question 1:", "प्रश्न 1", "प्र. १."
$headerPattern = '/^(?:(?:प्रश्न|प्र|Q|Question)\s*[\.:-]?\s*)?([0-9\x{0966}-\x{096F}]+)\s*[\.:\)-]\s*(.*)$/ui';
// Map Devanagari Hindi option prefixes to standard keys
$hindiOptionMap = [
'क' => 'A', 'ख' => 'B', 'ग' => 'C', 'घ' => 'D',
'A' => 'A', 'B' => 'B', 'C' => 'C', 'D' => 'D',
];
Indian Mobile Number Format Normalization
Sanitized implementation from `app/Models/User.php`:
public static function normalizePhone(?string $phone): ?string
{
if ($phone === null) return null;
$digits = preg_replace('/\D+/', '', $phone);
// 12-digit Indian mobile starting with 91 (e.g. +91 98765 43210 -> 9876543210)
if (strlen($digits) === 12 && str_starts_with($digits, '91')) {
$candidate = substr($digits, 2);
if (preg_match('/^[6-9]\d{9}$/', $candidate)) return $candidate;
}
// 11-digit mobile starting with 0 (e.g. 09876543210 -> 9876543210)
if (strlen($digits) === 11 && str_starts_with($digits, '0')) {
$candidate = substr($digits, 1);
if (preg_match('/^[6-9]\d{9}$/', $candidate)) return $candidate;
}
// Standard 10-digit mobile
if (preg_match('/^[6-9]\d{9}$/', $digits)) return $digits;
return null;
}
Payment Handshake Sequence
| | |
|-- POST /membership/order -> | |
| |-- POST /v1/orders (₹49) -> |
| |<-- order_xxxxxx ID --------|
|<-- JSON {order_id, key} ---| |
| | |
|-- (Student pays on modal) -| |
| | |
|-- POST /membership/verify ->
| {payment_id, signature} -> [Verify hash_equals(HMAC)]
| |-> [Extend Membership +30 Days]
|<-- HTTP 200 {success: true}|
Hostinger Production Deployment Verification Checklist
- ✓ `php artisan config:cache` & `route:cache` active on deployment.
- ✓ `APP_DEBUG=false` enforced; error stack traces suppressed from client browsers.
- ✓ SSL / TLS certificate issued and forced across all HTTP endpoints.
- ✓ Physical `ads.txt` present in root web directory returning HTTP 200 plain text.
- ✓ Storage symlink verified (`php artisan storage:link`) with directory permissions 755/644.
Technical Decision Records (TDRs)
Server-Authoritative Pricing
Decision: Client order creation requests contain zero price fields. The server asserts ₹49.00.
Trade-off: Loses frontend flexibility for client-side discount calculations without an explicit promo-code server endpoint, but eliminates client price manipulation.
Answer Key Exclusion on Test Delivery
Decision: Options query projection strips `is_correct` at the SQL level.
Trade-off: Requires a full network round-trip for test scoring rather than instant offline client evaluation, but guarantees zero inspect-element cheating.
Deterministic FAQ Engine over Generative LLMs
Decision: Implemented keyword confidence scoring instead of third-party LLM API calls.
Trade-off: Less conversational variety, but zero operational cost, zero hallucination risk on examination rules, sub-millisecond response latency, and immune to API outages.
Modular Monolith vs Distributed Microservices
Decision: Retained single Laravel 12 codebase with domain controllers and services.
Trade-off: Services scale together rather than independently, but avoids distributed network latency, complex saga transaction patterns, and unnecessary infrastructure overhead.
Engineering Attribution & Responsibilities
Independently Engineered by DollyQx
Independent Software Engineer & System Architect
Independently responsible for Studyly's system architecture, full-stack implementation, database design, secure payment integration, access control, testing, and production deployment.
DollyQx independently executed the end-to-end technical development of Studyly, translating educational specifications into a production-grade modular monolith with zero-trust payment verification, anti-cheating exam engines, and automated test regression pipelines. DollyQx is the developer and system architect, not the business founder.
System Limitations & Engineering Roadmap
Engineering integrity requires acknowledging current architectural constraints alongside future improvements:
Current Technical Limitations
- Synchronous Notifications: Student transactional receipts and doubt replies run synchronously on web worker threads rather than an asynchronous queue worker.
- Single-Node Storage: PDF materials are stored on the server's local filesystem rather than a distributed object storage provider like AWS S3 or Cloudflare R2.
- Database Search: Question searches use SQL `LIKE` queries rather than inverted full-text indexes.
- No Automated PDF Watermarking: Study PDFs are delivered in their original uploaded form without dynamic student phone watermark overlays.
Planned Future Improvements
- Planned Redis Queue Infrastructure: Introducing Redis queue workers to decouple SMS/email notification dispatch from HTTP request cycles.
- Planned Dynamic PDF Watermarking: Injecting authenticated student mobile number and timestamp overlays into streamed PDF pages to deter unauthorized leaks.
- Planned Meilisearch Question Engine: Integrating Meilisearch for typo-tolerant, sub-10ms search across 5,000+ past exam questions.
- Planned Distributed Load Simulation: Conducting 10,000 concurrent user load testing (k6/JMeter) ahead of state exam announcements.