Why I made an Arch Linux Package API
Archnite#
Why?#
Last summer, I switched to Linux as my primary OS for development, specifically picking Arch Linux (Just for fun to be honest, any other distro would’ve been fine). I’ve been using Arch Linux since then and have been enjoying it, however I faced an issue while setting up a new system. I was forgetting exact package names. I decided that I wanted to make a simple search tool where I could use type-ahead/autocomplete search to look up packages. I knew that there was an API for official Arch packages that I could try to use in order to make my tool. However, I faced 2 issues:
- The official Arch JSON API was very slow, taking multiple seconds to load package results.
- There was no API that I could find for AUR packages (The AUR is the Arch User Repository; a community maintained package repository with nearly 100,000 packages, and one of the main reasons I use Arch Linux).
So I decided that I instead needed to create an API for both Arch official and AUR packages in order to build my client. I know this seems excessive for a small issue, but it seemed like a good test of my skills as well as a fun project.
Tech Stack#
The tech stack I used for the project is as follows:
- PostgreSQL was my database of choice, used to store package metadata to be fetched by my API. I learned about using a trigram index in order to make incremental (autocomplete) search possible.
- Go was used for its simple concurrency and efficiency in order to automatically fetch new package metadata every hour and populate the database.
- Java & Spring Boot were used to build the JSON REST API which would fetch package metadata from the database and provide different routes to interact with the data, the most important one being the search route.
- TypeScript & Angular was used to build a simple search client that consumes the API.
- Docker & Docker Compose were used for containerization and deployment
Deployment is Live#
I’m proud to say that I’ve recently finalized and completed the project, which I decided to call Archnite.
Both the client & API are now deployed. I used Docker & Docker Compose along with GitHub Actions to setup a CI/CD pipeline to deploy my app to a Linux virtual private server, completely from scratch. No Platform-as-a-Service or automatic deployment services were used.
The client is deployed at https://archnite.omarashraf.dev & the API at https://api.archnite.omarashraf.dev (Check the API documentation in the GitHub repo to learn more). The source code is public and available on GitHub here.
What’s next?#
Now that I’ve finished most of what I wanted to accomplish with Archnite, the next step is thinking about some possible projects I can tackle next. I have some ideas, mainly either a minimal alarm clock mobile app to help me get out of bed (would actually be very useful for me), or maybe a fancy CLI tool with Go & Bubbletea.
Another possible fun idea I’ve had is making a full-stack chat app with Go, however I already did a web development project with Archnite and we’re working on another one in university, so maybe I’ll delay the chat app until after I finish a couple of projects in other domains.
Back to the mobile app, I’ll need to figure out if I want to either:
- Use cross platform tech like React Native or Flutter so I can easily release it for IOS and Android.
- Go native and just stick to an Android release, most likely using Kotlin & Jetpack Compose.
Maybe I’ll write a post discussing my thought process and what I end up choosing if I end up making the mobile app and not a Go app.