💻
Building and hosting a WebApp
  • Getting started
  • Project setup
    • Requirements
    • Files organisation
    • Lerna
    • Linter
    • Prettier
    • GitHook
    • Testing
    • Conclusion
  • Backend
    • Files organisation
    • Environment config
    • Express API
    • Security
    • Database
    • GraphQL
    • User authentication
    • Conclusion
  • Frontend
    • Create React App
    • Files organisation
    • Styles
    • Apollo Hooks
    • Form management
    • User authentication
    • Writing tests
    • Types generation
    • Conclusion
  • DevOps
    • CI/CD
    • AWS
      • Managing secrets
      • Pricing
      • RDS
      • S3
      • Route53
      • CloudFront
      • Serverless
      • Security
      • CloudFormation
    • Conclusion
  • 🚧Stripe payment
  • 🚧File upload
Powered by GitBook
On this page

Was this helpful?

  1. Backend

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
PreviousBackendNextEnvironment config

Last updated 5 years ago

Was this helpful?