agnyz / the-bed-stack

Bun + ElysiaJS + DrizzleORM = the stack you don't want to sleep on 🛌💤
https://agnyz.github.io/the-bed-stack/
MIT License
39 stars 3 forks source link

refactor: use NestJS design patterns #37

Closed yamcodes closed 1 year ago

yamcodes commented 1 year ago

Applies a patch to @Hajbo's drizzle + postgres setup.

Changes

The biggest change here is refactoring the code to match NestJS principles as much as possible, while still taking the ElysiaJS docs seriously.

Since this is balance is subtle and groundbreaking* (see note below), I left comments in the code explaining the considerations. Please review and feel free to take them out before merge or in a dedicated PR.

The best way to review this PR is to pull it into your IDE, run the code, and play around with the file structure, maybe try to add a feature or two to the users service.

See commits for full details

Groundbreaking

This balance (between NestJS best practices and ElysiaJS best practices) is groundbreaking since it is not the same as projects that try to mimic NestJS in Express are different. Elysia strongly encourages method-chaining which is not a common Express/Fastify practice.

Follow-up Considerations