Ask HN: Do you use starter/boilerplate code for projects?

4 points by SandroRybarik ↗ HN
Do you have favorite stack ready for any application?

How much time do you spend on researching frameworks/stacks before coding?

8 comments

[ 1.7 ms ] story [ 29.0 ms ] thread
If the question is "do I use scripts like create-react-app", the answer is no.

In general, I don't like code generators, I like to understand what I'm doing from the beginning and add stuff when I need them.

But I do have a set of tools that I know and that I end up setting up in my projects.

For Javascript, it's:

  - Typescript
  - Apollo server/client
  - Mocha, Sinon, Chai
  - Vue, Vuex with Bulma
For Python, it's:

  - Poetry
  - Pytest
  - Pyright (type checking)
For Elixir, it's:

  - Phoenix if needed (not using the generators)
  - ExDoc
  - Whatever lib I need
Thanks for the comment.

Yeah I also dislike too many batteries included before actual development, but I like the idea of creating own starter template that is usable in every situation for given set of usecases.

Each time I set up a new project, I reevaluate the tools I use:

  Is there a new major version?
  Is my configuration obsolete?
  Is there a better tool for the job?
That's how I switched from nyc to c8 for example (test coverage). Or when I upgrade hugo. Or look at new versions of Typescript, Bulma etc...

If I had a template (which is a fancy word for copy-pasting), I wouldn't do that and slowly but surely my stack would be out of date.

Starting a new project is the moment when you reconsider your previous choices.

I use Cookiecutter for scaffolding but only with templates I’ve written myself.

Pre-existing templates may be more powerful and less buggy but I prefer to keep unneeded dependencies out of my projects. Writing my own templates also forces me to learn how everything fits together (and how sometimes it doesn’t).

The trade-off has been worth it for me so far.

I think it really depends on the project. If it’s a project for work it often has a deadline and thus saving all the time I can by using boilerplates or anything else is usually the way to go.

When is a project for myself I’m personally more interested in understanding how my code works (I mean, I don’t need to know the internals of sqlite…)

Do you think there is a need for centralised place with curated starter templates that are also kept updated on regular basis?
For work projects, absolutely. It would be and easier sell to a tech/product manager if there's some credibility behind the boiler plate (who's using it, last update, github stars...)

For personal project, I wouldn't find them that useful unless they are clean enough that I can understand what they are, what are they doing and how they are doing it, instead of me starting from scratch.

I have boilerplate Android code to run experiments with, mostly with things like network, tests, kotlin, viewmodel, and so on. Sad thing is it's always a little obsolete every time I try to use it again, and I've had situations where it's over architected.