Skip to content

saifwarraich/boilerplate-graphql-typescript-project

Repository files navigation

Typescript Sample Project (GraphQL)

Packages

  • typeorm @0.3.10 (with migrations)
  • type-graphql @1.1.1
  • typedi @0.10.0 (For Dependency Injection)
  • jsonwebtoken @8.5.1
  • apollo-server-express @3.11.1
  • class-validator @0.13.2

Important Commands

  • yarn to install all the dependencies
  • yarn dev to run nodemon development server
  • yarn build to compile typescript code
  • yarn start to run compiled code
  • TableName=<name> yarn migration:create to create migration
  • yarn local-migration:run to run migrations in dev
  • yarn local-migration:revert to revert migrations in dev
  • yarn prod-migration:run to run migrations on production
  • yarn prod-migration:revert to revert migrations on production

Project Structure

.
β”œβ”€β”€ dist                               # Compiled files
β”œβ”€β”€ src                                # Source files
β”‚   β”œβ”€β”€ db                             # All Database related files
β”‚   β”‚   β”œβ”€β”€ entities                   # All Database Entities
β”‚   β”‚   β”œβ”€β”€ migrations
β”‚   β”‚   └── index.ts                   # Database Maneger
β”‚   β”œβ”€β”€ errors
β”‚   β”œβ”€β”€ middlewares
β”‚   β”œβ”€β”€ modules                        # All Modules
β”‚   β”‚   β”œβ”€β”€ <name>                     # Entity Name
β”‚   β”‚   β”‚   β”œβ”€β”€ <name>.resolver.ts     # All queries and Mutation related to the entity
β”‚   β”‚   β”‚   β”œβ”€β”€ service.ts             # Service class of entity
β”‚   β”‚   β”‚   └── types.ts               # Input and Object types for validation
β”‚   β”œβ”€β”€ types                          # custom types are defined here
β”‚   β”œβ”€β”€ utils                          # utility functions
β”‚   β”œβ”€β”€ index.ts                       # Entry point
β”‚   └── apolloServer.ts                # Apolloserver setup
β”œβ”€β”€ ormconfig.ts                       # DataSource options for typeorm DataScource
β”œβ”€β”€ .lintstagedrc.json                 # Lint Staged Options
β”œβ”€β”€ .prettierrc.json                   # prettier Options
β”œβ”€β”€ dist                               # Pre-Commit Hooks
└── README.md

About

Sample Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages