How I Structure New Projects In Golang

Anthony GG
3 Oct 202321:31

Summary

TLDRThe video discusses setting up a scalable project structure for a Go web application using Echo as the framework. It advocates for a pragmatic approach focused on simplicity, avoiding over-engineering. The proposed structure includes folders for binaries, commands, database logic, handlers, business logic packages, shared types, and utilities. It demonstrates this structure in an app called Leue - a marketplace to sell recurring revenue for upfront cash. The video argues developers should be full stack and balance tradeoffs themselves rather than follow dogmatic paradigms.

Takeaways

  • 💻 The video discusses transitioning a company's project, named Laue, from Next.js and TypeScript to Go and Svelte Kit due to a significant increase in funding and project scope.
  • 🔨 The presenter emphasizes there's no perfect project structure in programming; instead, it's about choosing what works best for the team and being willing to adapt.
  • 💡 Encourages a result-driven development mindset over stressing about tools, packages, and organization methods.
  • 🛠️ Explains the Go project structure, including the use of a 'bin' folder for binaries, a 'cmd' folder for main package entry points, and other organizational strategies.
  • 📰 Highlights the flexibility of Go frameworks for the backend, stating that the choice of framework (Echo, Gin, etc.) doesn't significantly impact the end result.
  • 💥 Discusses performance concerns, suggesting that for most projects, performance won't be a limiting factor until a very large user base is reached.
  • 📖 Offers insights into database interaction, the use of global variables for ease of use, and the pros and cons of different approaches to handling database queries.
  • 🏆 Shares a pragmatic approach to coding, advocating for simplicity and focusing on getting results rather than adhering strictly to certain programming paradigms.
  • 📈 Talks about the importance of integrating business logic and data handling correctly within the project's structure to ensure scalability and maintainability.
  • 📚 Advises on the significance of having a balanced view on technologies and methodologies, emphasizing that what works well for one team or project may not for another.

Q & A

  • What is Leue and what was the original technology stack used to build it?

    -Leue is a company that the speaker created 3 years ago. The original project was built using Next.js for the front-end and TypeScript for the back-end.

  • Why did the speaker decide to rewrite Leue and change the technology stack?

    -The scope of the project changed dramatically after the company received a large amount of funding. The speaker wanted to scale up the project, so they decided to rewrite the back-end in Go and use SpellKit for the front-end.

  • What is the speaker's view on choosing frameworks and architectural patterns?

    -The speaker believes there is no one "perfect" choice. Developers should use what feels right for their needs instead of forcing specific paradigms. Performance differences rarely matter until an application reaches very large scale.

  • How does the speaker structure Go projects and why?

    -The speaker uses a simple and modular structure with folders for handlers, packages, data, types, etc. This makes it easy to understand and scale up the project over time as needed.

  • Why does the speaker use a global database connection variable?

    -For ease of use across different packages. The speaker argues this is okay if used carefully and may not matter much for testing since database access should be integration tested.

  • What is the purpose of the CMD folder and how does it work?

    -The CMD folder contains main.go files that bootstrap different entry points into the application, like API servers. The binaries are then built into the bin folder for execution.

  • Where is business logic implemented in this structure?

    -Most business logic is contained in the packages folder, separate from the database access in the data folder and HTTP handler functions.

  • How are endpoints and handlers organized?

    -Handlers are organized by HTTP method into handler functions. Endpoints are grouped by concepts like buy/sell side using middleware.

  • How does the front-end connect to the Go back-end?

    -The front-end uses SpellKit and calls API endpoints exposed from the Echo server in the main CMD API bootstrap.

  • What is the speaker's view on specialization between front-end and back-end development?

    -The speaker argues developers should have full stack capabilities instead of identifying as a front-end or back-end specialist, since it's all just writing code.

Outlines

00:00

😊 Introducing the leue project and its transition to version 2.0

