Skip to content
/ deta-tsx-express Public template

Deta micro template with typescript + tsx + express + tsup

Notifications You must be signed in to change notification settings

Proladon/deta-tsx-express

Repository files navigation

Deta Tsx Express Template

Deta micros template with typescript + tsx + express + tsup template

Deploy

Features

  • 🔥 Path alias
  • 🔥 Watch mode (like nodemon)
  • 🔥 Simple config
  • 🔥 ESNext syntax
  • 🔥 Fast and minify!
    • minify build (default)
    • treeshake (default)

Deta currently does not have that many starter template options to choose from. In past, I always used BetaHuhn/deta-express-starter, this starter template is very good, but some coding style and config do not suit me.

As a vue developer, I'm very used to using path alias. But implementing typescript path alias always has problems after complie.

Finally, after tried vite-node / tsx and tsup / esbuild can resolves all the problems.
But vite-node hmr(watch-mode) has some problem that can't be used, so I'm choosing to use tsx

Quickstart

notice: rename .env.example to .env

  1. install the deps
$ yarn
  1. development start
$ yarn dev
  1. build for prod
$ yarn build
  1. preview prod
$ yarn preview

Config path alias

Default path alias is @ target to the src folder.
If you wanna change it or add new alias, just modify tsconfig paths:

tsconfig.ts

"compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*":["./src/*"]
    },
}

FAQ

  • Why build output is a single file ?

    If you want output to keep origin structure, just go tsup.config.ts and change the entry property to:
entry: ['src/**/*.ts']