huma icon indicating copy to clipboard operation
huma copied to clipboard

Example File Structure

Open ScriptType opened this issue 7 months ago • 1 comments

Hey there,

I'm a developer with a background in TypeScript and frameworks like NestJS. One thing I really appreciated about these frameworks is the clear file structure they provide. It gives a default standard and makes it easier to compare different projects.

I'm diving into Go and have just built my first API using Huma, but I've stuck with a file structure inspired by NestJS. While I know it's not "wrong," I'm not sure if it's the best approach for Go projects.

I would love to see an example of how you structure your Huma API projects. Additionally, I'd be grateful for any advice on how you typically handle database interactions, whether you prefer using an ORM or not, and some examples of your setup.

What I'm Currently Doing:

Here's the file structure I'm using now:

/my-api |-- /src | |-- /controllers | |-- /services | |-- /models | |-- /middlewares |-- main.go

What I'm Looking For:

  1. Example File Structure: A sample file structure for a typical Huma API project.
  2. Database Interaction: Your preferred method for database interaction in Go (using an ORM or not). An example of how you set up and interact with the database in your Huma API projects.

ScriptType avatar Jul 12 '24 11:07 ScriptType