frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Longtime Mozilla Support Japanese Community Shuts Down over AI Translation Usage

https://support.mozilla.org/en-US/forums/contributors/717446
42•phantomathkg•23m ago•4 comments

Solarpunk is happening in Africa

https://climatedrift.substack.com/p/why-solarpunk-is-already-happening
583•JoiDegn•7h ago•293 comments

Recursive macros in C, demystified (once the ugly crying stops)

https://h4x0r.org/big-mac-ro-attack/
25•eatonphil•1h ago•0 comments

Dillo, a multi-platform graphical web browser

https://github.com/dillo-browser/dillo
241•nazgulsenpai•8h ago•86 comments

ChatGPT terms disallow its use in providing legal and medical advice to others

https://www.ctvnews.ca/sci-tech/article/openai-updates-policies-so-chatgpt-wont-provide-medical-o...
227•randycupertino•8h ago•214 comments

The state of SIMD in Rust in 2025

https://shnatsel.medium.com/the-state-of-simd-in-rust-in-2025-32c263e5f53d
168•ashvardanian•8h ago•85 comments

Firefox profiles: Private, focused spaces for all the ways you browse

https://blog.mozilla.org/en/firefox/profile-management/
139•darkwater•1w ago•69 comments

New gel restores dental enamel and could revolutionise tooth repair

https://www.nottingham.ac.uk/news/new-gel-restores-dental-enamel-and-could-revolutionise-tooth-re...
349•CGMthrowaway•7h ago•147 comments

Why aren't smart people happier?

https://www.theseedsofscience.pub/p/why-arent-smart-people-happier
206•zdw•10h ago•329 comments

Ruby and Its Neighbors: Smalltalk

https://noelrappin.com/blog/2025/11/ruby-and-its-neighbors-smalltalk/
173•jrochkind1•11h ago•98 comments

The Basic Laws of Human Stupidity (1987) [pdf]

https://gandalf.fee.urv.cat/professors/AntonioQuesada/Curs1920/Cipolla_laws.pdf
43•bookofjoe•4h ago•14 comments

A Lost IBM PC/at Model? Analyzing a Newfound Old Bios

https://int10h.org/blog/2025/11/lost-ibm-at-model-bios-analysis/
60•TMWNN•6h ago•10 comments

Unicode Footguns in Python

https://pythonkoans.substack.com/p/koan-15-the-invisible-ink
28•meander_water•1w ago•8 comments

FAA to cut flights by 10% at 40 major airports due to government shutdown

https://www.cnbc.com/2025/11/05/faa-cuts-flight-capacity-shutdown.html
9•mikhael•18m ago•0 comments

The shadows lurking in the equations

https://gods.art/articles/equation_shadows.html
256•calebm•12h ago•81 comments

NY school phone ban has made lunch loud again

https://gothamist.com/news/ny-smartphone-ban-has-made-lunch-loud-again
214•hrldcpr•13h ago•164 comments

An eBPF Loophole: Using XDP for Egress Traffic

https://loopholelabs.io/blog/xdp-for-egress-traffic
209•loopholelabs•1d ago•69 comments

Vacuum bricked after user blocks data collection – user mods it to run anyway

https://www.tomshardware.com/tech-industry/big-tech/manufacturer-issues-remote-kill-command-to-nu...
180•toomanyrichies•4d ago•55 comments

Timing Wheels

https://pncnmnp.github.io/blogs/timing-wheels.html
31•pncnmnp•4d ago•0 comments

I want a good parallel language [video]

https://www.youtube.com/watch?v=0-eViUyPwso
59•raphlinus•1d ago•33 comments

I was right about dishwasher pods and now I can prove it [video]

https://www.youtube.com/watch?v=DAX2_mPr9W8
307•hnaccount_rng•1d ago•195 comments

Carice TC2 – A non-digital electric car

https://www.caricecars.com/
188•RubenvanE•12h ago•142 comments

Gloomth

https://www.lrb.co.uk/the-paper/v47/n20/jon-day/gloomth
3•prismatic•6d ago•0 comments

Absurd Workflows: Durable Execution with Just Postgres

https://lucumr.pocoo.org/2025/11/3/absurd-workflows/
102•ingve•2d ago•22 comments

App Store web has exposed all its source code

