A progressive Node.js framework for building efficient and scalable server-side applications.
Nest framework TypeScript starter repository.
-
Prepare
.env:- On Unix:
cp .env.example .env
- On Windows:
copy .env.example .env
-
Install dependencies:
yarn install
-
Start the Docker containers (
docker-compose.yml):docker compose up -d
-
Migrate the database:
yarn migrations:run
# development
$ yarn run start
# watch mode
$ yarn run start:dev
# production mode
$ yarn run start:prod# unit tests
$ yarn run test
# e2e tests
$ yarn run test:e2e
# test coverage
$ yarn run test:covPay attention that you need a JWT to perform any query or mutation. The email below (test@gmail.com) will be an admin upon registration.
Details
register():
mutation {
register(input: {
email: "test@gmail.com"
password: "qwerty"
}) {
id
email
role
}
}The email must be unique.
login():
mutation {
login(input: {
email: "test@gmail.com"
password: "qwerty"
}) {
accessToken
}
}Get the JWT from response and add the Authorization header as Bearer token_here.
makeUserAdmin():
mutation {
makeUserAdmin(input: {
userId: "111da7d6-330d-4eaa-b283-b81e5c00665b"
}) {
id
email
role
}
}You cannot make yourself an admin. You need to be admin to create/update/delete entities.
createAuthor():
mutation {
createAuthor(input: {
name: "Test Author 1"
biography: "Test biography"
}) {
id
name
biography
}
}Name must be unique.
updateAuthor():
mutation {
updateAuthor(id: "7a63b138-970e-4178-949c-3af099c3aac0", input: {
name: "Test Author 1 Edited"
biography: "Test biography edited"
}) {
id
name
biography
}
}deleteAuthor():
mutation {
deleteAuthor(id: "7a63b138-970e-4178-949c-3af099c3aac0")
}createBook():
mutation {
createBook(input: {
authorId: "de7d6b9e-210b-4247-8820-3127ae1e1074"
title: "Test Book 1"
publicationDate: "2025-04-24T15:16:50.814Z"
genre: "Horror"
}) {
id
title
genre
publicationDate
author {
id
name
biography
}
}
}updateBook():
mutation {
updateBook(id: "fdce3070-93f3-4ae3-befd-0d1886c2d412", input: {
title: "Test Book 1 Edited"
genre: "Thriller"
}) {
id
title
genre
publicationDate
author {
id
name
biography
}
}
}deleteBook():
mutation {
deleteBook(id: "fdce3070-93f3-4ae3-befd-0d1886c2d412")
}Details
author():
query {
author(id: "de7d6b9e-210b-4247-8820-3127ae1e1074") {
id
name
biography
booksCount
}
}getAuthors():
query {
getAuthors(input: {
booksCount: 1
name: "Test"
sortBy: name
sortOrder: "ASC"
limit: 10
page: 1
}) {
data {
id
name
biography
booksCount
}
page
pageSize
total
totalPages
}
}book():
query {
book(id: "a9c0cb45-fe75-4e66-9a57-43af53fd781e") {
id
title
genre
publicationDate
author {
id
name
biography
}
}
}getBooks():
query {
getBooks(input: {
author: "Test"
title: "Test"
publicationYear: 2025
sortBy: title
sortOrder: "ASC"
limit: 10
page: 1
}) {
data {
id
title
genre
publicationDate
author {
id
name
biography
}
}
page
pageSize
total
totalPages
}
}me():
query {
me {
id
email
role
}
}getUser():
query {
getUser(input: {
id: "7c5ef962-3250-4d36-8aed-163d4b6e57d3"
email: "test@gmail.com"
}) {
id
email
role
}
}By email or by ID.
Nest is MIT licensed.