Dev Library Β· Reference Collection

The Dev Reference Library



Last update: 2026-01-15

Everything

What actually happens on the wire β€” layers, protocols, tools, and infrastructure a developer needs to understand

πŸ”—πŸ§  Mastermind Software Engineer Guide (Personal Edition)

πŸš€ My Tech Stack
  • Backend: Python (Django, FastAPI,tooling:ruff,uv), Rust (actix-web, axum)
  • Frontend: Svelte / SvelteKit
  • Tools: Linux, Git, Docker
  • Patterns & Principles: SOLID, DRY, YAGNI, KISS, naming, architecture, extendibility

πŸ”—πŸŸ’ Foundational Knowledge (Must Always Keep Warm)

βœ… Data Structures & Algorithms (DSA)
  • Arrays, Linked Lists, Trees, Graphs
  • Sorting, Searching
  • Hash Maps, Sets
  • Recursion, Dynamic Programming (DP)
  • Time & Space Complexity (Big O)

Tip: Revise once per year β€” but don’t overstress memorization. Deep pattern recognition is more important.

βœ… Core Principles
  • SOLID (OOP principles)
  • DRY (Don’t Repeat Yourself)
  • KISS (Keep It Simple, Stupid)
  • YAGNI (You Ain’t Gonna Need It)



πŸ”—πŸŸ  LeetCode Patterns for DSA

Mastering these patterns helps you solve most coding interview problems efficiently:
  • Sliding Window
    For subarrays/substrings with optimal time (e.g., max sum, longest substring).

    • Example: Maximum Subarray, Longest Substring Without Repeating Characters
  • Two Pointers
    For problems on sorted arrays/linked lists (e.g., pair sum, reverse).

    • Example: Two Sum II, Remove Duplicates from Sorted Array
  • Fast & Slow Pointers (Cycle Detection)
    Detect cycles or find middle in linked lists.

    • Example: Linked List Cycle, Find Middle of Linked List
  • Merge Intervals
    For interval overlap/merge problems.

    • Example: Merge Intervals, Insert Interval
  • Binary Search
    For sorted arrays/search space reduction.

    • Example: Search in Rotated Sorted Array, Find Minimum in Rotated Sorted Array
  • Backtracking
    For permutations, combinations, and subsets.

    • Example: Subsets, Permutations, Combination Sum
  • Breadth-First Search (BFS)
    For shortest path in unweighted graphs/trees.

    • Example: Binary Tree Level Order Traversal, Word Ladder
  • Depth-First Search (DFS)
    For traversals, connected components, and recursion.

    • Example: Number of Islands, Clone Graph
  • Dynamic Programming (DP)
    For optimal substructure/overlapping subproblems.

    • Example: Climbing Stairs, House Robber, Longest Increasing Subsequence
  • Greedy
    For local optimal β†’ global optimal.

    • Example: Jump Game, Gas Station
  • Heap/Priority Queue
    For top K elements, merging sorted lists.

    • Example: Kth Largest Element, Merge K Sorted Lists
  • Trie
    For prefix-based search.

    • Example: Implement Trie, Word Search II

Tip:
Focus on understanding the pattern, not just the solution.
LeetCode Patterns Reference




πŸ”—πŸ“ Software Design & Architectural Patterns

πŸ“„ Overview

Design and architectural patterns are tried-and-true solutions to common software development problems. They help write clean, maintainable, and scalable code.

🧱 1. Design Patterns
πŸ”¨ 1.1 Creational Patterns
  • Singleton
    Ensure a class has only one instance and provide a global point of access.

    classDiagram
    class Singleton {
      -instance: Singleton
      +getInstance(): Singleton
    }
  • Factory Method
    Define an interface for creating an object, but let subclasses decide which class to instantiate.

    classDiagram
    class Product
    class ConcreteProduct
    class Creator {
      +factoryMethod(): Product
    }
    class ConcreteCreator {
      +factoryMethod(): Product
    }
    Creator <|-- ConcreteCreator
    Product <|-- ConcreteProduct
  • Builder
    Separate the construction of a complex object from its representation.

    classDiagram
    class Director
    class Builder {
      +setPart()
      +getResult()
    }
    Director --> Builder
  • Prototype
    Create new objects by copying an existing object (clone).

    classDiagram
    class Prototype {
      +clone(): Prototype
    }
    class ConcretePrototype
    Prototype <|-- ConcretePrototype
