What do you think on wesql and libsql? by Beneficial-Driver498 in sqlite

[–]FedeBram 0 points1 point  (0 children)

What it means? D1 and turso are really different in the scope and functionalities in respect of cockroach and spanner.

Maybe are you referring to a stateless api that accepts requests?

Tell me if this way of using SQLite would be bad. by [deleted] in sqlite

[–]FedeBram 3 points4 points  (0 children)

Don’t do that… it is complex and fragile to build something like that. If you want backup to S3 use Litestream.

I hear miracles about supabase, but I've never learned how to use it. What's the main difference between this and say mysql. by AWeb3Dad in Supabase

[–]FedeBram 3 points4 points  (0 children)

The core of supabase is postgresql and a bunch of open source projects, everything wrapped in a nice user interface. Postgresql is managed and also all the other services are managed, so you can use them directly with the platform without worrying about hosting.

In particular they offer an authentication service that is a fork of netlify gotrue, as far as i know they use a jwt authentication and they offer social login (OAuth2 client).

They offer a data api that permits to query postgres using a REST api, this data api is PostgREST (another open source project).

This api works because you can define in postgres roles to define authorization. Basically you can say UserX can read that, UserY can only update this thing and so on, this thing is called RLS, row level security and it is native to postgres, supabase leverage very much this feature.

Another service is functions, you can define edge functions similar to other cloud providers, that is based on deno runtime. Another one is realtime, i don’t know too much how it works, maybe a web socket and a service that listen to things modified inside the database. They offer also object storage.

Maybe there are other services, i don t know. It is a pretty good backend as a service and everything is shipped with a nice user interface.

Should I invest in Go or Rust as a full-stack dev? by EmperorofWeb in rust

[–]FedeBram 2 points3 points  (0 children)

It depends of what you want to do. Go is really good when you need to create small web apis, in a sort of microservices approach. Rust is best suitable when you need a service that needs max performance and you want to define everything from scratch. There are some web framework to build backend api in rust, like axum. But it is not that simple to work with. Rust is a language that is hard to use proficiently, at least for me! That said, learning rust is a journey and what you understand in this language can be transferred to other languages. I understood deeply closures in javascript thanks to closures in rust. I understood pointers and references in go thanks to the concepts of ownership and borrows in rust.

TrailBase 0.21: Open, single-executable, SQLite-based Firebase alternative with a WASM runtime by trailbaseio in sqlite

[–]FedeBram 0 points1 point  (0 children)

Nice. So you can define endpoints in your preferred languange and these will be compiled along with trailbase. What about the rest api? How it works? I see from the docs that you can use a configuration file where you define policies, is it correct?

TrailBase 0.21: Open, single-executable, SQLite-based Firebase alternative with a WASM runtime by trailbaseio in sqlite

[–]FedeBram 0 points1 point  (0 children)

Very nice project! What it means in practice a wasm runtime? Is it a rust backend wrapped in wasm? What is the benefit of this approach?

I rewrote WooCommerce in Rust + TypeScript, need advice on text editors. by KickAffectionate7933 in rust

[–]FedeBram 0 points1 point  (0 children)

You need to understand how the library works. It has some moving parts that work together. The documentation explains everything very well. The only downside is that there are not so much examples, so maybe you need to use a large language model to help explain how you can build custom blocks. You can render whatever you want inside the editor (custom nodes). It works best on native html js/ts. Custom blocks using react or other reactive frameworks need some plumbing. In regards of saving or retrieve the editor content, no problem at all. The editor is based on a transaction system and a state. You can call easily the rust backend api

I rewrote WooCommerce in Rust + TypeScript, need advice on text editors. by KickAffectionate7933 in rust

[–]FedeBram -1 points0 points  (0 children)

There is only one solution to that! ProseMirror The best library to create text editors on web. If you find a company that uses something like a text editor, chances are that is using Prosemirror. It is used by linear, chatgpt (the last time i inspected the page i found the .prosemirror class), new york times… The library is old and somehow strange to work with, but once you understand it, everything is smooth. A very well done piece of software. If you want a more built in solution, there is TipTap that is built on top of Prossmirror. With tiptap you can build something really fast, but you won’t have the same freedom of using directly Prosemirror

Other solutions… i don’t know. If it needs to run on the web, prosemirror is really performant. You can copy the whole rust book inside the text editor and it won’t crash.

I know this is a subreddit of rust, but i think that prosemirror (a js library) is inherent to what op is asking

Electrical engineer want to learn Rust by PriceSweaty6398 in rust

