Skip to content

maurim96/nestjs-graphql-scaffold

Repository files navigation

NestJS GraphQL API

This is the official repository for the NestJS GraphQL API, a robust backend service designed to offer efficient data handling and operations for web and mobile applications.

Overview

This project is structured to facilitate development, testing, and deployment of a GraphQL-based API using NestJS, a progressive Node.js framework. The API is built with a focus on performance, scalability, and ease of use, incorporating various modern tools and practices.

Powered by

React Native logo
Nest.js
Postgresql logo
PostgreSQL
Drizzle logo
Drizzle ORM
GraphQL logo
GraphQL
Clerk logo
Clerk
Sentry logo
Sentry
AWS logo
AWS
AWS logo
Docker

Project Structure

  • src/: The main source directory containing the application logic.
    • config: Configuration files and environment variables.
    • drizzle: Drizzle schema, migration and other related files for database management.
    • graphql: GraphQl module for handling queries and mutations.
  • test/: Contains unit and e2e tests for the application.
  • dist/: The output directory for the compiled application.

Key Technologies

  • NestJS for creating scalable server-side applications.
  • GraphQL for efficient and flexible data queries.
  • TypeScript for static type checking.
  • Drizzle ORM for database access and management.
  • Docker for containerization and easy deployment.
  • Sentry for real-time error tracking and monitoring.
  • AWS for cloud-based resources and logging with CloudWatch.

Features

  • GraphQL API: Offers a powerful, flexible API for querying and mutating data.
  • CRUD Operations: Simplified data manipulation with CRUD operations.
  • Authentication and Authorization: Secure access to the API with integrated authentication and authorization mechanisms.
  • Logging and Monitoring: Integrated logging and monitoring for easy debugging and performance tracking.

Prerequisites

  • Sentry account setup (in order to provide SENTRY_DNS env variable)
  • Clerk account setup (in order to provide CLERK_SECRET_KEY env variable)
  • AWS account setup (in order to provide AWS's env variables)
    • CloudWatch is currently implemented for Logging. If you want, it can be disabled or replaced (code update required)

Repository Setup

Clone the repository and install dependencies:

git clone git@github.com:maurim96/nestjs-graphql-scaffold.git
cd nestjs-graphql-scaffold
npm install

Development Setup

Ensure you have Node.js and Docker installed on your machine. Then follow these steps to set up the project for development:

  1. Install dependencies:
    npm install
    
  2. Start the development database with Docker Compose:
    npm run db:setup:dev
    
  3. Apply database migrations:
    npm run db:migrate:pg
    
  4. Start the development server with hot reload:
    npm run start:dev
    

Testing

To run tests, use the following commands:

  • For unit tests:
    npm test
    
  • For e2e tests:
    npm run test:e2e
    
  • To watch tests:
    npm run test:watch
    

Deployment

Build the application for production by running:

npm run build

Then start the production server:

npm run start:prod

You may notice the codebuild/ directory. This is because it's ready to be connected with a CodePipeline (AWS) setup. For more information you may refer to the official docs.

Contribution Guidelines

Contributions are welcome! Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or fix.
  3. Commit your changes with clear, descriptive messages.
  4. Push your changes and submit a pull request.

Please adhere to the coding standards and commit message guidelines provided in the repository.

License

This project is UNLICENSED. Feel free to use it according to the terms of the license.

About

GraphQl API built with NestJs - Scaffold

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published