backing-tracks-isomorphic
v1.0.7
Published
Shared Backing Tracks code that runs on client and server.
Readme
Backing Tracks Isomorphic
Contains code that we use on both the client and server, namely:
- zod schemas... spent a lot of time thinking if want to use something like TypeSpec to first define my endpoints there. And then generate openapi and zod schemas.. Would be really cool to do it in such an API first approach. But decided it was too much for this. Might try it in a big prod someday.
- ts types
- possibly more in the future
schemas/api
I am trying out an API first approach for this backing-tracks app. So these schemas are used to validate the server response and ofc used on the client as well.
Prod
Code is built and published to npm from my machine :P
- Bump up the version.
npm i- stage changes.
npm run buildnpm publish- commit & push.
Local
For local integration of this bulld with other projects there are quite a few different ways:
- yalc - have used it before and like it.
- npm local file. Creates a symlink like npm link does. https://docs.npmjs.com/cli/v10/configuring-npm/package-json#dependencies https://docs.npmjs.com/cli/v10/configuring-npm/package-json#local-paths
- npm link https://docs.npmjs.com/cli/v10/commands/npm-link
- npm workspaces - bigger abstraction, need to check it out.
Ended up using symlinks by specifying the local file path in package json.
npm run dev - builds the pkg on src file changes.
TODO:
- sanitize input... for path and query params as well.
- maybe create the seeder here - can be used in server and also for cleint mock data ?
- make sure it is easy to use with MSW as well!
- actyally should keep the zod and validation lib versions pinned as we want to have the exact same for the client and the server.
- upgrade to zod4
- move to the github pkg registry
- play around with optimizing bundle size here and at client side https://stackoverflow.com/questions/70296652/how-can-i-use-exports-in-package-json-for-nested-submodules-and-typescript
- CI/CD with GitHub Actions - build and publish to npm - we should qualify for the free plan.
- TypeSpec - define api first, then generate open api and zod.
- check release management tools although we really don't need one! - release-it, changesets, semantic-release, etc.. Now, we will just do npm publish.
