Make the world a better place and build your JavaScript application in C. RayClay aims to be the most developer-friendly framework for creating native desktop and mobile applications. It handles all the DIY aspects of C for you while retaining all the performance benefits of using a low-level programming language. Why not use React Native or Electron? Because your users can feel when an app is 10x more responsive, or when their device is almost out of memory and your app is the only process not lagging, or when the install size is 1 MB instead of 100 MB. The user experience is straight up better. The lure of popular JavaScript frameworks is the developer experience; it's so much easier to ship something fast. And it is undeniable that the unholy trinity (HTML, CSS, JS) produces some beautiful UIs that are tricky to replicate in lower-level languages. Enter RayClay. RayClay builds for desktop, mobile, and the web. It is rigorously tested on physical desktop machines and mobile devices (we test real pixels, not just remote logs): macOS, Windows 11, Linux (various distributions), iOS, Android, and WebAssembly. RayClay was developed because it is simply too difficult to build full-stack apps in existing low-level frameworks, while JavaScript frameworks make it easy but are bloated beyond belief. It felt like there was no middle ground. Dear ImGui did not have the out-of-the-box ease of development that I was looking for (RayClay has flexbox-style layouts and networking) and Qt, the most capable lower-level framework, has a dual-licensing model that can become somewhat restrictive or even expensive, depending on your project's goals, distribution methods, and budget. And so, RayClay was born; ready to build complete apps out of the box, open source (no Qt strings attached), and free from the resource burden of JavaScript frameworks like React Native or Electron. And now, because your app is in C, you unlock all sorts of potential lower-level capabilities that JavaScript simply does not have access to, and your app is straight up more performant and less resource intensive. The point is, RayClay is great for any kind of native app, whether performance is a necessity (real-time overlays, machine telemetry, low-latency trading, etc.) or simply a nice-to-have. C is measurably more performant than JavaScript by a wide margin, so if it's no extra effort to vendor a C framework over a JavaScript one... well, the choice should be pretty straightforward. Happy coding! Check out RayClay on GitHub and GitLab. Useful Resources: RayClay cheatsheet - every public function in the API (or find at docs/api.md). RayClay template (GitHub, GitLab) - a starter app with a custom titlebar, a collapsible sidebar and browser-style zoom. The app follows RayClay best practices and is structured to be scalable. Naming Conventions Anything you call, pass or set is spelled rc or RC_; the exceptions are RAYCLAY_IMPLEMENTATION, RAYCLAY_NO_GUI and the RAYCLAY_ environment variables. Names beginning rci_ or RCI_ are internal; they can change in any release, so don't depend on them. Public Functions All public functions and element macros are in the single rayclay.h you include. Full one-line reference: docs/api.md. rcRunApp(NULL) // zero-config: a window + the welcome canvas rcRunApp(&opts) // your layout and full RC_AppOptions control rcAppCreate / rcRunFrame / rcAppDestroy // you own the frame loop Element Macros Containers, text and the text-entry fields are macros, not functions: designated initializers with a brace body. Widgets, menus and modals are macros too (they take designated options); interaction reads are plain functions. rcColumn(.id = "sidebar", .bg = RC_SLATE_800, .gap = 8, .p = 12) { rcTextL("Inbox", .color = RC_WHITE, .size = 18); if (rcButton("send", "Send", .variant = RC_BTN_PRIMARY)) send_message(); } Sizing tokens: RC_FIT, RC_GROW, RC_PX(n), RC_PCT(n). RayClay builds for C++ projects too: rayclay.h is wrapped in extern "C", so a C++20 file can include it and use the same element macros, with each macro's designated fields written in declaration order (C++20 requires it). Link the rayclay CMake target, which compiles the implementation as C for you. Desktop-only surface rcWindowControls, rcWindowControlButton and the RC_ID_WINDOW_* ids (MINIMIZE / MAXIMIZE / CLOSE / DRAG) compile on every target but emit nothing on the web and on phones, where the browser tab or the OS shell is the window chrome. Same source, no #ifdef. Developer Principles To quote an extract from learncpp.com, typically, good solutions have the following characteristics: They are straightforward (not overly complicated or confusing). They are well documented (especially around any assumptions being made or limitations). They are built modularly, so parts can be reused or changed later without impacting other parts of the program. They can recover gracefully or give useful error messages when something unexpected happens. To add a few of my own... ...non-negotiables: open source (free for the world to use and redistribute). os agnostic (can compile on any os). lightweight (or produces lightweight outputs). good 'big business' adopters (improves longevity). ...preferences: simple to use. not a headache to learn and setup. large community. lots of tutorials. capable of flexible, modern builds. does not feel/look outdated. Why C? To quote the sokol README: easier integration with other languages easier integration into other projects adds only minimal size overhead to executables
AI NEWS JOURNAL
Hacker News Show HNAI NEWS / JOURNAL
Show HN: RayClay – an open source C app framework for desktop, mobile, and web
RayClay aims to be the most developer-friendly framework for creating native desktop and mobile applications. It handles all the DIY aspects of C for you while retaining all the performance benefits of using a low-level programming language.MY MOTIVATIONAt the start of the year I decided I wanted to develop my own app with the goal of releasing it on mobile, desktop, and web.Probably like most developers, I wanted to build a closed-source app and distribute it to whomever I wanted. And I didn't want to have to pay any sort of fee or owe any conditions to the development tools I used. It turns out, this set of criteria really limited what framework I could choose.Distributing it to whomever I wanted meant that the app had to be properly cross-platform. This cut out options like React Native (no official Linux) and Electron (no iOS or Android). And, while Tauri has yeses for all platforms, I decided that its dependence on platform-native webviews would probably mean excessive ongoing maintenance which I would prefer not to have to deal with. These frameworks were all very bloated anyways so it didn't feel like a big loss tbh.So I was left with choosing between Qt and Flutter, but Qt has this finicky dual licensing model and Flutter still felt a bit too bloated.Ultimately, I realised that I was looking for a framework that didn't exist: lightweight like Qt but also convenient and fully open-source like Flutter. I wanted the performance of a lower-level framework with the convenience of less-performant frameworks. Is that really so much to ask for :/This led me to develop RayClay. It's already 6 months old but now I feel it is really ready for the world to check it out since I've released v1.0 (which I deliberately held back releasing until I though it was ready).This description is adapted from my blog post here https://www.impizulu.com/blog/why-i-built-rayclay where I give a little more detail. Comments URL: https://news.ycombinator.com/item?id=50600516 Points: 1 # Comments: 0