Starter template for bootstrapping a TypeGraphQL + Apollo Server GraphQL API. The purpose is to help getting started quickly with TypeGraphQL development by providing a runnable API with examples you can build on. Not endorsed by or affiliated with the TypeGraphQL team. Be sure to also check out the TypeGraphQL documentation and examples.
- Install Node.js 14 or later.
git clone https://github.com/lauriharpf/type-graphql-starter.gitto clone this repositorynpm installin project root directorynpm startto start the server- Access Playground with browser, at
http://localhost:4000/by default. Check DOCS for the API definition and try running some queries, e.g.
query Posts {
posts {
id
userId
title
body
}
}
CTRL-Cstops the server
npm testto run testsnpm test -- --coverageto run tests and collect code coveragenpm run lintto lint the project
- TypeGraphQL and its dependencies
- Apollo Server
- Bootstrapping code to start the server
- Example resolvers and Apollo REST Data Sources (posts, users)
- Test infrastructure (ts-jest and nock) with example tests
- ts-node-dev for development (restarts app when code changes)
- typescript-eslint with type-aware rules
- prettier for formatting code (Use
npx prettier --write .or preferably, add integration to your editor) - Github: Dependabot dependency updates, Github Actions CI
After installing and experimenting with the template (see Getting started), customize it to suit your needs:
- Set the
name,version,description,licenseandauthorof your project inpackage.json - Run
npm installto updatepackage-lock.jsonwith the newpackage.jsoncontents - Customize or remove the project-specific files
.github/ISSUE_TEMPLATE/*README.mdCODE_OF_CONDUCT.mdCONTRIBUTING.mdLICENSE
- Run
git remote remove originin the project root directory to remove link to the template repository - Create a new repository, e.g. in Github
- Run
git remote add origin YOUR_REPOSITORY_ADDESSto link with your new repository git push -u origin masterto push the code
Remove the examples under src/posts and src/users when they are no longer useful for you.
According to the TypeGraphQL version in the template.