A simple starter template for building Nest.js applications with pre-configured tools like Husky, Codegen, and TypeORM.
Before you begin, ensure you have the following tools installed:
Use this template(Recommended) or clone the repository
git clone https://github.com/ankitdev10/nest-starter.git
cd your-repo
pnpm install # npm install or yarn install
Update API_HOST
and API_PORT
variables in your .env
as per your need. If not provided, the server will start on http://localhost/3000
by default.
pnpm start:dev # or yarn start:dev or npm run start:dev
pnpm build # or yarn build or npm run build
pnpm lint # or yarn lint or npm run lint
Update following vairables in your .env
file according to the database you prefer. Example for postgres is shown below:
DB_TYPE=postgres
DB_URL="postgres://<USERNAME>:<PASSWORD>@localhost:5432/<DB_NAME>"
Refactor codegen.json file on the root of the directory to point to your graphql schemas.
pnpm codegen # or yarn codegen or npm run codegen
Once the application is up and running. Open your favorite browser and visit YOUR_ENDPOINT/graphql
to get access to graphql playground. Run the following query to test the server.
query {
greet(name: "YOUR_NAME")
}
This query as the name suggests, welcomes you to the graphql world.