The paragraph introduces leue, a company created 3 years ago that is transitioning from a Next.js and TypeScript stack to Golang and SvelteKit. The scope and funding have increased dramatically, necessitating scaling up the backend in Golang. The video will focus on setting up a Golang project structure.

05:02

🤔 Using simple scripts over CLI packages for database management

The paragraph discusses using simple scripts to handle things like dropping databases and running migrations instead of CLI packages. These scripts are run through Make commands for convenience. A makefile is simple and commonly installed on Linux.

10:02

😉 Embracing Bun as the ORM over sqlc despite drawbacks

The paragraph analyzes the tradeoffs between using sqlc for type-safe queries versus Bun for more dynamic queries. Despite drawbacks like losing type safety, Bun is ultimately embraced for this project.

15:03

🧐 Separating code by responsibility into different packages

The paragraph explains the structure of separating code into different packages based on responsibility - data layer for db access, handlers for HTTP handling, package for business logic, types for shared types, and util for helpers. This structure scales well.

20:04

💪 Being a well-rounded developer to create full-stack applications

The paragraph advocates for being a full-stack developer comfortable on both frontend and backend instead of limiting yourself. Any language or framework has tradeoffs - focus on weighing pros and cons based on your own needs.

Mindmap

Keywords

💡project structure

This refers to how the code and files of a software project are organized on disk. The video discusses principles and tradeoffs in structuring Go projects, emphasizing flexibility based on the project context versus rigid adherence to architectural patterns.

💡code organization

Closely related to project structure, this refers to logical grouping and arrangement of code - things like separation of concerns into handlers, business logic packages, data access components etc. The video advocates starting simple and evolving structure based on emerging needs.

💡framework

Used in context of web application frameworks like Echo, Gorilla etc. The speaker makes the point these are interchangeable and what matters is meeting project needs over notion of one being better.

💡global variables

The video shows an example of using a global database connection variable for simplicity. It discusses tradeoffs of this approach and notes it can work depending on context - not always a strict no-no.

💡data layer

This refers to components dealing with storage and retrieval of data, like databases, ORM mappers etc. The video uses the term "data package" and houses queries, DB interaction code under a top-level /data folder.

💡handlers

Used to denote web request handlers - functions called to handle specific HTTP calls like GET, POST etc. The video uses /handlers folder to group dedicated handler functions for different routes.

💡business logic

Domain-specific application logic beyond simple data access is referred to as business logic. The video advocates putting this in /package folder - purpose-specific packages for cohesive functionality.

💡shared code

The video uses /types and /util folders for shared code like custom types and helper functions used across the app, avoiding duplication.

💡architectural patterns

Several structured approaches like clean architecture and hexagonal architecture are mentioned that provide opinionated guidelines on project structure. Speaker notes these have tradeoffs and ideal approach depends on specific project.

💡simplicity

An overriding theme in the video is to start simple and not overengineer, allowing the structure to evolve organically based on emerging needs rather than enforced top-down patterns.

Highlights

There's no such thing as a perfect project structure, do what feels right and change it along the way

Focus on results instead of how you program things

Performance doesn't matter until you have a large user base, then it's a luxury problem

Framework doesn't matter, they all get the same results

Use simple scripts instead of complex CLI packages

Group database logic in a data folder, keep it separate

Test business logic with units tests and database interaction at integration level

Handler functions handle the HTTP requests and extract JSON

Business logic goes in the packages folder if needed

Types folder stores shared types between packages

Util folder has helper functions

Start simple then evolve architecture over time

Don't be a backend/frontend developer, be a problem solver

Weight pros and cons to see if something works for you

Project structure can scale as big as needed

Transcripts

play00:00

so we're recently starting to rewrite

play00:02

leue into the 2.0 version for the people

play00:05

I don't know what laue is it's a company

play00:07

I created three years ago and the

play00:09

original project was basically written

play00:10

in next GS everything in typescript

play00:13

