This is my boilerplate for a modern backend project. It's the basis for my hobby projects.
Pick your own frontend poison.
- TypeScript
- node, express (w/ bodyparser, helmet, compression)
- Linting and formatting: gts
- Runtime typechecks and endpoint validations: io-ts, typera
- jest, supertest
- postgres, postgres-migrations
- Github Actions
- Install
n
for node version management (https://github.com/tj/n). - Configure your IDE to format on save.
- Fill in
.env
based on.env_example
- Install
postgres
and create a database with a name you defined in.env
n auto
npm run watch | npm start
- Decide how you want to do sequential numbering: 1...x or using a timestamp
- Create a new
.sql
inmigrations/sql
npm run migrate
(also runs as part ofnpm start
)
- Migrations are run upon
npm start
. This is probably too opinionated for you. - Depending on your environment the development dependencies might not be installed and thus not available for
npm run compile