Ask HN: How to upgrade small pet project and make it commercial-grade? - meatbundragon
======
git-pull
For bulletproofing, I do tests + mock network calls.

I use pytest with parametrize:
[https://docs.pytest.org/en/latest/parametrize.html](https://docs.pytest.org/en/latest/parametrize.html)

Then responses for mocking network stuff from requests:
[https://github.com/getsentry/responses](https://github.com/getsentry/responses)

Using fixtures and writing your own factory objects to simulate scenarios:
[https://docs.pytest.org/en/latest/fixture.html](https://docs.pytest.org/en/latest/fixture.html).
Fixtures in pytest are like setup/teardown.

I keep the code live in production, and have sentry errors email me if someone
hits a snag.

Decouple generic code into separate git repositories. Split up billing /
generic django / ux stuff so you don't need to repeat it with every website.

I maintain a changelog
[https://devel.tech/site/updates](https://devel.tech/site/updates). Helps to
stay motivated while you build out your own IP.

At work, when a project flops, the code tends to go to waste. When you write
your own code, unencumbered by any outside agreements/conflicts, it stays with
you to reuse, improve, license to others, turn into a SAAS, use in a separate
website, etc.

------
meatbundragon
OP here. To add context to this question, I have a small project in Flask that
I made for myself, but it's not multi-threaded, there isn't comprehensive
testing suite, etc.

How do I get from a very bootstrapped pet project to something a thousand
people can use? Are there any resources/books that could offer guidance on
this process?

~~~
ioddly
Do not assume that you necessarily need to make things much more complex in
order to scale to a thousand users. I have several client projects running on
flask + sqlite.

There are ways you could simulate a lot of users at once, if you're worried
about it.

For running multiple processes, I use gunicorn with an nginx proxy. Requires
little to no additional code added to your application.

~~~
llccbb
Have you had any success or failures with the single-threadedness of sqlite
and multiple simultaneous users? Does buffering interactions using gunicorn
help solve this? I ask because I love using sqlite for some localhost programs
but always transfer away to postgres once I push the app to a server/VM.
Thankfully sqlalchemy makes the transition possible with just a config change
and no real retooling of the codebase.

~~~
ioddly
I mostly use it on low traffic applications, but it depends on what those
simultaneous users are doing and how many of them there are.

Multiple processes can access a single sqlite DB, they just can't write to it
at the same time. So yeah, gunicorn (or any forking server) should help.

See:
[https://www.sqlite.org/whentouse.html](https://www.sqlite.org/whentouse.html)