which worked very well but right now we

play00:15

received a big amount of funding and the

play00:17

scope is changed dramatically so it's

play00:20

time to scale up and we decided to write

play00:23

the back end in goaling and use spelt

play00:27

kit as the front end right so uh and in

play00:30

this video I'm going to show you how we

play00:31

set up our gooling project structure

play00:33

because it's still a question that comes

play00:35

up a lot like Hey how do you structure

play00:37

gooling projects and before we continue

play00:40

if you like the videos that I'm

play00:41

providing to you please consider

play00:42

subscribing give me a thumbs up leave

play00:44

some questions in the comments and jump

play00:46

into the 4,000 people big Discord server

play00:50

where we learn from each other each and

play00:52

every single day and for the people that

play00:53

want to level up I also have the

play00:55

full-time GF course which is 50% off

play00:57

right now for a limited amount of time

play00:59

and I also have my patreon page so check

play01:01

these things out if you want to learn

play01:03

more about goang so before we actually

play01:07

continue with the folder structure here

play01:08

you can already see it on the left side

play01:11

of my screen there is no such thing as

play01:15

the perfect project structure or the

play01:17

good project structure or something that

play01:19

is good something that is wrong I think

play01:21

that doesn't exist in programming uh

play01:24

space I think a lot of people are

play01:25

forcing paradigms to you because they

play01:27

created that Paradigm and they want to

play01:29

Market it so we cannot blame them right

play01:32

if you make something you're probably

play01:33

going to Advocate that it's going to be

play01:35

the best thing because it sols a lot of

play01:37

problems and maybe it will right but

play01:40

whatever you do in life there's always

play01:41

some it's always going to give you

play01:43

benefits but it always also going to

play01:45

give you some uh negative Parts also

play01:48

that's something you need to keep in

play01:49

mind right um so if you have the if you

play01:52

have the possibility to start from

play01:57

scratch you actually never know what

play01:59

what's going to be the best thing you

play02:01

can have something in your mind like

play02:03

okay if we do it like this and and and

play02:04

these are the Futures we need this is

play02:06

probably something we're going to

play02:07

utilize in the future maybe we should do

play02:09

it this way most of the time it's going

play02:11

to change dramatically over time right

play02:13

it's going it's never going to stick

play02:15

like you like you originally planned it

play02:17

right so that's something you need to

play02:19

take in consideration and that's why I

play02:21

think everybody needs to have a more

play02:23

result driven development mindset which

play02:26

is basically instead of being confused

play02:29

about oh the tools and packages and ways

play02:32

to organize stuff I think you just need

play02:35

to go and Chase your good feeling what

play02:39

feels right what feels sus what feels

play02:43

good you know what I mean and change it

play02:45

along the way I think and just focus on

play02:47

the results instead of on um the way you

play02:51

program stuff right all right cool uh so

play02:54

basically how do we do these things well

play02:55

it's very simple uh we have um goang

play02:59

project here

play03:00

and first of all we have this bin folder

play03:02

here and this bin folder is basically

play03:03

just uh a folder where we are dumping in

play03:06

our binaries right uh and these binaries

play03:09

they are coming from the CMD folder

play03:11

right you can see there is no main. go

play03:13

in the rout right that's because we

play03:15

using this pattern it's it's a very

play03:18

common thing where you have these um

play03:20

separate packages right and each of

play03:23

these packages they have a main. go file

play03:25

here you can see that right and in this

play03:27

main.go we basically bootstrap um or API

play03:31

which is an

play03:32

echo project right uh it's using the

play03:35

echo framework so what framework do you

play03:37

need to use actually guys it does not

play03:39

really matter right you can use gen

play03:41

fiber Echo gorilla you can use the

play03:43

standard Library it doesn't really

play03:45

matter right people say yeah you don't

play03:46

need to use that or you need to use this

play03:48

it doesn't matter it really doesn't

play03:50

