Skip to content

Commit c5549cd

Browse files
committed
Removes nodemon and dotenv
1 parent 178a8a2 commit c5549cd

File tree

4 files changed

+17
-27
lines changed

4 files changed

+17
-27
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The kit contains:
1111
- A client application (no frameworks, just TypeScript)
1212
- A demo micro application using [HTMX](https://htmx.org/): reads the current server time and displays it in the browser, auto-refreshing every 30s (or manually)
1313
- Server side error handling (500s and 404s)
14-
- Linting (via eslint and some plugins)
14+
- TypeScript linting (via eslint and some plugins)
1515
- JSX rendering using just TS and [Preact](https://preactjs.com/)
1616

1717
The kit does NOT contain:
@@ -41,6 +41,12 @@ After that, you have to install dependencies using your favourite package manage
4141

4242
You also have `npm lint`, `npm build` and of course `npm start` (for production).
4343

44+
Note that the project uses the (experimental) nodejs' [native watch feature](https://www.jamesqquick.com/blog/using-node-watch-instead-of-nodemon/) to monitor file changes and restart the server (in dev mode only). We don't use `nodemon` but if you cannot use a fairly new version of nodejs (19+) you might need it. Nodemon also preserves the output on subsequent restarts, whereas nodejs --watch does not. To use nodemon, just replace `node --watch-path` with `nodemon -w`.
45+
46+
### Configuration (.env)
47+
48+
If you need to use a `.env` configuration file (not included), we suggest using nodejs >= 20.6, to be [able](https://nodejs.org/en/blog/release/v20.6.0) to read a .env file without using an additional dependency (usually `dotenv`). If you cannot use node 20+, then just install and use `dotenv`.
49+
4450
## Tech stack
4551
- [Fastify](https://fastify.dev/)
4652
- [JSX](https://react.dev/learn/writing-markup-with-jsx) templates
@@ -52,8 +58,6 @@ You also have `npm lint`, `npm build` and of course `npm start` (for production)
5258

5359
### Additional tools provided
5460
- concurrently
55-
- nodemon
56-
- dotenv
5761
- prettier and a bare-bone config
5862
- client's and server's own tsconfig which extends a base one
5963

package-lock.json

Lines changed: 5 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fastify-htmx-ts-starter-kit",
3-
"version": "1.2.1",
3+
"version": "1.3.0",
44
"description": "Opinionated, no nonsense starter kit for a simple Fastify API + JSX + HTMX application",
55
"main": "./dist/app.js",
66
"repository": {
@@ -12,10 +12,13 @@
1212
"bugs": {
1313
"url": "https://github.com/claudioc/fastify-htmx-ts-starter-kit/issues"
1414
},
15+
"engines": {
16+
"node": ">=20.6.0"
17+
},
1518
"scripts": {
1619
"dev:build": "npm run clean && tsc -b ./client ./server",
1720
"dev:watch": "tsc -b ./client ./server --preserveWatchOutput -w",
18-
"dev:start": "nodemon -w ./dist/server ./dist/server/app.js",
21+
"dev:start": "node --watch-path ./dist/server ./dist/server/app.js",
1922
"dev": "npm run dev:build && conc -r -k 'npm:dev:start' 'npm:dev:watch'",
2023
"clean": "rm -rf ./dist",
2124
"build": "npm run lint && npm run dev:build",
@@ -24,9 +27,6 @@
2427
"prestart": "NODE_ENV=production npm run build",
2528
"start": "NODE_ENV=production node ./dist/server/app.js"
2629
},
27-
"nodemonConfig": {
28-
"delay": 1500
29-
},
3030
"prettier": {
3131
"printWidth": 80,
3232
"singleQuote": true
@@ -60,14 +60,12 @@
6060
"concurrently": "^8.2.2",
6161
"eslint": "^8.55.0",
6262
"eslint-plugin-import": "^2.29.0",
63-
"nodemon": "^3.0.2",
6463
"typescript": "^5.3.2"
6564
},
6665
"dependencies": {
6766
"@fastify/helmet": "^11.1.1",
6867
"@fastify/static": "^6.12.0",
6968
"chota": "^0.9.2",
70-
"dotenv": "^16.3.1",
7169
"fastify": "^4.25.1",
7270
"htmx.org": "^1.9.9",
7371
"pino-pretty": "^10.3.0",

server/lib/bootstrap.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@ import helmet from '@fastify/helmet';
33
import staticServe from '@fastify/static';
44
import path from 'path';
55
import router from './router';
6-
import dotenv from 'dotenv';
76
import { ASSETS_MOUNT_POINT, ASSETS_PATH } from './constants.js';
87
import { PinoLoggerOptions } from 'fastify/types/logger';
98
import { NodeEnv } from '../types';
109
import jsxRender from './jsxRender';
1110

12-
dotenv.config();
13-
1411
const envToLogger: Record<NodeEnv, PinoLoggerOptions | boolean> = {
1512
development: {
1613
transport: {

0 commit comments

Comments
 (0)