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.git
to clone this repositorynpm install
in project root directorynpm start
to 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-C
stops the server
npm test
to run testsnpm test -- --coverage
to run tests and collect code coveragenpm run lint
to 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
,license
andauthor
of your project inpackage.json
- Run
npm install
to updatepackage-lock.json
with the newpackage.json
contents - Customize or remove the project-specific files
.github/ISSUE_TEMPLATE/*
README.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
- Run
git remote remove origin
in 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_ADDESS
to link with your new repository git push -u origin master
to 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.