90 days later: dj.exchange update

dayvonjersen 2023-08-13T22:32:00Z #programming

90 days worth of commits 90 days worth of commits

90 days later: dj.exchange update

I’m trying and failing to come up with a pun on “90-day Fiancé”

So I quit my job 3 months ago and have been working on this project.

i just need to finish this project

Time for an update, let’s see where we’re at.


I bought a server btw. Haven’t configured it yet…

server-in-a-box

I’ve been getting help and advice from winny. It’s good to finally be able to talk with someone about this project at a high level. He’s brought up a few questions I’ve struggled to answer, namely about deployments and what stack I’m using, so let’s clear that up.

Honestly the hardest part of working on this has been dealing with loneliness and self-doubt. I really can’t express how much it means to have at least one (1) person who believes in me. 💖

sorbet.webm

Right, so, sorbet is a monolithic web application written in Go. It has a few dependencies:

module sorbet

go 1.19

require (
        github.com/dayvonjersen/sadbox v0.0.0-20120828195626-27893f92b8ce
        github.com/dayvonjersen/vibrant v0.0.0-20230605224344-08d3d20033fc
        github.com/go-sql-driver/mysql v1.7.1
        github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
        golang.org/x/crypto v0.9.0
)

require github.com/russross/blackfriday v1.6.0 // indirect

idk what that indirect business is about

sorbet also comes with a C++ program that uses taglib to process audio file metadata. Previously I made a whole PHP extension to use taglib. The last iteration of sorbet was in PHP and so being able to call taglib from PHP made sense. Since I’m using Go now, my choices were either:

  1. Figure out how to use cgo

  2. Port taglib to Go

  3. Create a dependency on PHP for this project and use my extension

  4. Create a standalone binary that can do all the taglib operations sorbet needs to process audio file metadata.

I chose the last one. It’s a bit of a bikeshed/yakshave and a total disaster: a single 1217 line C++ file that can --read, --write, and --strip tags from audio files, using JSON for serialization.


You can’t make sorbet without an ice cream machine so there’s sorbetière, a microservice I made in 2016 that processes incoming uploaded files in order to create:

Originally, since they’re all command-line tools, I briefly considered using shell scripting to orchestrate all these things. I quickly realized however that I couldn’t just spawn a bunch of processes everytime a user uploads a file: that would blow up any computer with greater than say 10 concurrent requests. It wouldn’t scale! There were a few solutions I looked at, including GNU Parallel, to schedule and queue up tasks, but somehow I stumbled upon Rob Pike’s excellent “Concurrency Isn’t Parallelism” talk and when he gave the example of the load balancer I knew what the solution was.

I took his implementation of a load balancer wholesale from that talk and designed a program around it. The workFn are calls to exec.Command

This also solved another problem which was how to get a nice progress bar indicator for processing like soundcloud has.

Somehow I managed this feat without writing any tests. Yesterday winny and I solved an issue related to process exiting and error handling by writing one (1) test.


show me your stack bro

using mysql btw

Frontend. Joy.

I’m not using any frameworks like React or Angular even though there is a nagging voice in the back of my head that I really should be making a SPA.

This isn’t a SPA, it’s a website.

I am using some libraries:

And in the form of webcomponents:

And I wrote some JavaScript as well:

The CSS is all custom and based on designs/prototypes I made and/or stoleborrowed in a separate over-engineered frontend repo called sirupeuse

I’ve been copying code from sirupeuse into a style.css file and have largely eschewed BEM and Harry Roberts’ sage advice in exchange for moving fast and breaking hard.


an aside about webcomponents

I made music.dayvonjersen.com using Polymer 2.

Polymer was a webcomponents framework that introduced the concept of “everything is a (web)component”

I didn’t really take that concept to heart though, I am using webcomponents as widgets but not for overall “app” architecture

In fact I’m just using webcomponents like this:

<h1><ic-on>settings-user</ic-on>Account Settings</h1>
becomes:
<h1><svg><use xlink:href="/assets/icons.svg#settings-user"></use></svg>Account Settings</h1>

<input-text class="drop-shadow__text" name="email" value="me@dayvonjersen.com" required>E-Mail</input-text>
becomes:
<input type="text" class="drop-shadow__text" name="email" value="me@dayvonjersen.com" required>
<label class="drop-shadow__text">
    <span data-content="Email">Email</span>
</label>

Basically just “enhancing” plain HTML with encapsulated components.

I am however applying the “componentized” mindset to the HTML I return from the server, which often has custom <style> and <script> per-page for design and functionality.

…It’s a work in progress

Truth be told I haven’t made as much progress as I would’ve liked to by now, chalk that up to over-eager estimates or bouts of brainfog and procrastination, idk excuses.

I don’t want to set a date for when we go live, always prefered a “when it’s ready” approach

These things, they take time.

Basically I don’t want to launch with anything that’s buggy or clearly unfinished. I also think having payments from day 1 is crucial otherwise it’s just another place to host your music and that’s not solving the problem I want to solve which is giving unknown/obscure, unsigned, undiscovered artists a platform to sell their music directly to the people looking for that kind of music.

So yeah I’ve got lots of work to do still, I hope you’ll join me when it’s ready :)

Leave your email on https://dj.exchange for an invite when the site goes live!

-day 2023-08-13 6:16:53 PM

A little history

I first had the idea for “a soundcloud clone” in 2009. Up until then the only software I made were some clones of the GameFAQs forums and an FTP proxy all of which were PHP.

Soundcloud was a neat site but I found myself hitting the limits of a free account pretty easily and rather than pay the $70/year for pro I thought hey why not make a clone I’ve made clones before

As I planned what I would need to do I started to let my ideas grow and grow. I was inspired by private torrent sites like oink.me and what.cd. I wanted proper tagging. I was inspired by discogs. I wanted support for artist groups and aliases (multiple artist profiles). And I was inspired by beatport: a site full of music should double up as a storefront.

When I got to that point, my mentor at the time suggested just making a bandcamp account and putting my music there.

An ancillary goal was to put all of my music online. I did that later with music.dayvonjersen.com but we’re getting off-topic.

So at first I didn’t have a plan. Some rough HTML/CSS mockups. I knew right away I didn’t want to do this in PHP.

So I picked up Rails but I didn’t really get it. I didn’t like having to use an ORM when my grasp of SQL was pretty good. This project was quickly abandoned.

I paused and made Bunzilla to get back up to speed with PHP

I picked up Go, made a bunch of shit

This second incarnation (in PHP instead of Rails) was looking to be it. At some point I psyched myself out of it and realized what I really wanted was a catalog of all my tracks, so I made music.dayvonjersen.com.

Which kinda sucked the momentum out of building a platform as now I didn’t really have a reason to do it. So I stopped for a while.

Then I had a dream and made citrus.audio

Then that fell apart and I gave up for a while.

But it’s always been in the back of my mind.

I knew if I was going to try again I’d do it all in Go.

I had the building blocks:

plus functionality to steal from

And but so these past 90 days have been mostly taking blobs of code and smashing it all together worse-is-better style.

What I’m omitting and where I lost so much time is to life. work and shit.

Life is what happens when you’re making other plans, I guess

I never fully appreciated how much work is required to make this thing and tbh I didn’t have the coding skill until I made a bunch of other unrelated shit like IRC client, gaem, tiger, etc etc

Now I’m poised to do it for real this time™ but I am out of the flow of programming regularly and it’s a hard habit to stick to. Context-switching is a mofo and it’s a lot easier to write hundreds of lines of code than debug any of it for a one-line change.

Programming is not something I enjoy doing. for me it’s always been a means to an end. I enjoy building cool shit that I want to use.

blog within a blog, I probably should have published this separately but meh -day 2023-08-13 6:31:22 PM