https://www.reddit.com/r/webdev/comments/1onnzlj/app_store_web_has_exposed_all_its_source_code/
188•redbell•2d ago•47 comments

SPy: An interpreter and compiler for a fast statically typed variant of Python

https://antocuni.eu/2025/10/29/inside-spy-part-1-motivations-and-goals/
235•og_kalu•6d ago•109 comments

Visualizing the most common unisex names in the US

https://nameplay.org/blog/common-unisex-names-by-gender-ratio
26•aaronjbecker•1w ago•10 comments

Learning from failure to tackle hard problems

https://blog.ml.cmu.edu/2025/10/27/learning-from-failure-to-tackle-extremely-hard-problems/
103•djoldman•6d ago•22 comments

A P2P Vision for QUIC (2024)

https://seemann.io/posts/2024-10-26---p2p-quic/
87•mooreds•12h ago•38 comments

Norway reviews cybersecurity after remote-access feature found in Chinese buses

https://scandasia.com/norway-reviews-cybersecurity-after-hidden-remote-access-feature-found-in-ch...
332•dredmorbius•10h ago•187 comments
Open in hackernews

Show HN: SQLite JavaScript - extend your database with JavaScript

https://github.com/sqliteai/sqlite-js
199•marcobambini•5mo ago

Comments

gwbas1c•5mo ago
Question: How easy / hard is it to replace a SQL query with a join, to a SQL query that returns a JSON object? (IE, a foreign key relationship is turned into a JSON array.)
marcobambini•5mo ago
SQLite has built-in JSON support: https://www.sqlite.org/json1.html
datadrivenangel•5mo ago
As in return the relation behind the join or return the results of that as a json object?

The latter is easy with SQLites JSON support.

rileytg•5mo ago
How is the performance? Any docs or benchmarks related to this?
marcobambini•5mo ago
https://bellard.org/quickjs/bench.html
abirch•5mo ago
This is cool. It's very reminiscent of https://github.com/plv8/plv8 for Javascript on Postgresql.
tehlike•5mo ago
I use plv8 - it's great!
jmull•5mo ago
This is a fantastic approach.