🧩 1.2 Structural Patterns
  • Adapter
    Allow incompatible interfaces to work together.

    classDiagram
    class Target
    class Adaptee
    class Adapter
    Target <|.. Adapter
    Adapter --> Adaptee
  • Bridge
    Separate abstraction from implementation so they can vary independently.

    classDiagram
    class Abstraction
    class Implementor
    class RefinedAbstraction
    Abstraction <|-- RefinedAbstraction
    RefinedAbstraction --> Implementor
  • Composite
    Treat individual objects and compositions uniformly.

    classDiagram
    class Component
    class Leaf
    class Composite {
      +add()
    }
    Component <|-- Leaf
    Component <|-- Composite
    Composite --> Component
  • Decorator
    Add responsibilities to objects dynamically.

    classDiagram
    class Component
    class ConcreteComponent
    class Decorator
    class ConcreteDecorator
    Component <|-- ConcreteComponent
    Component <|-- Decorator
    Decorator <|-- ConcreteDecorator
    Decorator --> Component
  • Facade
    Provide a simplified interface to a complex subsystem.

    classDiagram
    class Facade
    class SubsystemA
    class SubsystemB
    Facade --> SubsystemA
    Facade --> SubsystemB
🧠 1.3 Behavioral Patterns
  • Observer
    Define a dependency between objects so that when one changes, others are notified.

    classDiagram
    class Subject {
      +attach()
      +detach()
      +notify()
    }
    class Observer {
      +update()
    }
    Subject --> Observer
  • Command
    Encapsulate a request as an object.

    classDiagram
    class Command {
      +execute()
    }
    class ConcreteCommand
    class Invoker
    class Receiver
    Command <|-- ConcreteCommand
    Invoker --> Command
    ConcreteCommand --> Receiver
  • Strategy
    Define a family of algorithms, encapsulate them, and make them interchangeable.

    classDiagram
    class Context {
      -strategy: Strategy
    }
    class Strategy {
      +execute()
    }
    class ConcreteStrategyA
    Strategy <|-- ConcreteStrategyA
    Context --> Strategy
πŸ›οΈ 2. Architectural Patterns
  • MVC (Model-View-Controller)
    Separates application logic into three interconnected components.

    graph TD
    Model --> Controller
    Controller --> View
    View --> Model
  • MVVM (Model-View-ViewModel)
    Enhances MVC with two-way binding between view and view model.

    graph TD
    Model --> ViewModel
    ViewModel --> View
    View --> ViewModel
  • Layered Architecture
    Organizes code into layers with specific responsibilities.

    graph TD
    UI --> Application
    Application --> Domain
    Domain --> Infrastructure
  • Client-Server
    Divide systems into a server (provider) and client (consumer).

    graph TD
    Client -->|Request| Server
    Server -->|Response| Client
  • Microservices
    Decompose a system into small, independently deployable services.

    graph TD
    ServiceA --> API
    ServiceB --> API
    ServiceC --> API
    API --> Client
βœ… Summary Table
CategoryPatterns
CreationalSingleton, Factory Method, Builder, Prototype
StructuralAdapter, Composite, Facade, Bridge, Decorator
BehavioralObserver, Command, Strategy
ArchitecturalMVC, MVVM, Layered, Client-Server, Microservices



πŸ”—πŸ“˜ UML Diagrams with Mermaid.js

This document showcases the most common UML diagram types using Mermaid.js. Great for visualizing systems directly in GitHub markdown!

🧱 1. Class Diagram

Description:
Class diagrams represent the structure of classes in a system, showing their attributes, methods, and relationships.

classDiagram  
    class Animal {  
        +String name  
        +int age  
        +makeSound()  
    }  

    class Dog {  
        +String breed  
        +bark()  
    }  

    class Cat {  
        +scratch()  
    }  

    Animal <|-- Dog  
    Animal <|-- Cat  
🎭 2. Use Case Diagram

Description:
Use case diagrams visualize the interactions between users (actors) and the system to achieve goals (use cases).

graph TD  
    Actor((πŸ‘€ User)) -->|Uses| System[πŸ–₯️ System]  
    System --> UC1(πŸ“Œ Use Case 1)  
    System --> UC2(πŸ“Œ Use Case 2)  
    UC1 -.-> UC2  
πŸ” 3. Sequence Diagram

Description:
Sequence diagrams show how objects or components interact in a particular sequence of time-ordered messages.

sequenceDiagram  
    participant User as πŸ‘€ User  
    participant WebApp as 🌐 WebApp  
    participant Server as πŸ–₯️ Server  

    User->>WebApp: Request Page  
    WebApp->>Server: Fetch Data  
    Server-->>WebApp: Return Data  
    WebApp-->>User: Render Page  
πŸƒ 4. Activity Diagram

Description:
Activity diagrams model the flow of control or data between activities, useful for describing workflows and logic.