matter they all do the same things and

play03:51

they will all get you the same result

play03:54

right that's that's that's the reality

play03:57

right uh and you could say performance

play03:59

performance doesn't matter right again

play04:01

people are going to be very very

play04:04

confused and angry about the comment I

play04:06

say like performance doesn't matter like

play04:08

if per maybe performance will matter at

play04:10

a certain point of time and if

play04:13

performance is a

play04:15

bottleneck then I'm going to say

play04:17

congratulations to you because you

play04:19

actually makes made something that has

play04:22

some traction that that's a big traction

play04:24

because before you go to be in a

play04:26

performance bottleneck you're going to

play04:28

have a very very very very large user

play04:30

base and that's a luxury problem and

play04:33

that's going to be solved at the time

play04:36

it's going to be there right uh which in

play04:38

your case most of the time will never be

play04:40

right so performance is not something uh

play04:43

especially in goling with echoin you

play04:45

will you cannot go wrong it it it has a

play04:47

good performance don't worry about that

play04:49

guys don't worry about about about these

play04:51

paradigms uh about that fugazi right so

play04:54

we have this main thing which basically

play04:55

boots up um our API server and all that

play04:58

stuff right then we're going to have

play04:59

some other things so what I like to do

play05:01

um which is a little bit weird a lot of

play05:04

people use some kind of um CLI package I

play05:07

think I don't know maybe Viper or

play05:08

something I have no clue I never use

play05:10

these things and with the CLI package

play05:12

you can write all these commands and

play05:13

then you can execute them based on the

play05:15

user input but what I like to do is very

play05:17

lazy and very simple is just make um for

play05:21

example this drop thingy here right

play05:23

which basically drops all our accounts

play05:25

and why do I have this because um in our

play05:28

migration sometimes you can do make down

play05:30

for example which will um migrate will

play05:34

will

play05:35

will use all the down migration you know

play05:37

what I mean delete these tables but

play05:39

sometimes you're going to end up in a

play05:40

dirty State and then it it basically is

play05:43

going to refuse to uh drop your tables

play05:46

right make down is not going to work

play05:48

it's going to say yo your database is in

play05:49

a dirty state of course in production

play05:52

that's a good thing that that happens

play05:54

right uh but in development it's

play05:55

sometimes it's nasty because you have in

play05:57

a dirty State and you need to force do

play05:58

that stuff uh you need to force drop and

play06:01

sometimes you need to manually delete

play06:02

some tables and it's just a pain and

play06:04

yeah so I made this very dirty simple

play06:06

script it basically just deletes the

play06:09

whole shebang even the

play06:10

migrations uh and then we can just do a

play06:13

makeup again

play06:15

um and it's all good right that's this

play06:17

drop and the same thing with migrate you

play06:19

can see that basic um with this other

play06:21

thing here for for example the seat it

play06:23

basically go it's a dirty script that

play06:24

seeds some stuff into the database um

play06:26

just for yeah testing purposes right if

play06:28

you want to test your front end uh you

play06:30

just dump some some some seats uh into

play06:33

into your database um so you can see

play06:35

this all very simple scripts and the way

play06:38

we actually trigger them is in our make

play06:39

file you can see uh for example make

play06:42

down it just runs these main. go files

play06:46

right this the same thing here with up

play06:48

with uh drop and all that stuff it it

play06:50

uses these these uh separate programs

play06:54

right very simple um you could use

play06:56

something like a CLI package like I said

play06:58

what's good what's bad it doesn't really

play06:59

matter this was just easy peasy without

play07:02

a lot of squeezy you know what I mean uh

play07:04

so that's that so the next step here uh

play07:07

like you let let me show up this make

play07:09

file right so I'm using a make file

play07:10

people say you should drop that in in

play07:12

favor for other

play07:14

stuff like I said man if make file works

play07:16

for me it works for me right maybe it

play07:18

doesn't work for you maybe you want to

