# TypeScript Node.js template This is a template for Node.js applications using TypeScript and TypeORM. ## Customization - To replace PostgreSQL with SQLite: remove `pg`, install either `sqlite3` or `better-sqlite3`, and replace `postgres` in `src/db/index.ts:8` with `sqlite` or `better-sqlite3` (depending on which you installed) - To use the Active Record pattern, make entity classes extend `BaseEntity`. ## Configuration Add configuration keys to `src/config.ts`. ## Development commands - Building the project: `pnpm build` - Migrating the database: `pnpm migrate` - Watching for changes and reloading the project automatically: `pnpm dev` - Formatting: `pnpm format` - Check types: `pnpm typecheck` - Linting (if you don't have an ESLint plugin): `pnpm lint` ## Creating migrations Creating migrations is a little awkward because TypeORM expects `ts-node`, which uses `tsc`. To create a migration, first run `pnpm build`, then run `pnpm typeorm migration:generate -p -d ./dist/db/index.js ./src/db/migrations/`, replacing `` with the name of the migration you're creating. Then rename the created file to end in `.js` and remove the TypeScript-specific code from it. (Yes, this is incredibly janky, but it works, and it only needs to be done once per migration, actually migrating works flawlessly) ## License This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to