Kinuv Documentation

website·Indexed 30 days ago

https://kinuv.vercel.app

A technical knowledge base covering full-stack development, including JavaScript advanced concepts (Promise A+ implementation, prototype chains), NestJS (DI, AOP, lifecycle), Node.js, WebGL and Three.js, Webpack, Docker, and fundamental data structures and algorithms.

Tokens
29.3K
Snippets
111
Records
162
Agent score
75%

What's inside Kinuv

  1. Overview of WebGL and available frameworks

    WebGL is a 3D drawing protocol derived from OpenGL ES 2.0 that allows the rendering of 2D and 3D graphics within a web browser using HTML5 and JavaScript. Popular frameworks for WebGL development include Three.js, Babylon.js, kickjs, ClayGL, PlayCanvas, Luma (by Uber), and A-Frame (for VR experiences).
  2. Overview of Dependency Injection in NestJS

    NestJS implements an Inversion of Control (IoC) container that manages the instantiation of classes. Classes decorated with @Injectable() can be injected into other classes (such as @Controller()), and can themselves depend on other injected objects. The IoC container abstracts the instantiation process, allowing for decoupled components.
  3. Understand Node.js Module and Package terminology

    Key definitions for Node.js development:

    • Module: A single file. The entry point of an application is referred to as the 'entry module' or 'main module'.
    • Library (lib): A functional block composed of one or more modules.
    • Package: A library that includes metadata such as name, description, git repository, author, and dependencies.
  4. Understand Node.js core concepts and architecture

    Node.js is a JavaScript runtime built as an interpreter that allows JavaScript to execute outside the browser, specifically on servers.

    Key Characteristics:

    • Event-Driven & Non-blocking I/O: Node.js uses a single-threaded event loop. I/O tasks are handled asynchronously by offloading them to other threads, preventing the main thread from blocking.
    • Performance Profile: It is highly efficient for I/O-intensive services but is not suitable for CPU-intensive tasks.
    • Comparison: Unlike multi-threaded environments that can utilize multi-core CPUs but suffer from memory overhead and complex resource locking, Node.js's single-threaded nature saves memory and avoids resource contention.
  5. Understand the relationship between data structures and algorithms

    Computer programs are fundamentally composed of storage (Memory) and computation (CPU). Data structures focus on how data is stored, while algorithms focus on the process of computation.

    Key relationship points:

    • Formula: Program = Algorithm + Data Structure.
    • Data structures provide the foundation for algorithms; algorithms depend on data structures to be implemented.
    • Algorithms operate on data structures.
    • Data structures focus on logical and storage organization, while algorithms focus on solving practical problems using those structures.
    • Algorithms represent programming logic/thought, while data structures are the basis for that thought.
  6. Understand the NestJS application lifecycle sequence

    NestJS follows a specific sequence during startup: it recursively resolves module dependencies, scans providers and controllers, and injects dependencies. Once all modules are resolved, the application begins listening on the configured port. Lifecycle hooks are executed serially; if an asynchronous hook takes too long, it will block subsequent hooks and the overall application startup/shutdown process.
  7. Understand Devicemapper storage architecture

    Unlike AUFS, which is a filesystem, Devicemapper is a framework for mapping block devices. It maps virtual block devices (mapped devices) to physical block devices (target devices) using a map table.

    • Storage Locations:
      • /var/lib/docker/devicemapper/devicemapper/: Stores actual image and container content via a thinpool.
      • /var/lib/docker/devicemapper/metadata/: Stores JSON metadata regarding the relationship between image and container layers.
      • /var/lib/docker/devicemapper/mnt/: The union mount point for the container.
    • Layering Mechanism: Devicemapper achieves layering through snapshots. Each image layer is a snapshot of the layer below it. This enables efficient Copy-on-Write (CoW) and ensures that shared image layers are stored only once on disk.
  8. Reference common built-in NestJS decorators

    NestJS provides a wide array of built-in decorators to define modules, controllers, providers, and handle HTTP requests/responses. Key decorators include:

    Core Architecture:

    • @Module: Declares a Nest module.
    • @Controller: Declares a controller within a module.
    • @Injectable: Marks a provider as injectable.
    • @Inject: Manually specifies a provider to inject using a token (class or string).
    • @Optional: Marks an injected provider as optional (can be null).
    • @Global: Declares a global module.

    Request Handling & Routing:

    • @Get, @Post, @Put, @Delete, @Patch, @Options, @Head: Define HTTP request methods.
    • @Param: Extracts URL parameters (e.g., :id in /aaa/:id).
    • @Query: Extracts query string parameters (e.g., name in /aaa?name=xx).
    • @Body: Extracts the request body, typically mapped to a DTO class.
    • @Headers: Extracts specific or all request headers.
    • @HostParam: Extracts host parameters.
    • @Req/@Request: Injects the request object.
    • @Res/@Response: Injects the response object. Note: Injecting this disables Nest's automatic response handling unless passthrough: true is specified.
    • @Next: Injects the next() method to call the next handler.

    Response & Middleware:

    • @HttpCode: Modifies the HTTP response status code.
    • @Header: Modifies response headers.
    • @Redirect: Specifies a redirect URL.
    • @Render: Specifies a template engine for rendering.

    Cross-cutting Concerns:

    • @Catch: Declares the exception type handled by an exception filter.
    • @UseFilters: Applies an exception filter at the route level.
    • @UsePipes: Applies a pipe at the route level.
    • @UseInterceptors: Applies an interceptor at the route level.
    • @SetMetadata: Attaches custom metadata to a class or handler.
  9. Understand Docker's core architecture and Linux dependencies

    Docker is a lightweight container solution that shares the host's kernel, allowing for faster startup (seconds) and lower resource consumption compared to hardware-level virtualization like KVM. A Docker container relies on three primary Linux mechanisms to function: Namespaces, Cgroups, and Union File Systems.
  10. Understand the NestJS AOP request lifecycle execution order

    NestJS uses Aspect-Oriented Programming (AOP) to separate cross-cutting concerns from business logic. When a request hits a route, the components are executed in the following specific order:

    1. Middleware: Executes first (onion model).
    2. Guard: Determines if the request has permission to access the route (returns true or false).
    3. Interceptor (Pre-handler): Executes logic before the controller handler.
    4. Pipe: Validates and transforms request parameters.
    5. Controller Handler: The actual business logic in the controller is executed.
    6. Interceptor (Post-handler): Executes logic after the handler returns.
    7. Exception Filter: If any error occurs during the cycle, it is caught here to return a formatted error response.
  11. Understand WebGL vs Canvas 2D coordinate systems

    There is a fundamental difference between the coordinate systems used by the standard Canvas 2D API and the WebGL API:

    • Canvas 2D: Uses a 2D coordinate system where the origin (0,0) is located at the top-left corner of the canvas.
    • WebGL: Uses a 3D coordinate system where the origin (0,0,0) is located at the exact center of the canvas.
  12. Understand core Three.js concepts

    Three.js is a 3D graphics programming framework based on WebGL. To create a 3D program, you need the following basic objects:

    • Scene: The container for the 3D world, including all objects (lights, meshes, fluids) and environment properties (background, fog).
    • Geometry: Defines the shape and size of a 3D object (e.g., Cube, Sphere, Cone).
    • Material: The 'skin' or surface properties of the object.
    • Mesh: A visualization object created by combining a Geometry and a Material.
    • Camera: The observer that determines what part of the scene is visible. Multiple cameras can exist and be switched.
    • Renderer: The engine that draws the scene onto the HTML canvas.