play07:20

use something else that's perfectly fine

play07:22

right um it all depends what you want to

play07:25

use it doesn't really matter right uh

play07:27

it's

play07:28

fine all right because you have these

play07:30

goal tools I don't know go make or

play07:31

something you have these these cool

play07:33

stuff U where you can write goang things

play07:36

and but like I said a make file

play07:37

everybody knows it it's simple it's most

play07:39

of the time already installed on Linux

play07:42

things so it's fine right uh so the next

play07:44

step is a very important step is our DB

play07:46

I'm going to uh start with this DB

play07:48

because this is a little bit of

play07:50

controversial right so the DB package

play07:52

has just one file and what this does is

play07:54

basically creates

play07:57

um it it basically uh bootstraps or

play08:00

database right and as you can see we are

play08:05

using bun here but we and it's a global

play08:08

variable so there's a lot of things we

play08:09

need to discuss here right um so I

play08:11

started out we started out with using

play08:13

sqlc right sqlc is something that

play08:16

generates um goang codes and structures

play08:20

models based on U your schema your SQL

play08:23

schema uh and you can write your SQL

play08:26

queries and it basically generates code

play08:27

for that which is actually very very

play08:29

good right

play08:31

but need to drink some coffee for this

play08:33

one but the problem with sqlc is it's

play08:35

it's getting very tedious something we

play08:37

had a ton of queries already and I

play08:38

thought man this is just so nasty all

play08:40

these queries and then we have a schema

play08:42

for our migrations we have a schema for

play08:44

sqlc and you need to sync these things

play08:47

and then some people are working uh like

play08:49

me and Teddy we working on that it's a

play08:52

two people project right now and we are

play08:53

doing work for for 16 uh but the thing

play08:56

is that it's just it gives conflict it

play08:59

was was

play09:00

nasty for current operations I'll really

play09:02

like it but we need to have some

play09:06

more dynamically stuff going on some

play09:09

more genetic stuff and I used BN for a

play09:11

long time um in in other projects and I

play09:14

really like it right of course something

play09:16

that's the downside like I said for

play09:17

every positive thing also comes

play09:20

something that's some negative stuff and

play09:22

the cons for bun is that your queries

play09:24

are not going to be type safe right if

play09:27

you make a mistake

play09:29

that's bad for you nobody's going to

play09:31

it's going to it's going to give you an

play09:32

error or something or or user that not

play09:34

being found uh but hey it is what it is

play09:37

right like I said pros and cons what do

play09:40

you want it's it's a a weight scale that

play09:44

needs to be in Balan for you right not

play09:46

for somebody else on the internet it

play09:47

needs to be in balanced for you and for

play09:49

your team and is everybody thinks that

play09:51

the scale is in balanc and it's fine

play09:52

right everybody know the consequences

play09:54

here um but also everybody can use the

play09:58

positive side Ides on that right so

play10:00

that's what we do and it's a global

play10:02

variable why is it a global variable

play10:03

just for the ye of use and of course

play10:06

this is very this could be dangerous but

play10:08

like I said a global at the right time

play10:10

at the right place is is is okay it's

play10:13

it's it's no big of a deal because we

play10:16

are using this data

play10:17

folder and this data folder is most of

play10:20

the time is going to be used models for

play10:22

a lot of people but I think models is so

play10:24

weird because I think models they belong

play10:27

on the catwalk you know what I mean um

play10:29

it's I think everything that involves

play10:33

storing data retrieving data structures

play10:36

which is just

play10:38

data I think it it can be in a data

play10:41

folder it makes a lot of sense right so

play10:43

everything uh that's

play10:45

involving data

play10:48

structures queries for inserting or

play10:51

retrieving or updating whatever all

play10:53

database related logic is housing into

play10:56

this data folder right just like models

play10:58

most of the time

play11:00

and what this does is basically it uses

play11:03

