Skip to content

Latest commit

 

History

History
219 lines (171 loc) · 5.98 KB

File metadata and controls

219 lines (171 loc) · 5.98 KB

URL Routing Guide

BrainFuel now supports direct URL routing, allowing you to link directly to specific topics, exams, or puzzles.

Supported URL Parameters

1. Direct Topic Access

Load a specific learning topic directly:

https://your-site.com/?topic=TOPIC_ID

Examples:

  • ?topic=hash-tables - Opens the Hash Tables topic
  • ?topic=design-patterns - Opens the Design Patterns topic
  • ?topic=arrays - Opens the Arrays topic
  • ?topic=binary-heap - Opens the Binary Heap topic

2. Direct Exam Access

Start a specific exam directly:

https://your-site.com/?exam=EXAM_ID

Examples:

  • ?exam=data-structures-exam - Starts the Data Structures exam
  • ?exam=algorithms-exam - Starts the Algorithms exam
  • ?exam=operating-systems-exam - Starts the OS exam

3. Direct Puzzle/Teaser Access

Start a specific puzzle or brain teaser:

https://your-site.com/?puzzle=PUZZLE_ID

Examples:

  • ?puzzle=logic-puzzles - Starts the Logic Puzzles set
  • ?puzzle=riddles - Starts the Riddles set

4. Tab Selection

Switch to a specific tab on load:

https://your-site.com/?tab=TAB_NAME

Valid tab names:

  • ?tab=exams - Shows the Practice Exams tab
  • ?tab=topics - Shows the Learn Topics tab
  • ?tab=puzzles - Shows the Brain Teasers tab

Finding Topic/Exam IDs

For Topics:

The topic ID is the filename without the .json extension. Check topics/topics.json for the id or filename field:

{
  "id": "hash-tables",
  "title": "Hash Tables",
  "filename": "hash-tables.json"
}

Use: ?topic=hash-tables

For Exams:

Check exams/exams.json for the id or filename field:

{
  "id": "data-structures-exam",
  "title": "Data Structures",
  "filename": "data-structures-exam.json"
}

Use: ?exam=data-structures-exam

For Puzzles:

Check puzzles/puzzles.json for the id or filename field:

{
  "id": "logic-puzzles",
  "title": "Logic Puzzles",
  "filename": "logic-puzzles.json"
}

Use: ?puzzle=logic-puzzles

Use Cases

1. Sharing Specific Topics

Share a direct link to a specific topic with students or colleagues:

https://brainfuel.com/?topic=design-patterns

2. Email Campaigns

Send targeted learning materials:

Subject: Learn Hash Tables Today!
Link: https://brainfuel.com/?topic=hash-tables

3. Study Schedules

Create a curriculum with direct links:

4. Quick Testing

Bookmark direct exam links for quick access:

https://brainfuel.com/?exam=data-structures-exam

5. Social Media Sharing

Share specific content on social media with descriptive URLs:

Check out this Design Patterns guide!
https://brainfuel.com/?topic=design-patterns

URL Behavior

  • URL Updates: When users navigate within the app, the URL automatically updates to reflect the current content
  • Browser Back/Forward: Users can use browser navigation buttons (back/forward)
  • Bookmarking: Users can bookmark specific topics/exams/puzzles
  • Sharing: URLs can be copied and shared directly
  • Invalid IDs: If an invalid ID is provided, the app shows an error and falls back to the main selection screen

Automatic URL Updates on User Actions:

  1. Tab Switching: Clicking on "Practice Exams", "Learn Topics", or "Brain Teasers" tabs updates the URL:

    • Click "Practice Exams" → URL becomes ?tab=exams
    • Click "Learn Topics" → URL becomes ?tab=topics
    • Click "Brain Teasers" → URL becomes ?tab=puzzles
  2. Topic Selection: Clicking on any topic card updates the URL:

    • Click "Hash Tables" → URL becomes ?topic=hash-tables
    • Click "Design Patterns" → URL becomes ?topic=design-patterns
  3. Exam Selection: Clicking on any exam updates the URL:

    • Click "Data Structures Exam" → URL becomes ?exam=data-structures-exam
  4. Puzzle Selection: Clicking on any puzzle set updates the URL:

    • Click "Logic Puzzles" → URL becomes ?puzzle=logic-puzzles
  5. Back Navigation: Clicking "Back" buttons or logo clears URL parameters:

    • URL returns to base: https://your-site.com/

This means every navigation action updates the URL, making it easy to:

  • Share the exact page you're viewing
  • Bookmark your current position
  • Use browser back/forward buttons naturally
  • Copy URLs from the address bar at any time

Technical Implementation

The URL routing system:

  1. Reads URL parameters on page load
  2. Fetches the appropriate manifest file (topics.json, exams.json, or puzzles.json)
  3. Finds the matching item by ID or filename
  4. Automatically navigates to that content
  5. Updates the URL when users navigate within the app
  6. Clears URL parameters when returning to the home screen

Examples of All Available Topics (as of now)

Data Structures Topics:

  • ?topic=arrays
  • ?topic=linked-lists
  • ?topic=stacks
  • ?topic=queues
  • ?topic=hash-tables
  • ?topic=binary-heap
  • ?topic=quadtree
  • ?topic=octree
  • ?topic=a-star-algorithm
  • ?topic=object-pool
  • ?topic=variable-size-allocator
  • ?topic=fixed-size-allocator
  • ?topic=dynamic-hash-table

Operating Systems Topics:

  • ?topic=process-table
  • ?topic=context-switch
  • ?topic=virtual-memory
  • ?topic=deadlocks
  • ?topic=synchronization
  • ?topic=cpu-scheduling
  • ?topic=file-system

Software Engineering Topics:

  • ?topic=design-patterns
  • ?topic=solid-principles
  • ?topic=software-architectures

C++ Programming Topics:

  • ?topic=cpp-fundamentals
  • ?topic=cpp-oop
  • ?topic=cpp-inheritance
  • ?topic=cpp-type-conversions
  • ?topic=cpp-templates
  • ?topic=cpp-exceptions
  • ?topic=cpp-resource-management
  • ?topic=cpp-smart-pointers
  • ?topic=cpp-stl
  • ?topic=cpp-under-the-hood

Note: Make sure your manifest files (topics.json, exams.json, puzzles.json) include the id field for each item to enable URL routing.