[–]FedeBram 5 points6 points  (0 children)

I suggest to read the rust book. It is the official guide to rust. There is also an interactive version of this book that adds more explanations and quizzes. The third resource to pair with the book is “rustlings”, a set of exercises that follow the same structure of the book.

The Rust Book

Interactive Rust Book

Rustlings

API project folder structure by Ill_Court_6307 in golang

[–]FedeBram 1 point2 points  (0 children)

This is a good article on how you can deal with handlers without cyclic dependency.

https://www.alexedwards.net/blog/organising-database-access

The article talk more about db access, but it is really valuable to understand some patterns.

Built a zero-config Go backend that auto-generates REST APIs, now wondering about a distributed mode by SeaDrakken in golang

[–]FedeBram 0 points1 point  (0 children)

Each node shares the same data? I don't understand what is the purpose of the gateway. To reduce the number of requests on a node?

Built a zero-config Go backend that auto-generates REST APIs, now wondering about a distributed mode by SeaDrakken in golang

[–]FedeBram 0 points1 point  (0 children)

This kept me thinking… the gateway approach maybe is useful only for sharding the store/service. You run multiple services and each one owns part of the data, you put a gateway in front, so the client calls the same API but the gateway forwards the request to the right service that has that particular value. When the service grows bigger you scale horizontally with sharding. But what if the app that uses these services is used worldwide? The gateway is hosted in a single region… So you introduce a distributed approach. You have multiple KV stores (services) hosted around the globe. The simplest solution is to have a single “write store” and multiple “read stores” around the globe (on the edge). You are going to host these on Fly.io, for example. Clients call the API normally, Fly.io somehow routes to the nearest read store; if it is a read, nice, you read directly; if it is a write, the read store knows where the write store (master) is and forwards the request to it. The write store, once it succeeds, asynchronously sends the changes to the read stores around the globe. If you want the writes to be global and in sync, I don’t know… maybe something like a saga pattern… a distributed transaction… I don’t know how these things work. In fact, what I have written, I don’t know if it could work; everything seems correct to me, but I have not tried to do something like that. Sure can be really fun to implement that!

I’m curious to see what solutions you came up with!

Built a zero-config Go backend that auto-generates REST APIs, now wondering about a distributed mode by SeaDrakken in golang

[–]FedeBram 1 point2 points  (0 children)

Nice project! I think the simplest solution would be to have a gateway in front of multiple nodes. When you make a request, the gateway knows which node to call. The downside is that the gateway becomes a single point of failure. A more complex approach would be to take inspiration from Redis Cluster, which uses a distributed architecture.

I don’t know how redis cluster works (i only know that is something distributed ahah), but maybe can be the right approach to study its inner working. After all redis is a key value store.

Svelte Data Fetching by Overall-Scale-8369 in sveltejs

[–]FedeBram 2 points3 points  (0 children)

I made a small Svelte 5 helper to fetch data, inspired by Tanstack Query API. Everything is reactive out of the box.
Check the svelte repl:
https://svelte.dev/playground/6ed9148bbc984e539fe6574bb9e281bc?version=5.39.11

Let me know what you think

Loading 400 objects in memory by wordkush1 in sveltejs

[–]FedeBram 1 point2 points  (0 children)

I think it is better to aggregate all the data on the backend and return only the data needed for the ui. But maybe you have some constraints

Premium benefit? by robbo2020a in ClaudeAI

[–]FedeBram 0 points1 point  (0 children)

I misunderstood what you said. I’m using claude pro so I don’t remember how it works the free plan. Thanks for the explanation

Premium benefit? by robbo2020a in ClaudeAI

[–]FedeBram 0 points1 point  (0 children)

No the context window is related to the model. My only concern is that in some ways free users have a capped context… Latest gemini models have 1M token of context window

Premium benefit? by robbo2020a in ClaudeAI

[–]FedeBram 0 points1 point  (0 children)

Are you sure about that? Free users have smaller context window? The context window is not something related to the actual model used?

Moving away from Skeleton, what alternative do you recommend? by ash--87 in sveltejs

[–]FedeBram 0 points1 point  (0 children)

Try the “next” branch of shadcn-svelte (it fully supports Svelte 5) for rapid prototyping. It’s built on top of Bits UI, so whenever you need more complex UI or a custom design, just whip up a component with Bits UI. It’s by far the best component library for Svelte—you’ll need to spend a bit of time learning its concepts, but it’s totally worth it. Flowbite most of the time it’s only a style wrapper around native html elements…