> For the complete documentation index, see [llms.txt](https://tutorial.specian.co.uk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tutorial.specian.co.uk/backend/files-organisation.md).

# 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
```
