
Ask HN: “Write your own” or “Build your own” software projects - n_t
I am looking for writings&#x2F;tutorials&#x2F;videos which describe a specific technology or feature by implementing them, ideally in no more than few thousands lines of code (and not just 10-20 line code snippets). Idea is to teach about underlying technology by a hands-on project, which is not overwhelming like trying to implement full-feature game engine and yet captures the essence of technology. Some examples are -<p>* Build a simple database (https:&#x2F;&#x2F;cstack.github.io&#x2F;db_tutorial&#x2F;)<p>* Containers in 500 lines (https:&#x2F;&#x2F;blog.lizzie.io&#x2F;linux-containers-in-500-loc.html)<p>* Malloc tutorial (https:&#x2F;&#x2F;danluu.com&#x2F;malloc-tutorial&#x2F;)<p>* Nativecoin - build your own crypto-currency (https:&#x2F;&#x2F;lhartikk.github.io&#x2F;)<p>I&#x27;m sure there are great such projects&#x2F;tutorials in domains like networking, filesystem, databases, compiler, web design, messaging, game design, fintech, etc. If you have come across such writings&#x2F;projects, kindly share.
======
tarmstrong
"500 Lines or Less" is an entire book of articles just like this. Each chapter
guides you through a small (500 loc or less) implementation of a common
component (eg a web server).
[http://aosabook.org/en/index.html](http://aosabook.org/en/index.html)

~~~
e12e
Came here to say this. Also; the other books in the series are interesting.

~~~
e12e
On a related note, I just became aware of hitch, 2nd generation stud(?) - a
real-world, modern, high performance proxy server:

[https://hitch-tls.org/](https://hitch-tls.org/)

~~~
teej
This is the first generation stud project -
[https://github.com/bumptech/stud](https://github.com/bumptech/stud)

------
herbstein
It's still very early days, but Bitwise is interesting
([https://github.com/pervognsen/bitwise](https://github.com/pervognsen/bitwise))

There's also Handmade Hero
([https://handmadehero.org/](https://handmadehero.org/))

The Raytracing books by Peter Shirley are also very interesting, starting with
"Raytracing in one weekend" ([https://www.amazon.com/Ray-Tracing-Weekend-
Minibooks-Book-eb...](https://www.amazon.com/Ray-Tracing-Weekend-Minibooks-
Book-
ebook/dp/B01B5AODD8/ref=sr_1_1?ie=UTF8&qid=1521122179&sr=8-1&keywords=raytracing+in+one+weekend))

And lastly there's Crafting Interpreters
([http://www.craftinginterpreters.com/](http://www.craftinginterpreters.com/))

~~~
abhishekjha
I am following bitwise very closely, particularly to get better at C. Any
companion text/resource that I should follow along?

~~~
jeffreyrogers
NAND to Tetris[0] has similar goals, but is probably significantly different
in terms of implementation that it's only helpful to explain the concepts.

[0]: [http://nand2tetris.org/](http://nand2tetris.org/)

------
k2052
Build Your Own React
[https://github.com/hexacta/didact](https://github.com/hexacta/didact)

Create Your Own Programming Language
[http://createyourproglang.com/](http://createyourproglang.com/)

Build Your Own Sinatra: [https://getgood.at/build-your-
own/sinatra](https://getgood.at/build-your-own/sinatra) (disclaimer: I'm the
author of this)

Vanilla JS series [https://javascript30.com/](https://javascript30.com/)

Super Tiny Compiler [https://github.com/jamiebuilds/the-super-tiny-
compiler](https://github.com/jamiebuilds/the-super-tiny-compiler)

------
badosu
I've programmed my own simple synthesizer [1] by following along "The Audio
Programming Book" [0].

It gives a concise explanation for the techniques and theories for signal
processing while showing practical code examples.

[0]: [https://mitpress.mit.edu/books/audio-programming-
book](https://mitpress.mit.edu/books/audio-programming-book)

[1]:
[https://github.com/badosu/sine_synth.lv2](https://github.com/badosu/sine_synth.lv2)

~~~
n_t
This looks like much more involved and longer project. But still I'll get your
book, looks very interesting :)

------
otras
I worked through most of this tutorial on building a simple text editor in C
and greatly enjoyed it. Highly recommend it!

[https://viewsourcecode.org/snaptoken/kilo/](https://viewsourcecode.org/snaptoken/kilo/)

~~~
_diyu
Not just a basic one either, it had syntax highlighting! I always thought that
was a pretty involved and complex feature, but it's simplified and demystified
here.

------
acemarke
I've got a bunch of "Build a mini React" [0] and "Build a mini Redux" [1]
articles referenced in my React/Redux links list. I particularly recommend the
"Didact: a DIY guide to build your own React" post series [2] and "Build
Yourself a Redux" [3].

[0] [https://github.com/markerikson/react-redux-
links/blob/master...](https://github.com/markerikson/react-redux-
links/blob/master/react-implementation.md#miniature-react-implementations)

[1] [https://github.com/markerikson/react-redux-
links/blob/master...](https://github.com/markerikson/react-redux-
links/blob/master/redux-tutorials.md#redux-implementation-walkthroughs)

[2] [https://engineering.hexacta.com/didact-learning-how-react-
wo...](https://engineering.hexacta.com/didact-learning-how-react-works-by-
building-it-from-scratch-51007984e5c5)

[3] [https://zapier.com/engineering/how-to-build-
redux/](https://zapier.com/engineering/how-to-build-redux/)

------
pootsbook
This describes the purpose of the (paid) resource available at “The Great Code
Club” [1].

Marc-André Cournoyer has put together several different projects: \- 2D/3D
Game \- Database Engine \- Virtual Machine \- Backend + Frontend Framework \-
Neural Network \- Language \- Server \- Real-Time Web Engine

Full Disclosure: I am a happy customer of Marc Andre’s “Owning Rails” [2]
workshop. No other affiliation.

[1] [http://www.greatcodeclub.com](http://www.greatcodeclub.com) [2]
[http://owningrails.com](http://owningrails.com)

~~~
n_t
Very nice! These days think of something and someone somewhere has not just
thought about it already but also making money out of it :)

------
harlanji
I built a live streaming system with VoD constrained to RasPi+CDN with minimal
code in a few weeks, fully FLOSS and offline capable. All design and hours of
live hacking are online, comparison here:
[https://ispooge.com/2018-03-14-video-platforms-
compared.html](https://ispooge.com/2018-03-14-video-platforms-compared.html)
lmk if you want specifics — tutorials being produced on tinydatacenter.com. I
am documenting as I learn, given I have no background in vid nor feature list
in mind.

Tldr: all you need to make your own scalable Twitch without coding (but with
patience). It’s a <2mo old so feedback appreciated, but my live vlog has been
going strong for weeks and syndicating to 4+ other networks.

------
runevault
MAL (Make a Lisp) is a good one around building a lisp.

[https://github.com/kanaka/mal](https://github.com/kanaka/mal)

Lots of examples across 72 languages.

------
nogridbag
Came across this website some time ago:

The Architecture of Open Source Applications

500 Lines or Less

[http://aosabook.org/en/index.html](http://aosabook.org/en/index.html)

~~~
agentultra
I know some of the people behind that book. It's a very interesting take on
the craft of programming. I highly recommend it.

------
3pt14159
I know it isn't quite what you're asking for, but I recommend writing a static
site compiler from scratch for a static site you actually use. Buy a nice HTML
/ CSS template (I found this one
[https://html5up.net/story](https://html5up.net/story) then modified it) and
build yourself a nice personal site from scratch.

You'll be surprised at how nice it is to just fully understand everything
without a mess of libraries getting in the way and the resulting project will
be perfectly tailored to your needs.

------
zaarn
I recommend the interpreter book
[[https://interpreterbook.com/](https://interpreterbook.com/)], which isn't
entirely free of charge however.

On the other hand, it was enough to get me off the ground for my lexer and
write a parser that wasn't entirely dumb.

~~~
misternugget
As the author of the mentioned book I just want to add that I specifically
wrote it because I'm also a huge fan of the technical writings the author is
looking for: from the ground up, all code shown, no toys and shortcuts,
capturing the essence in a few thousand lines.

And just FYI, the interpreter we build in the book ends up with ~3900 lines,
including the full test suite.

~~~
zaarn
I think I'm atm at around 2500 lines, of which the parser and lexer is
probably about 1200 lines. I mostly ~~stole~~ used the lexer from the book as
inspiration for my own and then rolled a LISP-like language from there (which
is rather easy given that a LISP AST is simple in nature)

------
brudgers
Building a Modern Computer from First Principles
[http://nand2tetris.org/](http://nand2tetris.org/)

~~~
n_t
It certainly is a good course and I recommend it too. However, this is a full-
fledged class requiring many weeks instead of few hours or days.

~~~
SilasX
I was on the fence about whether to suggest it, but I don't think you should
dismiss it as being a weeks-long course.

Instead, think of it as 12 mostly-independent projects implementing a small
part of a computer's functionality: the set of logical gates, the ALU, the
CPU, the computer hardware, the assembler, assembly programming, stack op
implementation, a compiler, and and OS. Any one of those will be only a few
days.

(I'm in the middle of the Coursera course for it and have done 1-5 and 7-10.)

[http://www.nand2tetris.org/course.php](http://www.nand2tetris.org/course.php)

It only has up to chapter 6 online, but there's an old version of the book
available for free but I don't have the link handy.

------
perlgeek
"Let's Build a Compiler" by Crenshaw:
[https://compilers.iecc.com/crenshaw/](https://compilers.iecc.com/crenshaw/)

It's an old classic, using somewhat outdated technologies, but there are more
moderns versions floating around, for example a C + x86 one:
[https://github.com/lotabout/Let-s-build-a-
compiler](https://github.com/lotabout/Let-s-build-a-compiler)

------
doughj3
The "Getting Started with Redux" course on egghead.io, from Dan Abramov,
developer of Redux, basically has you write Redux from scratch to learn how it
works:

[https://egghead.io/courses/getting-started-with-
redux](https://egghead.io/courses/getting-started-with-redux)

------
limedaring
I wrote _Hello Web App_ to teach Django + Python web app development by
talking readers through creating a unique project (using a project template
described in the tutorial): [https://hellowebbooks.com/learn-
django](https://hellowebbooks.com/learn-django)

I'm actually fundraising for the new edition of the book, updated for
Python3+Django2.0: [https://www.kickstarter.com/projects/1868398473/hello-web-
ap...](https://www.kickstarter.com/projects/1868398473/hello-web-app-20-build-
your-first-web-app-with-dja)

~~~
gt_
If this were available right now, I would likely buy it! I am tasked with
learning Django in the next couple of weeks.

This got me realizing that I usually purchase and consume tutorials on an as-
needed basis and I usually want to start right away. I used to collect them
but found it wasn’t very optimal because when I found the time to do the
learning, I wanted something a little different. For what it’s worth, I don’t
think your Kickstarter numbers would account for people like myself.

------
jonjacky
Here is a Javascript program that implements the basics of the git version
control system. It is a literate program with a prose explanation in side-by-
side format:

[http://gitlet.maryrosecook.com/docs/gitlet.html](http://gitlet.maryrosecook.com/docs/gitlet.html)

Here is another side-by-side example. It is a Python program that implements a
very simple interpreter for the Lisp programming language.

[http://khamidou.com/compilers/lisp.py/](http://khamidou.com/compilers/lisp.py/)

------
gunnihinn
Build your own really shitty Redis. Then make it less shitty.

A really shitty Redis/HTTP can be built in around 100 lines in many languages
(assuming the language stdlib helps you out a bit -- Python, Go, Clojure would
all fit).

The fun begins when you make a concentrated effort into making it less shitty.
What tradeoffs will you make to what gain? It's a fun space to explore.

------
dochtman
Take a look at Gary Bernhardt's From Scratch series:

[https://www.destroyallsoftware.com/screencasts/catalog](https://www.destroyallsoftware.com/screencasts/catalog)

Not free, but very good.

~~~
msangi
They are great. Currently the 'A compiler from scratch' episode is free to
watch in case you want to have a preview

------
tmoreton
'How to Build Tinder with React Native & Expo' It's a bit longer and more
complex than what your asking for but I just finished building out a course
learning React Native & Expo by building a Tinder clone
[https://www.udemy.com/how-to-build-
tinder/?couponCode=LEARNR...](https://www.udemy.com/how-to-build-
tinder/?couponCode=LEARNREACT)

------
cweagans
Not my project, but Writing An Interpreter in Go is excellent:
[https://interpreterbook.com/](https://interpreterbook.com/)

------
jventura
Lots of good stuff already in the comments! Here are some examples/tutorials I
wrote on my blog:

\- A TDD approach for building a simple microprocessor model in Python:
[http://joaoventura.net/blog/2017/simple-
microprocessor/](http://joaoventura.net/blog/2017/simple-microprocessor/)

\- Building a basic HTTP Server from scratch in Python:
[http://joaoventura.net/blog/2017/python-
webserver/](http://joaoventura.net/blog/2017/python-webserver/)

------
dmytrish
Redox OS has `orbutils`, a bunch of simplistic GUI utilites written in Rust
and somewhat cross-platform (it's possible to build and run them on other
platforms) [0].

The most interesting and educational one for me is `browser`, which crudely
shows web pages and is written in less than a thousand lines of Rust from
scratch.

[0] [https://github.com/redox-
os/orbutils/tree/6764004b9f6f386af1...](https://github.com/redox-
os/orbutils/tree/6764004b9f6f386af17031d302430a89057ba77e/src)

------
agentultra
I enjoyed
[https://viewsourcecode.org/snaptoken/kilo/](https://viewsourcecode.org/snaptoken/kilo/)
and [http://www.buildyourownlisp.com/](http://www.buildyourownlisp.com/)

------
sedzia
A series on building modern business apps
[https://www.voucherify.io/blog/building-an-online-
marketplac...](https://www.voucherify.io/blog/building-an-online-marketplace-
from-scratch-introduction)

------
_diyu
Writing a garbage collector

[http://journal.stuffwithstuff.com/2013/12/08/babys-first-
gar...](http://journal.stuffwithstuff.com/2013/12/08/babys-first-garbage-
collector/)

------
gkya
There is the famous Linux From Scratch [1] which teaches how to build a
functioning GNU Linux system from the grounds up.

[1] [http://www.linuxfromscratch.org/](http://www.linuxfromscratch.org/)

------
cweagans
I started an awesome list with the content from this discussion:
[https://github.com/cweagans/awesome-diy-
software](https://github.com/cweagans/awesome-diy-software)

------
chown
Writing a full-featured multi-tenant web app from scratch:
[https://medium.com/@ashokgelal/writing-a-full-featured-
multi...](https://medium.com/@ashokgelal/writing-a-full-featured-multi-tenant-
laravel-app-from-scratch-a0e1a7350d9d)

------
perlgeek
A pretty concise regex engine, along with the explanation:
[https://www.cs.princeton.edu/courses/archive/spr09/cos333/be...](https://www.cs.princeton.edu/courses/archive/spr09/cos333/beautiful.html)

------
methyl
Build your own React
([https://github.com/hexacta/didact](https://github.com/hexacta/didact)).

------
hugja
There's a Github repo[1] with a collection of project based tutorials.

1\. [https://github.com/tuvtran/project-based-
learning](https://github.com/tuvtran/project-based-learning)

------
reacweb
I think building a web server is a good way to learn (teach) HTTP protocol.

------
ccajas
Write your own software renderer, and learn how the principles of computer
rendering work:
[https://github.com/ssloy/tinyrenderer](https://github.com/ssloy/tinyrenderer)

The wiki has lessons in detail:
[https://github.com/ssloy/tinyrenderer/wiki/Lesson-1:-Bresenh...](https://github.com/ssloy/tinyrenderer/wiki/Lesson-1:-Bresenham%E2%80%99s-Line-
Drawing-Algorithm)

------
billconan
Implementing a Key-Value Store

[http://codecapsule.com/2012/11/07/implementing-a-key-
value-s...](http://codecapsule.com/2012/11/07/implementing-a-key-value-store-
part-1-what-are-key-value-stores-and-why-implement-one/)

Let's Make a Voxel Engine

[https://sites.google.com/site/letsmakeavoxelengine/](https://sites.google.com/site/letsmakeavoxelengine/)

------
citeguised
This Tutorial shows how to create a full game (Asteroids-Like) with Love2D and
Lua. The game itself is available on Steam. The course is free, and you can
pay to get the full source code and the solutions to the tasks. Doing it right
now, about halfway through. Really engaging and interesting so far.

[https://github.com/SSYGEN/blog/issues/30](https://github.com/SSYGEN/blog/issues/30)

------
slaydemons
Request: Build a JVM (java virtual machine)

~~~
n_t
JVM might be much more involved project but here is a simple virtual machine -
[https://github.com/skx/simple.vm](https://github.com/skx/simple.vm)

~~~
stevekemp
That's my project, and it seems to be surprisingly popular, yet something I've
never really received any feedback on.

At the time I wrote it I was modeling the opcodes on the Z80, but I guess I
simplified once I'd got it working enough to make myself happy. (Lots of toy-
virtual machines, of which this definitely is one, don't implement labels or
"decompilers".)

------
nimblegorilla
Unity's roll-a-ball tutorial is pretty good for starting out with their IDE
and also gives some decent exposure to C# basics.

[https://unity3d.com/learn/tutorials/s/roll-ball-
tutorial](https://unity3d.com/learn/tutorials/s/roll-ball-tutorial)

------
murkle
This is properly hands-on as you have to make something :)
[http://www.technoblogy.com/show?NMX](http://www.technoblogy.com/show?NMX)

Click on the ATTiny85 tag for more projects. I've made / adapted quite a few
of those. Great fun and challenging!

------
kzisme
So with these sort of tutorials/guides is it generally a good practice to
build on extra functionality to learn more?

I always feel like it's too much hand holding, or I'm just copying/re-building
the wheel and not learning enough, but I do very much enjoy them.

~~~
badtuple
Always a good idea! Another thing is to CONSTANTLY question what the article
is having you do. Try to disprove rationale given and think of alternative
paths. Almost in a playful devil's advocate way.

As the project progresses you'll get more context on why things are what they
are than is explicitly written. Eventually you'll hit on something that
actually is better and now you're a what-the-article-teaches developer!

------
wespiser_2018
Write You A Scheme, Version 2: [https://github.com/write-you-a-
scheme-v2/scheme](https://github.com/write-you-a-scheme-v2/scheme)

Use Haskell to write a Scheme!

------
OddEssay
"Write Yourself a Roguelike" is an Open Source project that started as a ebook
by a former Thoughtbot employee. [https://github.com/thoughtbot/write-
yourself-a-roguelike](https://github.com/thoughtbot/write-yourself-a-
roguelike)

It's very much still in progress, but certainly fits the brief.

------
swyx
This guide to Build Your Own React is great and even includes React Fiber.
well worth it.
[https://github.com/hexacta/didact](https://github.com/hexacta/didact)

------
emeraldd
One of my favorites: [http://peter.michaux.ca/articles/scheme-from-scratch-
introdu...](http://peter.michaux.ca/articles/scheme-from-scratch-introduction)

------
oblosys
Before switching to React, I learned a lot about Angular from
[https://teropa.info/build-your-own-angular/](https://teropa.info/build-your-
own-angular/)

------
arjbah
'Write your own Operating System' by tuhdo

[https://github.com/tuhdo/os01](https://github.com/tuhdo/os01)