it uses queries um it the only thing it

play11:06

does is basically interacting with your

play11:08

database right that's what it's doing

play11:10

you got have a query you're going to do

play11:11

some joints or some some separate

play11:13

queries you're going to aggregate that

play11:14

data and return it that's basically what

play11:17

this data folder is this data package is

play11:21

going to do right and nothing else and

play11:23

nothing nothing less and nothing

play11:25

more for tests it's very important

play11:28

because the global variables uh can be a

play11:31

problem in your tests but I don't like

play11:33

to test the data or your database into

play11:36

the unit form right I don't want to use

play11:38

unit tests for data I think interacting

play11:40

with your database should be on the

play11:42

integration Port again this is something

play11:44

that can be discussed it has its pros

play11:46

and it has its cons it really doesn't

play11:48

matter right um I think if you test your

play11:51

business logic based on on unit tests

play11:54

that's pretty good and if you use your

play11:57

data everything that needs to be

play11:59

interacting with your database if you do

play12:01

that on an integration

play12:03

level it doesn't really matter that your

play12:06

database is

play12:07

global the only thing you need to do is

play12:09

instantiate the correct database right

play12:12

if you have if you want to do some test

play12:13

you use a test database um and if you

play12:17

yeah whatever right and if you deploy

play12:19

the production you're basically going to

play12:20

init initialize your database with the

play12:23

production credentials right so that's

play12:25

the data thing right the next step we

play12:27

have is very simple is our handlers and

play12:28

our handlers are just plain functions

play12:30

right there are no uh you can see for

play12:32

example here uh some middleware where we

play12:35

validate gbt we have um some error stuff

play12:38

for centralized error

play12:40

handling some lock middleware it's very

play12:42

simple uses the S from gooling the new

play12:43

stuff pretty amazing let me show you

play12:46

something here can I show some something

play12:47

diff uh something interesting uh for

play12:50

example handle get User it's just very

play12:52

simple handle get user we always prefix

play12:54

this with handle and then we use get and

play12:57

that's not for example not for getting

play12:59

the user it's the get request right

play13:01

handle get user handle post user handle

play13:05

update user right um just a convenience

play13:08

method is that the way to go I have no

play13:10

clue it works for me

play13:14

uh you're you're like I said you're the

play13:16

ball pros of your painting you can do

play13:17

whatever you want right of course if you

play13:19

join a team um that already has these

play13:23

kind of things set out laid out yeah you

play13:26

need to follow them right but if you can

play13:28

choose from the start you can do

play13:29

whatever you want right as long as it

play13:31

makes sense for you um so what do we do

play13:34

with these hand handlers well uh like I

play13:36

said before we have the CMD API Maino

play13:38

file and then we have these very simple

play13:43

um uh yeah like like these these these

play13:45

route handlers right this these routing

play13:47

stuff so for example uh what we're going

play13:49

to do here because in leue we have the

play13:51

concept of sside accounts and buy side

play13:53

accounts because there's a double-sided

play13:55

marketplace where you're going to sell

play13:57

or you're going you're going going to

play13:59

auction your uh recurring Revenue in

play14:01

return for upfront cash from

play14:03

institutional investors right so we have

play14:05

sell site and buy side and of course the

play14:07

sell side they cannot they can only do

play14:10

specific certain actions and the same

play14:12

for the buy side so what we do here is

play14:14

we make this a group thingy which

play14:17

basically is most of the time in every

play14:18

single web framework you're going to

play14:20

have something like that where you're

play14:21

going to group your handlers with some

play14:24

um how do you call it with some

play14:26

middleware right and uh it basically

play14:28

some some authentication authorization

play14:30

middleware right he's going to see oh

play14:32

yeah this user is this a cide user yes

play14:35

then he can do these things if it's a

play14:37

buy side user then you cannot do these

play14:39

things right then uh you are basically

play14:41

not authorized to access these things

play14:44