BTW, it looks like the js engine is "QuickJS" [0]. (I'm not familiar with it myself.)

I like it because sqlite by itself lacks a host language. (e.g., Oracle's plsql, Postgreses pgplsql, Sqlserver's t-sql, etc). That is: code that runs on compute that is local to your storage.

That's a nice flexible design -- you can choose whatever language you want. But quite typically you have to bring one, and there are various complications to that.

It's quite powerful, BTW, to have the app-level code that acts on the app data live with the data. You can present cohesive app-level abstraction to the client (some examples people will hopefully recognize: applyResetCode(theCode) or authenticateSessionToken(), or whatever), which can be refined/changed without affecting clients. (Of course you still have to full power and flexibility of SQL and relational data for the parts of your app that need it.)

[0] https://bellard.org/quickjs/

90s_dev•5mo ago
QuickJS came out a few years ago, and it was really exciting at the time, being a Lua-style embeddable JS in contrast to V8 which is a beast but very fast and much more comparable to LuaJIT. Which basically meant you could stop using Lua for scripting and start using JS. But by the time it came out, TypeScript was already king of JS land, and QuickJS didn't have native TypeScript type stripping support last time I checked (~2023), though he did port the `tsc` compiler to it I think? so you can build this functionality yourself. I wonder how QuickJS compares to JSCore which Bun uses.
jmull•5mo ago
You could use jsdoc, or 'tsc' your .ts files on the way to loading them into the db.

Typescript has a fairly limited utility here though. It's a static type checker. Your types are mostly going to be SQL parameters and the result of running SQL, which, by design/nature are resolved at runtime. You could build a bunch of external controls to help ensure the runtime data is contained to your static types, but you're really swimming upstream. Like you can use a screwdriver as a hammer, but there are better approaches. (I think typescript would be much better used client-side, in your app server code that is above the data layer.)

90s_dev•5mo ago
I tried jsdoc for so many years before just giving up and going full TypeScript.

But you're right, the TS layer would be static, and you would compile to JS and just use that... I guess.

Until the types-proposal is inevitably implemented, of course.

jmtulloss•5mo ago
This doesn’t make sense to me. SQLite is an embedded database, all the app code is already local to the storage.
jmull•5mo ago
Well, you can still have an app server if you want -- having app logic that runs local to the storage doesn't preclude you from also having an "app server" (that is, a place app logic runs that isn't local to the user and isn't local to the storage, but somewhere in between.)

Very typically, that's how it's done with traditional client/server databases.

There's no built-in "wire-protocol" for clients to connect, but there are reasonable options (it's a pretty common pattern, if fact, for systems to have a data service that provides an app-level HTTP interface to data -- so there you go, it's something you might have implemented anyway).

But I think this project would help in the creation of a full/rich application data service without a need for an intermediate app tier.

There are a few reasons people end up with an intermediate app-level data service, but it's starting to seem like a service based on sqlite (running local to the storage, of course) may be able to provide a decent alternative answer in many cases.

I'm imagining a service light-weight enough to run as a lambda or other serverless environment (including fast cold start) which then opens up some interesting things like one-db per user and maybe user-controled host, etc.

MobiusHorizons•5mo ago
You could of course do that, but the main reason to use SQLite in a server application is for the performance characteristics of staying in-process for accessing the database. This makes it cheap to make queries in response to a previous query, which would need to somehow be batched for good latency with a client/server database. Re-adding the client server model defeats almost all of the PROs of SQLite, leaving you with only the CONs.
jmull•5mo ago
Traditional client/server databases let you run app logic local to the storage. E.g. stored procedures. There's no particular advantage for sqlite there.

Now, people add unnecessary layers all the time to everything. But there are also good reasons for compute that is between "local to the user" and "local to the storage".

mikepurvis•5mo ago
I feel like this would be more about validation and constraint enforcement than full on application functions.

Given that, though, JavaScript feels like a bit of an odd choice for language.

oefrha•5mo ago
Plus if you want to use functions inside queries, SQLite UDFs can be used from any language. E.g. for Node the better-sqlite3 binding has supported UDFs for ages; the new experimental node:sqlite also appears to have support[1][2], though I haven't used it. For Python UDFs are supported out of box. Etc. I can't see myself loading a js extension with a bundled engine exposing the same UDF capability when I can just use UDFs from the host language (which can be js with v8 already there) with access to whatever application state I want to expose, and arbitrary library code, rather than just the bare bones standard library shipped with QuickJS. What's the use case? Use rather awkward js functions in the sqlite3 CLI?

[1] https://nodejs.org/api/sqlite.html#databasefunctionname-opti...

[2] https://nodejs.org/api/sqlite.html#databaseaggregatename-opt...

ncruces•5mo ago
This stores the UDFs in the database. Which means each database can have its own UDFs.

This makes more sense if you're someone who hosts the databases of others, but I it's still interesting otherwise.

Like, if something like that was included in the CLI, one of the many browser apps, or the online playgrounds, your DBs could carry their own UDFs portably within themselves.

It'd be even more interesting if it supported virtual tables as well.

mingodad•5mo ago
There is also https://github.com/ricomariani/CG-SQL-author that has a powerful stored procedure capabilities that can be transpiled to C/Lua/..., you can try it in your browser here https://mingodad.github.io/CG-SQL-Lua-playground .
crabbone•5mo ago
When I needed to interface with SQLite from Ada, I discovered that SQLite library provided with the language lacked regular expressions, and I had to add that functionality myself. During this exercise, I learned that you can relatively easily add Ada functions to be executed by SQLite. From performance and ability to debug standpoint, I'd prefer this to a whole language runtime added to the database.

In general, I'd prefer to minimize non-SQL code that runs in the database because it's hard to reason about its implications on the already complicated planning and execution of SQL code. Especially if such code can observe or change the state of the variables involved in a transaction. I feel like to not have this feature backfire, I'd want to have a way to either disallow access to the variables, or create a framework for the foreign code where its made to comply with transaction rules and have to make promises about its own code to not violate them.

sgarland•5mo ago
The other reason to not do this is that most functions someone might want to add are very simple, enough so that even if you don’t know C, you can probably muddle your way through it.

JS in an RDBMS… shudder

cdaringe•5mo ago
> shudder

Well, we’re already talking about dyn langs here (plsql, tsql, etc). At least in the js case you have some notion of fp constructs available. It’s not like the constraints of the db vanish!

Nonetheless i generally agree.

vrighter•5mo ago
the sqlite database engine runs in-process. Whatever language you embed it in, is the "native" compute language for it.
9dev•5mo ago
JS is a great choice for this. I wonder if one could stack a bytecode compiler on top, to optimise performance even further? Or add WASM support, and compile the JS to WASM when creating the function?
porridgeraisin•5mo ago
> js_create_aggregate

Reminds me of awk, Nice.

cal85•5mo ago
Looks interesting. Is there a performance benefit to pushing this kind of logic into SQLite, compared with doing similar logic as a series of steps from a Node process? Or are the motivations for this library more ergonomic/practical? (Or does it enable you to do things you actually couldn’t do from Node at all?)
sillystu04•5mo ago
There are performance benefits to using DB functions in situations where you'd otherwise have to pull lots of data out of the DB.

For example, if you wanted to find which of your sessions where created with iPV6 addresses you could select them all out and perform the logic in your application code, potentially at the cost of pulling millions of records out of your DB. But doing it in a DB function allows you to skip this as your app code never needs to do the calculations.

This kind of optimisation is generally more important when the DB is running on a separate machine to the application code because of the overhead of big network requests in getting large amounts of data out, but even on a local SQLite DB there is likely some non zero benefit to minimising the amount of data retrieved.

I suppose DB functions could of course be implemented in SQL or similar, but that can be quite unfriendly for complex logic. So in a sense there is an advantage ergonomic as well.

cal85•5mo ago
> even on a local SQLite DB there is likely some non zero benefit to minimising the amount of data retrieved.

Why though? I get why it can be a big perf win to push that kind of logic into a remote DB - fewer and smaller payloads being sent over the network. But what makes you say there is likely a non-zero benefit even with local SQLite? (I don’t really have a clear mental model of how embedded SQLite works, so you may well be right, I just want to understand why.)

frollogaston•5mo ago
First thing that comes to mind is you've got a complex query with some of these UDFs involved in the middle, rather than just transforming the end result. Doing the equivalent without UDFs would be an entirely different query with a different plan, or more likely you'd have to split into separate queries.
intalentive•5mo ago
If you have to pull the data into your application then it's all in memory at once. SQLite streams from disk, so the memory usage at any given time is less. Also, if the application language is slower than C, then you get a performance boost there as well.
sgarland•5mo ago
Because I/O isn’t free? If you can write code that does fewer things, it will be faster.
datadrivenangel•5mo ago
Can't you already just register a javascript function as a custom user defined SQLite function?
bob1029•5mo ago
This is the API used: https://www.sqlite.org/appfunc.html

You can build really powerful domain-specific SQL scripting engines using this interface. The functions bound to SQL can be anything. They do not have to be deterministic or free of side effects.

Microsoft has a really good provider & docs around how to use this with .NET/C#:

https://learn.microsoft.com/en-us/dotnet/standard/data/sqlit...

mcflubbins•5mo ago
Cool, now someone rebuild the magic that was the OLD CouchDB (1.x) with couchapps!
gcv•5mo ago
Q|ery uses SQLite and QuickJS, too, but in Rust.

https://qery.io/

hbcondo714•5mo ago
> Every SQLite Cloud database comes with the sqlite-vec extension pre-installed. sqlite-vec is currently built and optimized for brute-force vector search. This means there is no approximate nearest neighbor search available at this time[1]

Darn, ANN would be awesome to have on the edge.

[1]: https://docs.sqlitecloud.io/docs/vector

marcobambini•5mo ago
We'll soon announce a new extension: sqlite-vector.

It is blazing fast, highly optimized, and even performs well on memory-constrained devices. Already tested with 5M 1500-dimensional vectors.

The repo is currently private, and we'll make it public soon: https://github.com/sqliteai/sqlite-vector

mholt•5mo ago
How does it compare to https://github.com/asg017/sqlite-vec ? Already using this in a big project.
marcobambini•5mo ago
Our implementation is much faster and does not require to store vectors into a virtual table (which forces the user to write complex join statements)
intalentive•5mo ago
Have you benchmarked against the usearch extension?
pdyc•5mo ago
can this work with wasm too? that would open interesting doors of doing it in browser.
mike_r_parsons•5mo ago
You can already do this ... https://sql.js.org/#/?id=api-documentation:~:text=//%20You%2...
sgarland•5mo ago
Why not use the native functions [0] of the DB? Presumably they're going to be faster. For example, computing the median of a table `nums` with columns `id` and `num` can be done like this:

    WITH ordered_nums AS (
      SELECT num, ROW_NUMBER() OVER (ORDER BY num) as rn,
             COUNT(*) OVER() as total
      FROM nums
    )
    SELECT AVG(num) as median
    FROM ordered_nums
    WHERE rn IN (
      (total + 1) / 2,
      (total + 2) / 2
    );
[0]: https://www.sqlite.org/lang_corefunc.html
gorm•5mo ago
Nice project and cool to see JavaScript embedded with SQL this way, never seen it before. Just wondering how it ended up like this syntax wise and what exactly is going on here?

SELECT js_create_scalar('function_name', 'function_code');

Really cool project! Thanks for sharing.

orliesaurus•5mo ago
This is such an interesting concept, thanks for sharing!
neuroelectron•5mo ago

    CVE-2024-0418 (and similar recent ones like CVE-2024-32593, CVE-2024-32592): These often relate to how QuickJS handles certain object properties or internal structures, potentially leading to crashes (Denial of Service) or, in more severe cases, memory corruption issues like heap-based buffer overflows or use-after-free vulnerabilities. These types of memory corruption can sometimes be escalated to arbitrary code execution, though it's not always straightforward.

    CVE-2021-40517: A use-after-free vulnerability when handling Array.prototype.concat with a specially crafted proxy object. This could lead to a crash or potentially code execution.

    CVE-2020-13951: An issue in JSON.parse that could lead to a stack overflow (Denial of Service) with deeply nested JSON structures.
It's not V8 or SpiderMonkey, which have dedicated, large security teams and decades of hardening due to their use in browsers handling actively malicious web content. QuickJS is primarily the work of one (albeit brilliant) developer.

This means that while it's well-written, the sheer volume of security research and fuzzing applied to browser engines is likely greater.

The responsibility for security falls on multiple layers:

    Fabrice Bellard for QuickJS itself.

    The sqlite-js developers (
    @marcobambini
    marcobambini Marco Bambini
    @Gioee
    Gioee Gioele Cantoni)

    for how they embed, configure, and update QuickJS, and what APIs they expose.

    The end-user/DBA for controlling who can define JavaScript UDFs and for keeping sqlite-js (and thus its QuickJS version) updated.
timz•5mo ago
Fantastic, would love to see same js support for redis as oposed to lua scripts.
rasz•5mo ago
Hear me out guys - SQLite, but in a browser! We could call it WebSQL.
pwdisswordfishz•5mo ago
That's pretty much why it failed: https://www.w3.org/TR/webdatabase/

> This document was on the W3C Recommendation track but specification work has stopped. The specification reached an impasse: all interested implementors have used the same SQL backend (Sqlite), but we need multiple independent implementations to proceed along a standardisation path.

rasz•5mo ago
It stopped due to politics, specifically LOL arguments about "inelegant developer aesthetics" coming from Mozilla https://hacks.mozilla.org/2010/06/beyond-html5-database-apis.... Somehow everyone and their dog using same Chrome codebase is fine, but oh no not the SLQ backend!

Instead we are saddled with garbage IndexedDB so bad nobody uses it natively and thousands of developer hours are spend building shims and wrappers to shield us from the brain rot.

pwdisswordfishz•5mo ago
But back then it wasn't a Chromium monoculture yet – Presto, Trident and KHTML were still going strong.

That the commitment to multiple implementations is something the WHATWG takes much less seriously than the W3C once did is another matter.

rcarmo•5mo ago
Nice. Would prefer Lua though.
3cats-in-a-coat•5mo ago
I wonder how many more decades we need until we realize database and programming language belong together. We can still separate infrastructure in persistence, backend, frontend, that's not the point. Every one of them should have a native local relational database, and these databases, in each layer, should be capable of basic interop out of the box.
Wheaties466•5mo ago
Can someone explain to me why you would want to do something like in the example of calculating age based on birthdate? Why wouldn't you do that within an app or within code rather than having a database function?