I recently started using Turso, which is a great database option for serverless as well as to keep costs low. Its pricing is more than competitive with something like AWS DynamoDB, which is quite interesting as a alternative to it.
One problem though, there's no support by any good ORMs or similar in the Rust ecosystem for Turso.
Instead, I was currently writing something like this, just to get a User
out from the database via their session:
From a couple of founders, to a small team, to being a “small startup”, moving into scale-up territory, and finally transitioning beyond, there are many changes your organization will go through.
But what should you aim for as you grow and need to delegate your responsibilities and you transition from a couple of founders, into a company of 300 or more?
Throughout my career I’ve seen many structures at different scales, and have thought a lot about the ideal structure I would land on for a Engineering company that develops Products (e.g. a SaaS company).
I’ll warn you though: This will be opinionated, but I do believe that there is a strong reasoning behind the structure I’ve ended up at—let's dive in!
I recently moved my blog from https://codetalk.io (now my commercial site) to https://codethoughts.io. This of course also meant, that everything linking to my old blog was now broken, which is not the best experience for any readers that I might have 😅
Initially I considered setting up rewrite rules somewhere for each individual post, but then thought of a much smarter way, using CloudFlare’s Redirect Rules, to instead redirect all direct links to posts and throw them to the new location on codethoughts.io.
The documentation for these rules are a bit sparse, so I thought I’d share how I did. First though, let’s set some context:
/posts/
path on the domain.html
ending on the new blog (i.e. what previously might have been https://codetalk.io/posts/a-blog-post.html
would now be https://codetalk.io/posts/a-blog-post/
)One of my absolute favorite methods of deploying Frontends is to pre-generate all routes statically, and then let each route load the dependencies they need for interactivity.
I particularly care a lot about infrastructure scalability, maintainability, robustness, and cost. SSR typically makes each of these significantly worse compared to simply serving static files. I also don’t believe mixing your API into your Frontend code (i.e. Server Actions) will do you any favors when you start scaling up your teams, but that’s a topic for another day.
In this post we'll explore how this can be setup and compare a couple of different frameworks. Let's start with the overall results before we dive into the details:
Framework | SSG Support | Hydration Support | Assets Chunking |
---|---|---|---|
Next.js | ✅ | ✅ | ✅ Chunk per page |
Leptos | ✅ | ✅ | ❌ One single WASM bundle* |
Dioxus | ✅** | ✅ | ❌ One single WASM bundle* |
This is for sure something that will keep evolving over time, but I got inspired by this Hacker News post to share in more detail how I organize myself and my work (you can see my short answer here).
The question posed is great, so let’s start from there:
When working with a team, I've found that Scrum-like short-term goals and organized task backlogs really help keep me focused and on track with the work I have to do. For solo development, however, I've never really found any approach that sticks and often end up getting sidetracked and losing track of my objectives.
So my question to all of you is, what tools and techniques have you used to ensure you stick to your objectives?
You could rephrase this slightly to: How do I run my own project management?
For most Engineers, this is not actually something they’ve needed to do often, especially if working in larger corporations. The people that have worked at Startups are a mixed bag, where some learn the value of structure, and others managed to get by without since the fast-paced environment changes things around all the time anyways.
I’ve personally landed in the camp of: Structure is valuable, even crucial, but it should never get in my way. Best of both worlds sorta.
After having spent the better part of two months deep in the trenches of iOS development with Swift, I can comfortably say: Web Development simply is more mature.
Let’s just run over a few things I ran into that’s bad, broken, or made for a poor experience:
@Query
in your View
)Admittedly, these might be trivial gripes for someone that has spent years in the Mobile ecosystem, but they certainly didn’t make me fall in love with it. More importantly, it wasn’t really providing a great user experience either.
….so what’s the alternative?
This is a part of the post Mobile: A different way using Rust?.
There are some great resources out there on UniFFI already such as this post, but it doesn’t cover watchOS, so let’s take a quick tour through what I’ve set up in the example repository https://github.com/Tehnix/template-mobile-wasm.
We've set up four crates:
appy
: Our Leptos App, Capacitor, and the XCode projectcapacitor-rs
: Bridging code between the Capacitor JS library and our Rust codeshared
: Our shared code that we might use in appy
, and also want to expose in Swift to use in our Widgets or watchOS Appmobile
: Where we will generate the Swift bindings from via UniFFI, reexporting everything from shared
that’s made available to UniFFI via the macrosI won’t go over the details to get these to play nicely with Cargo and Workspaces, check out the repository for that. Let’s instead focus on a simplified version of what mobile
does (the rest assumes you’re in the mobile/
directory).
This is a part of the post Mobile: A different way using Rust?.
Capacitor is normally used in combination with JavaScript projects, so there is little help available if you want to use it in a Rust/WASM project. Worry not! That's exactly what we'll take a look at in this post.
Since Capacitor is a JS framework there will be a little extra work involved in interacting with any plugins, but it’s honestly not a lot we need to do. Let’s take a quick tour through what I’ve set up in the example repository https://github.com/Tehnix/template-mobile-wasm.
·
16. October 2023·
rust , typescript , wasm , nextjs , leptos , aws , cloud , infrastructure , cdk , ci
In the last post we set up our deployment, fully automated on merge to our main
branch. In this post we will be building our UI (Frontend) applications. See the full overview of posts here.
At the end of this post we will have:
We are essentially hedging our bets by building both a JavaScript-based Frontend, which is the safe bet, and a Rust/WASM-based Frontend, which is the future bet. We will be using the same GraphQL API for both, so we can easily switch between them.
There is quite a lot to cover. My recommendation is to clone down the Part 3 branch in the GitHub repository and use this post as an explanation of what is set up.
In the last post we created our Control Tower structure with all of our AWS Accounts in it. In this post we will be automating our deployment process for each of these environments. See the full overview of posts here.
At the end of this post we will have:
main
branch.If you want to jump straight to the code, you can find it in the GitHub repository which links directly to the Part 2 branch.
Otherwise, let's jump in!
In the last post we went over the overall goals of "The Stack" and what we will be building. In this post we'll be setting up our AWS Account structure. See the full overview of posts here.
As a reminder, here is the structure we are aiming for:
This will be a series of blog posts where we will build up the perfect infrastructure setup for the majority of usecase, aka "The Stack". We'll be building everything on top of AWS.
Before diving in, let's first establish some goals:
Obviously, this is my personal opinion on it, but I'll be sharing the thinking behind each of the choices as we go along.
Some technology choices upfront:
·
5. April 2020·
haskell , lens , javascript , typescript , rust , records , serde , aeson
A lot of web development is transforming JSON one way or another. In TypeScript/JavaScript, this is straightforward, since JSON is built into the language. But can we also achieve good ergonomics in Haskell and Rust?
Dear reader, I am glad you asked! 🙌
The comparisons we will see are not meant to show if one approach is better than another. Instead, it is intended to be a reference to become familiar with common patterns across multiple languages. Throughout this post, we will utilize several tools and libraries.
The core of working with JSON in Haskell and Rust is covered by:
The ergonomics is then improved in Haskell by grabbing one of the following options:
We'll go through typical use-cases seen in TypeScript/JavaScript codebases, and see how we can achieve the same in Haskell and Rust.
With Apple increasing their focus on making the iPad a viable device for work, it is time to revisit using my iPad as a workstation for programming.
I rely heavily on command-line tools and language-specific tools (rust-analyser, node, ghcide, etc.) for my day-to-day programming, and my current setup features:
On my computer, I use Visual Studio Code, and it's long been a wish to get that running somehow on my iPad. This is an attempt to make VS Code available on the iPad under the restrictions that we have to deal with.
Recently I was faced with the challenge of having to migrate a set of AWS DynamoDB tables to completely new tables. We wanted to achieve this without affecting any of our users, and without having a maintenance window while migrating data from the old table to the new ones.
The following will be a very high-level overview of how you:
A lot of progress has been going on to make Haskell work on mobile natively, instead of e.g. generating JavaScript via GHCJS and using that. Unfortunately, not much documentation exists yet on how to build a project using these tools all together.
This post will be an attempt to piece together the tools and various attempts into a coherent step-by-step guide. We will start by setting up the tools needed, and then build an iOS app that runs in both the simulator and on the device itself (i.e. a x86 build and an arm build).
If you want to grab the whole code from this post, it can be found at codetalkio/Haskell-Electron-app.
Not much literature exist on using Electron
as a GUI tool for Haskell development, so I thought I'd explore the space a little. Being initially a bit clueless on how Electron
would launch the Haskell web server, I was watching the Electron meetup talk by Mike Craig from Wagon HG (they use Electron
with Haskell) and noticed they actually mention it on the slides:
This seems to be an often asked question, so I thought I'd try and share the approach that I've arrived at after having explored a couple of solutions to the problem. If you want to see the full code in action, check out the repo for the codetalk.io site (linking to v1.0.0 is intended, in case the code changes later on).
In a recent thread on /r/haskell about how to motivate the AMP proposal in teaching, I read a comment that finally helped me understand the purpose of Functor
s, Applicative
s and Monad
s.
I have recently started caring a bit more about security on my AWS applications, and to this end Identity & Access Management (IAM) users are a great way to limit access to a need-to-use-only basis.
Recently I set up my IRC server to download its configuration and install files from an S3 bucket. This meant that it needed to have read access to a specific bucket, and for this an IAM role was created.
There are two ways to generate policies:
I will generally advise to either use the generator completely or at least use it for the basis of the policy you want to create.
Having recently discovered sameroom.io I wanted to update the codetalk IRC server to be compliant with their authentication method. This basically just meant enabling SASL
support, but while I was tinkering with stuff anyways, I thought I might as well streamline the setup process for the IRC server. In short, everything is fully automated and set up on AWS using EC2
and S3
.
This will go through the process of doing exactly that, by talking about:
Or really anywhere that https://pushover.net supports.
In light of the earlier article, I thought I'd might as well supercharge my IRC setup. So, now we're gonna get some notifications for our mobile devices via pushover.
So, if you're like me and like to have your IRC client (in this instance irssi) running on a server in a tmux
or screen
session to never miss out on the conversation, you might feel like you're missing some of the benefits of running a local IRC client.
In particular, I was missing local notifications when someone would highlight my nickname. I could of course use a bouncer, but hey! it's no fun running irssi
locally and having to close it for a reboot just as you've gotten it precisely the way you like it 🙂...
So, how does one solve this problem?
UPDATE: I wouldn't really recommend this approach anymore! Instead you should look into Docker for containerization and Stack for the Haskell side
I recently started looking into ways that I could improve my current deployment workflow. Since my server doesn't have much RAM, I currently build the binaries locally in a Virtual Machine (VM from here on out) and then send them to the server using scp
.
Although I can't do much about the server part (except buying a bigger server), I can do something about what I do locally. I set out to check what possibilities I had, and ended up looking at Vagrant.