flowchart TD  
    Start([πŸš€ Start]) --> A[πŸ” Login]  
    A --> B{βœ… Valid?}  
    B -- Yes --> C[πŸ“Š Show Dashboard]  
    B -- No --> D[❌ Show Error]  
    C --> End([🏁 End])  
    D --> End  
πŸ”„ 5. State Diagram

Description:
State diagrams represent the possible states of an object and transitions triggered by events or actions.

stateDiagram-v2  
    [*] --> Idle  
    Idle --> Processing : ▢️ start()  
    Processing --> Finished : βœ”οΈ complete()  
    Finished --> [*]  
🧩 6. Component Diagram

Description:
Component diagrams model the components of a system and how they interact through interfaces.

graph TB  
    Client["πŸ§‘β€πŸ’» Client"] -->|uses| API["🌐 API"]  
    API --> Controller["🧭 Controller"]  
    Controller --> Service["βš™οΈ Service"]  
    Service --> Database["(πŸ—„οΈ Database)"]  
🚚 7. Deployment Diagram

Description:
Deployment diagrams show the physical layout of hardware and how software components are deployed on them.

graph TD  
    subgraph "πŸ§‘β€πŸ’» Client Node" 
        Browser["🌍 Browser"]  
    end  

    subgraph "πŸ–₯️ Server Node"  
        WebApp["🧠 WebApp"]  
        DB["(πŸ—ƒοΈ Database)"]  
    end  

    Browser --> WebApp  
    WebApp --> DB  
🧸 8. Object Diagram

Description:
Object diagrams depict instances of classes (objects) and their relationships at a specific point in time.

classDiagram  
    class Person {  
        +String name  
        +int age  
    }  

    Person : name = "Alice"  
    Person : age = 30  



πŸ”—πŸ”₯ Next-Level Topics To Master (Architect Mindset)

1️⃣ Architectural Styles
  • Layered Architecture (Controllers β†’ Services β†’ Repos)
  • Hexagonal Architecture (Ports & Adapters, decouple domain)
  • CQRS (Command Query Responsibility Segregation)
  • Event-Driven Architecture (pub/sub systems, message queues)
2️⃣ Domain-Driven Design (DDD)
  • Entities β†’ objects with identity (e.g., User, Order)
  • Value Objects β†’ immutable, no ID (Money, Coordinates)
  • Aggregates β†’ groups of entities with a root
  • Ubiquitous Language β†’ name code after domain terms
3️⃣ Advanced State Management (Frontend)
  • Finite State Machines β†’ use XState or implement manually
  • Statecharts β†’ for complex UIs (multi-step flows)
  • Reactive Patterns β†’ data flow graphs, not just stores
4️⃣ Testing Patterns
  • Given-When-Then (BDD style)
  • Test Doubles (Mock, Stub, Fake)
  • Property-Based Testing (e.g., hypothesis in Python, proptest in Rust)



πŸ”—πŸŸ’ Tools Every Mastermind Should Command

βœ… Git (Version Control)
  • Rebase, squash commits
  • Feature branch workflows
  • Writing meaningful commit messages
  • Handling merge conflicts like a pro
βœ… Docker (Containers)
  • Writing multi-stage Dockerfiles
  • Using docker-compose for dev envs
  • Building minimal, production-ready images
  • Understanding networks, volumes, healthchecks
βœ… Linux (Dev Environment)
  • Bash scripting
  • grep, awk, sed for text processing
  • Managing services with systemd
  • Networking basics (netstat, curl, dig)
βœ… CI/CD (Optional but Highly Recommended)
  • Github Actions / Gitlab CI pipelines
  • Lint β†’ Test β†’ Build β†’ Deploy sequences
  • Using Docker in CI pipelines



πŸ”—πŸŒ Clean API Development Guide (General & REST Focus)

πŸš€ Goals of Clean API Design
  • Consistent β†’ predictable patterns everywhere
  • Simple β†’ easy for clients to understand & use
  • Versioned β†’ changes don't break old clients
  • Secure β†’ protects against common vulnerabilities
  • Extensible β†’ easy to add features without breaking old ones
  • Well-documented β†’ clear and accurate API docs
πŸ”₯ General API Design Principles (Always Apply)
1. Use Meaningful Resource Naming
  • Use nouns for resources, verbs for actions.
  • Examples:
    GET /users
    POST /users
    PATCH /users/{id}
2. Use HTTP Methods Correctly
MethodUse For
GETRetrieve data
POSTCreate new resource
PUTReplace entire resource
PATCHUpdate part of resource
DELETERemove resource
3. Version Your API (Always!)
  • Example:
    /api/v1/users
    /api/v2/users
  • Use URI versioning or headers, but always version.