right so that's what we do here handlers

play14:46

and then we're going to say handle

play14:47

cellsite demo metrics in this case we

play14:49

don't follow this stuff it's probably my

play14:51

bad handlers handle post funding request

play14:53

handlers handle get funding request you

play14:55

know what I mean very simple um no big

play14:58

of a deal here right so that's basically

play15:00

our handlers here then we have package

play15:03

um which is

play15:04

something where more of the business

play15:08

logic houses because most of the time

play15:11

you're going to have something like a

play15:12

transport right you're going to have

play15:13

your Json transport your Json HTTP

play15:15

Handler so what it's going to do is it's

play15:17

going to get some Json data it's going

play15:19

to uh Marshall that or decode that into

play15:23

a structure right and then you're going

play15:24

to have that structure and then you're

play15:26

going to decide do we need to do some

play15:28

business business logic onto that data

play15:31

or can we basically just use our data uh

play15:34

package and just store that user into a

play15:37

database right or store a funding

play15:39

request into a database some some simple

play15:41

crit doesn't really need to have some um

play15:44

business logic because it's very simple

play15:46

it's just receiving data decoding data

play15:49

validating data and storing data that

play15:52

doesn't actually is some kind of a

play15:53

business logic in my opinion but if

play15:55

there is some business Logic for example

play15:57

you need to fetch some transaction from

play15:58

the the bank you need to aggregate them

play16:00

do some calculations and all that stuff

play16:02

uh maybe some third party things are

play16:04

going on some third party API calls or

play16:07

need to be um executed then we put

play16:10

everything inside of a

play16:12

package folder here and in this case

play16:14

it's going to be salt and then client y

play16:16

yada y you can see the project is very

play16:18

very early in the stage we already have

play16:19

some project running but that's the next

play16:21

GS this is still in development right so

play16:23

that's going into package uh that's

play16:25

basically a goaling em to to put it in

play16:28

in package you could use it lip you can

play16:30

you can call it whatever you want but I

play16:31

think package is something that is very

play16:33

common inside of the goang community

play16:36

right then we have some types here uh

play16:38

and types is very important

play16:40

because you could put these types into

play16:42

Data but these types are basically

play16:45

shared you can use you can make you can

play16:47

you can call this common is is is I can

play16:51

I see that a lot of times in other

play16:53

projects in other repositories on getup

play16:55

people call it common people call it

play16:56

shared in this case just types because U

play17:00

the only thing we have is some kind of

play17:02

enums quote quote I need to be very

play17:04

careful for the YouTube police right

play17:06

because they are actually no enims but

play17:09

they act like enims right um constants I

play17:13

would say all the constants are here all

play17:14

the types are here that are shared

play17:17

between uh packages right that's in

play17:20

types um and you could basically split

play17:23

that out right you could make it a a

play17:25

file for each type but then you're going

play17:27

to have a file with three lines of

play17:28

sometimes that's who cares right you

play17:31

just dump everything into the types at

play17:33

go and if your types are getting too big

play17:36

then you can start splitting things out

play17:38

and group Things based on on domain or

play17:40

something right but that's for later on

play17:41

that's a problem we don't have yet right

play17:43

and then of course the UIL right util

play17:46

utils shared whatever you're going to

play17:47

call this is a very simple stuff where

play17:49

we going to have uh like nothing inside

play17:52

right is Pro app M and all that stuff

play17:54

some simple helper functions that are

play17:56

going to help you with uh simple simple

play17:59

things in your application right crypto

play18:01

is

play18:03

this not quite sure what this is

play18:05

probably T did some stuff right anyway I

play18:06

think it's for encrypting um some kind

play18:10

of API tokens we don't want to uh every

play18:13

API token from from a third party

play18:15

library for our user we don't want to

play18:16

expose that uh with plain text we want

play18:19

to basically encrypt that stuff into the

play18:20

database so if it's get hacked they are

