Giter VIP home page Giter VIP logo

backend's People

Contributors

sanjarcode avatar

backend's Issues

Model/process level states and engineering them, like AASM (ruby)

Why + what?
Consider the example of an Ecommerce store, the general buy process has the following steps:
Place order -> Pay -> Dispatch -> *transition from warehouses -> arrive at local warehouse -> out for delivery -> delivered -> cancel/return? -> refund?

A lot is going on here. I have of courses omitted multiple possible states at each point.

Checkout:

P2p communication, without a server. Use backbone as a network layer mostly

Context

I want an app where my cursor position is shown to the person I'm video calling (say we're going through some code on their browser). It's one way comm, but how do I send my cursor coordinates without them 'listening' or the other way around.

The issue is I don't want to create a chrome plugin with a 'server' app that you need to install

Questions

  1. Is it possible to run a server inside a browser tab? Maybe only a temporary one.
  2. Reliable direct ping - Even if I do install a server app (in addition to the browser extension), how would I ping their server. Ik both are connected to the backbone via ISP, but are they reliably pingable? I don't wish to add a centralized server - that's a privacy issues and also that I need to pay for it.

Explore

  1. How p2p works, without a server?
  2. Pros and cons of being addressable but not having a dedicated server connected to the backbone. Scope: latency, cost, bottlenecks
  3. Handshake structures if this is possible?
  4. How do torrents work? See the protocol
  5. How websockets can work in such a system?

Request, response types, values, Validators should be exported by back-end, maximally

  • Yesterday, I wrote some Ruby (Rails) code just because request keys that were decided for an API differed from the column name (which Rails defaults to for request keys).

  • This mapping code was non-trivial, since one has to not reset something if the request doesn't have the key (think undefined vs null in JS). - Also, the form used on the frontend had a set of generic validators, for showing wrongly entered values. I had to add a custom validator if value was 'oneOf' a given array of fixed values.


  • at a discussion during the backend code review, the lead backend engineer suggested the changes were cosmetic, perhaps useless. So the team leads got together and decided to use ENUMS on the frontend whose name matched the decided keys but values would match the BE column names exactly. The PR, branch is now useless.

I thought this was a stupid way to code, atleast if you own both the server and client app.

  • The backend has the strongest validation of all, since it ingests data.
  • the frontend validations depend directly on backend validations. Of course, how the UI can be decided in the frontend code.

So, if the backend could just generate a "type" file with

  1. key names
  2. value type
  3. Possible values
  4. Validators to be used by the front-end (if calculable directly, i.e. can be checked without database lookup, atleast)

This would solve a lot of communication tasks, and cosmetic mappings.

SSE(? and vs WebSockets), TCP clarity, HTTP constraint

  1. What is SSE
  2. SSE core improvement - avoid the cost of TLS handshake, for sending 'close' signal
  3. Are WebSockets really an evolution over HTTP, SSE
  4. TCP is quite free, and HTTP has the request-response sequentiality constraint

sse-ws-http-tcp (ChatGPT conv)

I still have some doubts, ChatGPT was hallucinating about minute details, it seems.

Journey of request before backend app (our code)

Important. Knowledge about scaling stuff and what things matter - allow for more efficiency and simplification (less instances, less app code).

  • Use TPM and other discrete circuits for standard tasks like TLS, instead of CPU.
  • Kernel space and user space configs. Example - multiple threads listen on the same port.
  • HTTP 1.1 simpler than 2
  • Parsing, early detect missed, and cost of it.

Video: https://youtu.be/gSQoA4SYhJY?si=yTGTZByLeKbPAX_R - What happens before the backend gets the Request - Hussein Nasser

Important for growth phase/roles for an app/company.

API design reading

source: https://www.reddit.com/r/ExperiencedDevs/comments/pyleqb/recommendation_reading_booksblogs_for_best/

HTTP and its evolution

Learn about HTTP (in depth) from the following resources:

  1. Wikipedia - HTTP
  2. MDN - HTTP
  3. Skim/read this book: HTTP in action

Remember, the goal is to learn as less as possible, but understand as much as possible. Implementation details matter, only if they change the interface of the tech.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.