/Nestjs-Backend-Server

This is just a nestjs backend server that is hosted on vercel with all the database connection with postgres and been deployed on elephantsql

Primary LanguageTypeScript

Project Name: Nestjs-Backend-Server

This project is a NestJS-based backend application, featuring GraphQL API endpoints and a Swagger UI for API documentation. It's deployed on Vercel and utilizes a PostgreSQL database hosted on Railway.

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Descriptionw

Nest framework TypeScript starter repository.

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Run Docker Compose:

# Build a Container
npm run start:dev

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Features

  • GraphQL API with Mercurius integration
  • Swagger UI for RESTful API documentation
  • Dockerized environment for development
  • Vercel serverless deployment
  • Railway PostgreSQL database integration

Prerequisites

  • Node.js (v16+)
  • Docker (for local development)
  • Vercel CLI (for deployment)
  • Railway account (for database)

Local Development Setup

  1. Clone the repository:
    git clone https://github.com/Milan-960/Nestjs-backend.git
    # and
    cd Nestjs-backend

Database Setup on Railway

  • Create a new PostgreSQL database on Railway.
  • Configure the environment variables in .env file with your Railway database credentials.

GraphQL Playground

Access the GraphQL playground at http://localhost:3000/graphql when running locally.

Swagger UI

Access the Swagger UI for RESTful API documentation at http://localhost:3000/api

API Endpoints

Describe your GraphQL and RESTful API endpoints here.

┣ 📂src
 ┃ ┣ 📂config                # Configuration files and services
 ┃ ┣ 📂dtos                  # Data Transfer Objects
 ┃ ┣ 📂entities              # Database entities
 ┃ ┣ 📂graphql               # GraphQL related files
 ┃ ┃ ┣ 📂pubsub              # PubSub module for subscriptions
 ┃ ┃ ┗ 📜...                # Other GraphQL-related files
 ┃ ┣ 📂migrations            # Database migration files
 ┃ ┣ 📂modules               # Application modules
 ┃ ┃ ┗ 📂sample              # Example module (can have many such modules)
 ┃ ┣ 📜app.controller.ts     # Main application controller
 ┃ ┣ 📜app.module.ts         # Main application module
 ┃ ┣ 📜app.service.ts        # Main application service
 ┃ ┗ 📜main.ts               # Entry point of the application
 ┣ 📂test
 ┃ ┗ 📜...                  # Test files
 ┣ 📜.env                    # Environment variables
 ┣ 📜...                     # Other configuration and setup files