-
Notifications
You must be signed in to change notification settings - Fork 3
Project Structure
Kharann edited this page Mar 28, 2021
·
5 revisions
src
├── context.ts
├── schema
│ ├── enums.ts
│ ├── auth
│ │ ├── index.ts
│ │ ├── mutation.ts
│ │ ├── subscriptions.ts
│ │ ├── query.ts
│ │ ├── __tests__
│ │ │ └── auth.test.ts
│ │ └── typedefs.ts
│ ├── meeting
│ │ ├── index.ts
│ │ ├── query.ts
│ │ └── typedefs.ts
│ └── votation
│ ├── index.ts
│ ├── mutation.ts
│ ├── query.ts
│ ├── typedefs.ts
│ └── utils.ts
├── server.ts
├── index.ts
Above is an example of the project's desired structure. A few rules for the project structure:
- Each package, defined by its functionality, can include the files,
typedefs.ts
,query.ts
,mutation.ts
andsubscription.ts
. - Each package includes an
index.ts
which exports everything from each of the files in rule 1. - Each package should have a
__tests__
folder which includes tests for the corresponding package - Each package can include additional files/folders for mocking, utils functions and etc. Utils functions, filtering and etc should be unit tested.
- If a file becomes too large, create a folder with the filename and split the code up inside this folder. Below is an example if
query.ts
inside of the votation package becomes too large.query/index.ts
should export its members content.
src/schema/votation
├── index.ts
├── mutation.ts
├── query
│ ├── alternative.query.ts
│ ├── vote.query.ts.ts
│ └── index.ts
├── typedefs.ts
└── utils.ts