Files organisation

To keep things well structured, we will slip our code in different folders in packages/api.

  • / project configuration files

  • src all the code we write for the app.

    • config one file per environment.

    • entities our data models.

    • migrations if we need to alter the database.

    • routers one folder per route.

This is the final files structure:

.
β”œβ”€β”€ jest.config.js
β”œβ”€β”€ package.json
β”œβ”€β”€ src
β”‚Β Β  β”œβ”€β”€ app.ts
β”‚Β Β  β”œβ”€β”€ config
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ci.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ index.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ local.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ production.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ shared.ts
β”‚Β Β  β”‚Β Β  └── staging.ts
β”‚Β Β  β”œβ”€β”€ containers.ts
β”‚Β Β  β”œβ”€β”€ coverage
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Emoji.ts.html
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ base.css
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ containers.ts.html
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ index.html
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ prettify.css
β”‚Β Β  β”‚Β Β  └── sort-arrow-sprite.png
β”‚Β Β  β”œβ”€β”€ entities
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Link.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ User.ts
β”‚Β Β  β”‚Β Β  └── index.ts
β”‚Β Β  β”œβ”€β”€ index.ts
β”‚Β Β  β”œβ”€β”€ middlewares
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ RateLimiter
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ index.spec.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── index.ts
β”‚Β Β  β”‚Β Β  └── index.ts
β”‚Β Β  β”œβ”€β”€ migrate.ts
β”‚Β Β  β”œβ”€β”€ migrations
β”‚Β Β  β”‚Β Β  └── 001_example.ts
β”‚Β Β  β”œβ”€β”€ routers
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Emoji
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ index.spec.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── index.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ GraphQL
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ helpers
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ PaginatedArgs.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ PaginatedResponse.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”‚Β Β  └── index.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ index.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── resolvers
β”‚Β Β  β”‚Β Β  β”‚Β Β      β”œβ”€β”€ Health.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β      β”œβ”€β”€ Link
β”‚Β Β  β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ Link.spec.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ Link.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ LinkInput.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β      β”‚Β Β  └── index.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β      β”œβ”€β”€ User
β”‚Β Β  β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ User.spec.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ User.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ UserAuthInput.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β      β”‚Β Β  └── index.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β      └── index.ts
β”‚Β Β  β”‚Β Β  └── index.ts
β”‚Β Β  β”œβ”€β”€ sequelize.ts
β”‚Β Β  └── setupTests.ts
β”œβ”€β”€ tsconfig.json
β”œβ”€β”€ tslint.json
└── yarn.lock

Last updated

Was this helpful?