ankitdev10 / event-mgmt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nest.js Starter with Husky, Codegen, and TypeORM

A simple starter template for building Nest.js applications with pre-configured tools like Husky, Codegen, and TypeORM.

Table of Contents

Getting Started

Prerequisites

Before you begin, ensure you have the following tools installed:

Installation

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

Usage

Run Development Server

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

Build for production

pnpm build # or yarn build or npm run build

Linting and Formatting

pnpm lint # or yarn lint or npm run lint

Database Setup

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>"

Code Generation

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

Test

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.

About


Languages

Language:TypeScript 94.7%Language:JavaScript 4.1%Language:Shell 1.2%