typescript-boilerplate
typescript-boilerplate copied to clipboard
Start writing stuff in TypeScript without bothered by configurations
typescript-boilerplate
TypeScript templates I use to immediately start doing something, with opinionated configuration.
How To Use
Download zip / tar.xz files from Github releases. Each file contains 1 variant.
Variants
nextjs, for a frontend + server monolith
Based on create-next-app template.
Plugins:
- A hand-roll alternative to next-compose-plugins
- next-bundle-analyzer
Libraries:
- trpc for typed API
- tailwindcss
- No CSS or UI libraries. User can freely bring own UI libraries.
- util libraries: clsx foxact lodash-es @jokester/ts-commonutil
Not configured for serverless or SSG, I don't use Next.js for them.
preact-spa, for frontend-only SPA
based on create-vite template
Libraries:
- tailwindcss
- react-helmet
- preact-router
If you need to host built assets with path rewriting,
I recommend hono-worker variant,
or serve-handler (example).
hono-worker, for edge-worker like environments
- based on hono
- Capable of hosting SPA created by
vite-preact
empty, an empty npm package
- Can be used for any purpose, a new library or CLI or else.
Conventions shared by all variants
All the variants contains a similar set of configurations and npm scripts:
tsconfig.jsonjest/ts-jestfor testinggtsprettiereslintfor linting and formattingnpm devnpm typecheck/npm typecheck:watchnpm lint/npm lint:fixnpm test/npm test:watch/npm test:coveragenpm build/npm analyze
The principles behind current (opinionated) settings are:
- Be strict as possible in TypeScript.
- Be close to upstream defaults, but with some opinionated changes
Obsolete Variants
obsolete/web-gatsbyobsolete/craco-reactobsolete/aws-api-gatewayobsolete/mobile-react-nativeobsolete/web-tsup- Browser-only React SPA with egoist/tsup
LICENSE
- work from upstream repositories follows their licenses
- other contents are MIT licensed
- other contents are WTFPL licensed too