4. Use Standard HTTP Status Codes
Status CodeMeaning
200 OKSuccess
201 CreatedResource created
400 Bad RequestClient error
401 UnauthorizedAuth failed
404 Not FoundResource missing
500 Server ErrorInternal fail
5. Keep Responses Consistent
  • Use a common envelope format:
{
  "data": { ... },
  "error": null
}

https://swagger.io/






πŸ”—πŸŸ£ My Personalized Pattern Map (Cheat Sheet)

When I do this...It's called...
Pick components/classes based on conditionFactory Pattern
Wrap external APIs/components to fit my codeAdapter Pattern
Add features without changing base logicDecorator Pattern
Build objects/config step by stepBuilder Pattern
Split big things into smaller unitsSingle Responsibility
Centralize shared state across many partsMediator / Store Pattern
Extract repeated logicDRY Principle
Follow naming conventionsClean Code Naming



πŸ”—βœ… How To Become Confident When Choosing Architecture

  1. Small Project?
  • Use Layered Architecture.
  • YAGNI: Don’t over-engineer.
  1. Medium to Large?
  • Use Hexagonal + DDD Lite.
  • Aim for framework-independent domain logic.
  1. Frontend Complex State?
  • Model as State Machines.
  • Use stores only when 2+ components need shared state.
  1. Backend Scaling?
  • Move to Event-Driven or CQRS if reads/writes differ in volume.
  1. Always
  • Start simple (Layered), then evolve to advanced when complexity forces you.
  • Record decisions in ADR docs.



πŸ“š Recommended Books & Videos (Curated)

Books:

  • Clean Code by Robert C. Martin
  • Clean Architecture by Robert C. Martin
  • Domain-Driven Design Distilled by Vaughn Vernon
  • Patterns of Enterprise Application Architecture by Martin Fowler
  • Refactoring UI by Adam Wathan

Videos & Playlists:

Python
IT (networking / databases / http ...)
Backend / System Design
Rust
Git
Svelte
Linux
Algorithms
AI - we don't do that here

πŸ”₯ Final Tip

Mastermind devs don’t memorize patterns β€” they name their instincts and record decisions.
Trust your intuition. Level it up by learning the names.
Then, you'll not only code well β€” you'll design systems that last πŸ”₯.


πŸ› οΈ Terminal, SaaS, Dev, Desktop, Data, DevOps, Cool Stuff
Terminal
  • ranger
  • helix
  • tmux
  • docker / docker-compose / lazydocker
  • git / lazygit
  • htop
  • coreutils (grep / find / jq / sed ...)
  • ansible
  • fish / starship
  • ollama
  • certbot
  • espanso
SaaS
  • Wordpress (cf7 elementor)
  • Odoo
  • directus
  • n8n
  • aapanel
  • glpi
  • moodle / budibase / callcom / nocobase / nocodb
Dev
  • python (django, pandas / polars, fastapi, requests, scrapy, sklearn) jupyter
  • js (sveltekit / skeletonUi superform, drizzleORM, pwa, capacitor)
  • fun with go / rust
  • sentry
  • Qdrant
Desktop - kde Plasma / gnome (i3/sway for tiling) - insomnia - vscodium - chromium - dbeaver - inkscape - onlyoffice - flameshot - lmstudio
Data
  • dbt
  • dagster
  • airflow/prefect
  • superset
  • grafana
  • pg / mongo / sqlite / clickhouse
  • great_expectations
  • querybook
DevOps
  • prometheus / grafana / uptime kuma
  • gitlab
  • nginx / traefik / caddy
  • cockpit
  • openstack
  • portainer
Cool Stuff
  • typst
  • automa
  • evilimiter
  • airgeddon
  • PlantUML
  • fedora / alpine / k3s / microk8s / k0s
  • bookmarklets

🐍 Python Reference
Basics
  • OOP (classes)
  • generators (yield)
  • Decorators (@something)
  • Type hint
  • List comprehension
  • Lambda functions
    Code examples
Base Libraries
  • inspect
  • dis
  • toolz
  • functools
  • random/secret
  • operator
  • datetime/time
  • os/sys
Web
  • Django / DRF / Celery
  • flask (quart) / fastapi / django / muffin / blacksheep / aiohttp
  • requests
  • lxml
  • json
  • bs4
  • sockets
  • urlib3
  • jwt
Useful Libraries
  • tabulate
  • sqlalchemy
  • tinydb
  • scrapy
  • pyautogui
  • opencv2
  • pynput
  • pyinstaller
  • pillow
  • networkx
  • jwt
  • sqlacodegen (generating auto models from a database)
  • furl (manipulate URLs)
Functional Programming
Data Science / Analytics
  • numpy
  • pandas
  • matplotlib
  • plotly
  • scipy
  • sklearn
  • pytorch
  • pandas-profiling (repo)
CLI
  • fire