Better Programming

Advice for programmers.

Follow publication

Member-only story

Time to Split Your Monorepo? Our Take on Structuring Web3 Project

Břetislav Hájek
Better Programming
Published in
4 min readApr 25, 2022

First things first, I think it’s totally fine to put all code into one place, especially at the start of the project. Just get things done. Don’t overcomplicate it. However, eventually, things get complicated. Dealing with smart contracts is tricky because once deployed, they are out there, and updating isn’t always easy. Moreover, other parts of your dApp need a contract code to interact with them. This article will present our code structure used in FELToken, which will hopefully make things scalable and easy to maintain.

Main Components

Each dApp usually consists of 2 main components: smart contracts and a web application communicating with them. Often additional libraries are communicating with smart contracts as well. To interact with smart contracts, you always need the contract’s address and ABI.

Dependency structure of most of the Web3 applications.

The dependency structure isn’t complicated. All components depend on smart contracts that store deployment addresses and contract’s ABI.

Why not Monorepo?

Looking at the above structure, it’s clear that we will have to handle the exchange of necessary files if we split the components. So why would we want to separate things? Why go through this extra struggle while we can keep everything in one place?

The biggest case against monorepo is probably the versioning. If we update one component, we often have to update other parts as well. We either have to always make large updates at once or get used to the fact that often things are broken in our main branch. When more people start contributing, this becomes an issue because we need a working project for testing things.

Moreover, different components have often different versioning cycles, e.g. smart contracts usually don’t go through as many updates as a web application. Keeping everything in one place makes it difficult to differentiate between these updates.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Břetislav Hájek
Břetislav Hájek

Written by Břetislav Hájek

Programming | Machine Learning | Blockchain | PhD student | Building start-up: feltoken.ai | Follow for weekly stories/tutorials from the start-up journey.

Write a response