Skip to content

ahmetfturgut/nestjs-server

Repository files navigation

Medium Level NestJS Project

The project is an example of a medium-level application developed using NestJS. The project includes the following features:

Directory structure

Overview

Project src structure directories.

src/
├─ app/
│  ├─ _common/
|  |  ├─ api/
|  |  ├─ enum/
|  |  ├─ model/
|  |  ├─ repository/
|  |  |  ├─ repository.ts
|  |  ├─ service/
|  |  |  ├─ service.ts
│  ├─ auth/
│  ├─ ...
│  ├─ email/
│  ├─ ...
│  ├─ user/
|  |  ├─ dto
|  |  ├─ enum
|  |  ├─ test
|  |  ├─ user.controller.ts
|  |  ├─ user.model.ts
|  |  ├─ user.module.ts
|  |  ├─ user.repository.ts
|  |  ├─ user.service.ts
│  ├─ app.module.ts
├─ core/
│  ├─ decorators/
|  |  ├─ authenticated-user.decorator.ts
|  |  ├─ public.decorator.ts
|  |  ├─ user-type.decorator.ts
│  ├─ environment/
|  |  ├─ config.ts
│  ├─ filters/
|  |  ├─ all-exception.filter.ts
|  |  ├─ http.exception.ts
│  ├─ guards/
|  |  ├─ jwt-auth.guard.ts
|  |  ├─ user-type.guard.ts
│  ├─ middlewares/
|  |  ├─ logger.middleware.ts
│  ├─ pipes/
|  |  ├─ validation.pipe.ts
│  ├─ strategy/
|  |  ├─ jwt.strategy.ts
│  ├─ tools/
   │  ├─ crypto.util.ts
│  ├─ app.module.ts
├─ mail.ts
└─

Installation and Setup

Install project dependencies using the following command.

npm install

Then, create an example .env file and add the necessary environmental variables before running the project.

cp example.env .env

Running

Start the project with the following command

npm run start

Testing

Use the following command to test the project.

npm run test

Usage

After successfully starting the project, you can access the API at http://localhost:3000.

Logging

Learn more about logging using Nest-Winston.

Validation

Request data validation using Class-Validator.

JWT (JSON Web Token)

Explore authentication and authorization using JWT (JSON Web Token).

Swagger

Get detailed information about API documentation using Swagger.

Middleware

Understand the concept of middleware using Middleware.

Exception Filters

Learn about exception filters using Exception Filters.

Pipes

Understand the concept of pipes using Pipes.

Guards

Explore the concept of guards using Guards.

Interceptors

Learn about interceptors using Interceptors.

Custom Decorators

Discover custom decorators using Custom Decorators.

Inspirations