play18:23

the hacker right not the client

play18:26

uh that's basically it of course get

play18:27

ignore go mod some make read me that's

play18:29

all that stuff that's basically it guys

play18:31

and with this project structure you can

play18:32

scale it as as far as you want right you

play18:35

because every data structure you're

play18:37

going to have or every data logic you're

play18:39

going to have is going to be in the data

play18:41

every new Handler is going to be in the

play18:42

handlers every new business logic you

play18:44

can put that into package and every new

play18:47

type you put it into type and you can

play18:48

scale it as big as you want is this

play18:51

going to change over time most likely it

play18:54

will right it's like I said it's

play18:55

something that works for me for a very

play18:58

long time this this structure it's very

play19:00

simple um don't make it too complex with

play19:02

all that clean architecture and

play19:04

hexagonal architecture and they will all

play19:06

have his benefits don't get me wrong

play19:08

like these are basically invented by

play19:09

very smart people but I always say start

play19:13

very simple right start simple make some

play19:17

uh diesel driven stuff and I'm going to

play19:19

show you how it looks right so you can

play19:21

see this is basically the sells side

play19:22

dashboard right um which again another

play19:26

question is like people say how do you

play19:27

make this beautiful wise well guys it's

play19:29

very simple uh don't be a single-sided

play19:31

developer very important people want to

play19:33

be a backend developer people want to be

play19:35

a front-end developer I don't think

play19:36

there is something such as a backend and

play19:38

a front end developer in my opinion you

play19:40

are a programmer or you're not you are

play19:42

an engineer or you're not you can solve

play19:45

problems or you're not because by the

play19:47

end of the day the only thing you do is

play19:49

write code right you're pressing buttons

play19:52

If it's JavaScript typescript goang

play19:55

python rust it doesn't really matter you

play19:57

can write it in every every single

play19:58

language there are some benefits and

play20:01

there are some cons there are some pros

play20:02

there are some Cons with everything in

play20:04

life and the only thing that matters is

play20:07

if your weight scale of pros and cons is

play20:10

inbalance or may basically if your Pros

play20:12

are a little bit

play20:15

um uh if if your Pros weigh a little bit

play20:17

more actually weit a little bit less

play20:19

right if the balance is a little bit

play20:20

more in the favor of the pros instead of

play20:22

the Conant it's a win for you right but

play20:24

that does not mean that my balance is

play20:26

the same my weight balance is going to

play20:28

be balanced the same as yours or my

play20:30

neighbors or whatever right or other

play20:31

produ um engineering teams it's all

play20:34

subject to the people are using it right

play20:37

that's something you need to uh take in

play20:39

consideration um that's basically the

play20:41

thing of course we are we are doing some

play20:43

stuff it's it's it's still in progress

play20:45

here we we we have some look at this

play20:47

it's it's we have some stuff but we're

play20:48

still uh working on that right that's

play20:51

basically it and it's calling basically

play20:53

spell kit in the back end and all that

play20:54

stuff maybe I'm going to make it another

play20:55

video because we're already 20 minutes

play20:57

in and I'm not even done it's crazy guys

play20:59

I really want to provide 10minute videos

play21:01

but I can because the things I need to

play21:02

say uh take some time right you know

play21:04

what I mean it takes some time so that's

play21:06

basically on B it if you have more

play21:07

questions feel free to dump it in the

play21:09

comments like I said uh is not for

play21:11

everyone right people going to going to

play21:13

dislike it people going to like it it is

play21:14

what it is it's the balance again right

play21:16

it's again the weight balance as long as

play21:18

the people like it or in favor of the

play21:20

people that dislike it it's all good for

play21:22

me Isn't it so thank everyone for

play21:24

watching this video and I'm looking

play21:25

forward to see you in the next video or

play21:27

live stream peace stay safe and have fun

Rate This

5.0 / 5 (0 votes)

英語で要約が必要ですか?