I learned a valuable lesson that day: Build it when you really need it. It's highly likely that you will never need it.
Bonus points if it is something complicated that needs to be repeated occasionally.
If it is something that needs half an hour reasearch and careful treading before getting the desired result and it costs you basically zero to save it in a script, just do it.
Then wrapping my head around monster script is additional work I need to do on top of understanding system that is changed.
I argue that it might be quicker to understand system on its own and make changes manually than rely on someone else script.
In the end if script works it works time money saved - when it breaks it is more work and now there are 2 things one has to figure out.
That is why I'd rather have smaller scripts that do parts of bigger job instead of someone dropping "just run this and it will do everything for you" type of scripts.
No, your in house scripts are not documentation, because they provide little context or rationale. In many cases they make the system more opaque by masking fundamental admin actions inside poorly commented wrappers.
There is no substitute for well written documentation
Also the time spent building the first tool probably includes a quantity of "overhead" (auth, logging, etc.) which gets quickly amortised on subsequent tools.
Not writing the admin tool might save time in the short term. But as I'm serving you with reports from the database and changes directly in it, I'm not doing other productive work. So you get the reports sooner and the time it takes to give you one is pretty quick.
But that task could have been done by you if you knew SQL. Or a junior programmer. Or by the admin tool.
And I could have spent that time developing customer features (or the admin tool.)
If manually providing reports uses up a lot of your time, you can always build the admin tool. But if you build a tool that no one ends up needing, or if building it takes more time than you save, you can’t exactly un-build it and get your time back.
I think the point at which we differ is that I actually prefer the "Oh #&@$ Solution". Part of it is to avoid building tools that I never end up using. But even if I do use a tool a lot, I would still rather slow development later rather than sooner.
For example, I'm the only engineer, building an admin tool means product development stops, whereas if I wait until we've hired another engineer it means it only slows down by 50%. Or, if we only have a few months of runway, it's much more valuable for me to work on things that increase revenue or decrease costs in terms of actual dollars than things that make the company more efficient.
Obviously these are contrived examples, but the general theme here is that time now is more valuable than time later. So the further into the future something is expected to pay off, the more suspicious of it you should be.
Source: I am writing three services at this point that are mostly Middleware to deal with the lack of native federation for certain services we use.
Building an authenticated admin UI for something is a lot of work.
Adding a "see most recent orders" page to an existing admin UI can take just a few minutes, once that framework is in place.
That said — if I’m just looking at data, it usually takes me a pretty long time to outgrow poking around the database with a read-only user.
This take is correct IMO - it's only worth building a tool if it saves you more time than it takes to develop. This is why Retool exists - if building/changing an admin tool takes about as much time as assembling a Keynote presentation, then the economics of using custom software to solve small problems start to work out in your favor.
I loved building tools and did it to get better/ faster at writing scripts and/or for fun eg trying to solve puzzles.
I would try and write tools/ scripts for anything
This helped me to get faster at writing tools - to the point where I automated a large porportion of my job - allowing me to spend more time on working on the stuff I liked - leading to me moving away from Admin
my own name for this rule of thumb. based on the story about the MIT campus where they put in grass but no sidewalks, and then waited to see what kind of natural trails formed from natural walking and biking. then put sidewalks there
some of these tasks when caused by human error the better idea is to make it more difficult to break the system than just easier to fix it and allowing the user or admin to fix it on their own hides the issues away
One thing the time-based framework doesn’t account for is the mental energy you could save.
A small example: I sell a software product, and every now and then someone would ask for an invoice. So I’d have to look up the order, copy an ID and an email, make a PDF, and email it over. Was it hard? No, it took 2 minutes. But I loathed doing it.
So I wrote a little invoice page that looks up their order and let’s them put in whatever info they need, and generates a PDF. It took a day or two. I’m 99% sure this will never ever pay off in terms of time savings, but it gives me great joy to know that I will never have to do that energy-sapping task again.
Let's say there is some weird service that you sometimes need to manually restart in a very specific order for maintenance. The hard (time intensive) task is figuring out the right incantations and the order to do it. It is however not time intesive at all to store those incantations in a shell script.
So not saving that in a script risks you (or a co-worker) having to go through this again, potentially missing some important aspect and wasting time and energy.
If you are using Django and not building out admin tools as you go you are doing it wrong.
The other thing touched on in this post is audit trails. I now tend to create a "{model}Log" model for the "key" models in an application, fairly basic with a JSON column. So for a shop, the products, basket, orders, etc. Then aggressively log to it all and any actions that happen, both internal stuff and external API calls (requests and responses). I make this log visible in the admin on the page for each of the key models. It makes digging into what is happening so much easer for everyone.
If you eventually find you are logging too much, just turn it down.
I do however very much see there bing two layers to admin tools, the first being the visibility, CRUD, audit tools. The second layer of tools for specific actions (e.g. compiling with GDPR removal requests) can make sense to wait until you have experienced doing it manually a few times to understand the problem better. But even then, it's better to build as soon as you have that knowledge.
A big part of administering your end users is having staff be able to "see" what is going on w/ the user (i.e. a dashboard for user and all user related objects, like what company they belong to, money, products, purchases etc). But it's weird that the viewing page is also the editing page.
The trick is to implement these methods on your ModelAdmin subclass: https://docs.djangoproject.com/en/4.1/ref/contrib/admin/#dja...
You can make has_add_permission(), has_change_permission() and has_delete_permission() all return False, while has_view_permission() returns True.
The readonly_fields and related get_readonly_fields() method are very useful too.
I wrote up another related trick in this TIL: https://til.simonwillison.net/django/extra-read-only-admin-i...
+1 on ActiveAdmin. We recently switched from Rails to Django and AA is something I'm severely missing. The DSL is terrribbblee but once you learn it, omg so fast to do anything.
So to define a admin you just add a GROUP_NAME node called "ADMIN" to a user, pretty simple but not very fun when you need to find all admins.
It's the first and last admin interface I will ever do, since then I just hot deploy my hardcoded changes or edit the raw data instead.
Can someone from a larger dev team speak to whether you still find yourself spending time building/improving admin tools like this?
Even at a small size (a dozen or even fewer devs) I recommend doing what it takes for anything besides true one-offs to go through admin tools.
In general, I find that office staff want to be able to solve their own problems and will appreciate you giving them the tools to do it.
- Set a monthly meeting with a co-worker from each functional area (e.g. finance, support, sales). The meeting should be run by whomever has the best horizontal view of needs across the business, along with whoever is running point on development to clarify things.
- Go around the room and ask the question, "What's one thing (report/tool/insight/data/etc) that would make your job easier?"
- Track those requests on a shared document or board, giving stakeholders an opportunity to reprioritize their list (should never be more than a "top 3") each meeting
- PUNCHLINE: Commit to addressing one item from each department's top 3 every quarter. We did this starting early with engineer #2, but if you can't devote a FTE, divide and conquer among your current team.
10+ years later we have dozens of internal tools that have automated so much of what I see bigco still addressing by throwing people at it. It's never too late to start and it's a great way to build a love affair between your non-technical departments and developers!
Ask a stakeholder (e.g. contract renewals team) to create an ideal report with maybe 5 rows of sample data in Google Sheets / Excel. A good example may be a list of customers, when their next renewal date is, who their sales rep is, etc. Ask a developer to turn it into a real-time (or nightly updated) internal web page, then once again, each quarter see if it needs to be made better. Sure, Salesforce and the like should have a lot of this data, but odds are you need a hybrid of info that leverages your own DB (e.g. usage, # of users). If a new vanilla Salesforce report comes out of that monthly meeting instead, hey, still good stuff.
We call this team "Ops" for short and more formally the "SaaS Operations" team since they satisfy all the internal bits that get help us run an efficient SaaS business. For reference, while we have a small team, it's 20% of our headcount (and a great place for interns/co-ops). Happy staff with the right tools stick around longer, are better at serving customers, and have more free time to work on more important goals.
This is incredibly hard to do, and nearly impossible to scale, but we need to go there.
In the short term one can look at Mastodon, which decentralizes the authority. It's messy but it sort of works.
To be able to remove the admin in Mastodon we would need to change laws since nobody would host a server that they cannot delete illegal content from.
Thinking about these things opens doors to understanding the absurdity of our current society.
In the end: to think that you can control anything is an illusion of energy abundance, and since we are running out of coal, oil and gas; my intuition tells me authority is going to dwindle slowly, then fast and finally all at once.
Thus, my conclusion is: don't build admin interfaces. :D
Adding to this the source-available economy that is the last step in our modern stack, needs user generated/hosted/owned content. So I think moderation tools needs to be less energy intense than manual.
My only solution so far is pride/shame, like hn; so you attach a pseudonym to things: after all that is how communities have worked since we started naming people.
Also there’s going to be something analogous to PMF for the tools themselves. Beyond CRUD, which is already trivial with most backends, you won’t really know what advanced admin tool features are needed until you’re servicing support requests.
On early stage products it’s very possible you’ll switch backends at some point. Most recently I had a POC using Redis (for reasons) and if I’d written any admin tools instead of just using the CLI, it would have been 100% thrown away when I migrated to Cloudflare Workers.
In fact, the very existence of this whining is possible because competitors got beaten, clients got their edge cases hacked in, low cost employees rushed the MVC etc... It's part of life and I now learned to enjoy it and complain too, while mad rushing stuff to avoid losing a big client...
I wish money was no object, competitors helped instead of fucking us, client had patience, taxes were low, engineers were cheap. But it isnt so yet.
But still can't find a generic Admin generator/Crud tool for standard REST APIs or GraphQL
Even Retool/Budibase force you to build countless connectors/queries for each resource.
I'd pay $$$ for something that could parse my Graphql API SDL and generate an admin UI for me!
The best approach is to re-use the existing setup e.g. hook into existing observability ecosystem instead of building your own from scratch. If support needs to execute something frequently, question if that can be done via any existing orchestrator like Tidal or Autosys etc. If that is insufficient, maybe a dashboard is more manageable since it is server-side. If you see that you are building such dashboards for each of the services, they maybe there is need for a general Support dashboard (even that is not a panacea because that too starts nice and clean and then as Support requests more features, it starts to get out of hand and becomes a dumping ground for random requests). Push back on what is not essential, drive towards fixing the root cause of something that is symptomatic of a deeper issue; on the other hand, if it is a genuine need, add the feature - as with most things, balance is the key.
*I am the author of Avo
it's open source too!
Sone invariants are easily expressed in the schema, but others (e.g. anything involving a join) are not.
[1]: https://interval.com
More recently i've used tools such as Retool (there are many alternatives), it has been ideal and allows for non engineers to build there own tools with a little bit of SQL knowledge.
They can indeed be a pain to build if one puts in the same codebase as the product codebase, best to separate their code out into a separate codebase. Business logic is often not applied to admin tools hence better own codebase.
Recently I built a backend using Node-Red[0], being a card-carrying Emacs user, I was surprised how simple it was to design flows to represent an API for my application. But the really great advantage was the admin tool. I just used Node-Reds dashboard[1] to create a simple frontend to interface with my database. It allowed me to play around with my database schema until it felt usable. After that I designed the API.
Just one more plug: pgModeler[2] is terrific for visualling modelling a postgres database. Incredibly useful and much preferred (for me anyway) over codified migrations. Combined with Node-Red, I could focus on getting the business logic done and not fiddle around with database migrations, data format conversions or debugging code.
[0]=https://nodered.org [1]=https://github.com/node-red/node-red-dashboard [2]=https://pgmodeler.io/ [3]=https://tableplus.com/
What would have been a script becomes a feature in the tool with just a slight more effort.
If you don't write it until everything is on fire all the time, it becomes a much bigger task. Plus all the time wasted when you didn't have it.
But perhaps from day one is too early, but it's a very high priority task.
I'm really impressed so far, it can either act as the only backend, or as an admin tool over an existing DB. It also has built-in support for "flows" to automate support tasks.
The obvious downside is in the wrong hands you can wreak utter havoc with it…
I have found creating mini tools a better use of my time, then just follow a shitty workflow because I need to keep doing things until I have reached a certain threshold. YMMV, of course.
The way to scale is to focus on eliminating the need of manual operations/admin tools by giving the power to the users of your products. Focus on self-service. Sure, not everyone should be able to overwrite an arbitrary value or change an important setting but that is easily solved with granular access rights.
In my team, we never want to create a feature that only devs or support team can use. These exclusive features create the need for us to operate them instead of staying focused on engineering.
If you have the whole team aware of the basic ground rules for what the admin tools are and what they need to be like moving forward, you can build an ongoing process. i.e. don't merge a feature unless that feature's developer also included a way for the business to configure it to their expectations.
Done correctly, the admin tools should effectively write themselves. It's definitely a lot faster to do this while you are deep in whatever feature.
After a couple of months, constant requests coming in to developers for changing or delete users information, but still no prioritization of such features. Directly in db ofc, since no tooling.
For us we usually just add a new feature to the admin dashboard whenever it's needed for the first time, usually triggered by a customer support question. The downside is that unusual queries can take a few days to answer, but the upside is that we've never built anything we didn't need.
At least provide CLIs.