Giter Club home page Giter Club logo

zen's Introduction

โ›ฉ Zen โ›ฉ

Nest + Prisma + Angular ๐Ÿฎ Full Stack GraphQL Starter Kit


What is really nice about Nest and Angular is that their programming idioms carry over seamlessly between the two, allowing for frontend devs to contribute to the backend. Though, there are complexities in creating the GraphQL endpoint that exposes the various CRUD operations over the Prisma data model on the backend. A combination between Nest + Prisma + Angular has provided for new capabilities that the industry has not really seen before. This project code generates all the boilerplate required in bridging these 3 technologies together.

There is a tremendous amount of value to be gained by treating the schema.prisma file as the single source of truth and then code generating everything else from that. It guarantees consistency between the frontend and backend. It also centralizes the CRUD operations over all the Prisma models via a single import endpoint.

This project also provides solutions for the hardest parts of user authentication as well. I have strictly kept to the Angular and Nest best practices that are being utilized within the ecosystem. This project is an attempt to package the sum total of all the lessons I have learned and making it publicly available to the community. All the services being generated should be fairly self explanatory and lots of useful npm scripts have been provided for the various stages of development to deployment. Better documentation will come with time. ๐Ÿœ

๐ŸŽ New contributors are welcome!


๐Ÿฃ Project Setup Instructions - GitHub Repo

Requirements

# Project setup steps
git clone https://github.com/ZenSoftware/zen.git --depth=1
cd zen
cp .env.example .env

# Substitute npm for pnpm if you are using that
npm i
docker-compose up -d
npm run prisma:migrate
# Start the Nest API
npm run start:api

# Start the Angular site at localhost:4200
npm start
# Reload Apollo VSCode extension via command palette
>Apollo: Reload schema

๐Ÿฅข GraphQL Features


๐Ÿฑ API Authentication, Performance & Scaling

  • Nest authentication, user registration and login system designed specifically to work for an Angular SPA (single page application). This project provides responsive, "mobile first" interfaces for the standard set of authentication features.
  • New account component
  • Login component with remember me option.
  • Sign in with Google via OpenID Connect.
  • Forgot password component and full password reset flow.
  • Password change component for user dashboards.
  • Nest guards & directives for both RBAC & ABAC authorization schemes. ABAC is implemented with @casl/prisma & @casl/angular. The user's Casl rules are sent from the server to the client and updates the @casl/angular ability. This unifies the permissions across both the server and the client. Fully exploiting Casl's isomorphic capabilities.
  • Angular route guards and Angular directives to show/hide content depending on the user's roles or Casl abilities.

๐Ÿต Modern Web Components and Responsive UIs

  • SASS chosen as the CSS transpiler of choice.
  • Angular Material components & theme.
  • Mobile first approach to build the framework's core components (login form, etc).
  • Directly import Bootstrap reset, utilities, & grid features through SCSS imports and exclude the Bootstrap theme and conflicting component styles. These features are missing from Angular Material and greatly simplify the creation of responsive, mobile first applications.
  • Bootswatch SCSS variables integrated for a large assortment of high quality color themes to choose from.

๐ŸŽ Optional Tech Integrations

  • Electron branch with new npm script npm run start:electron to launch the app within Electron.
  • Capacitor branch - planned
  • SocketIO branch demonstrates how to implement a Nest WebSocket Gateway with user authentication.
  • Kendo UI branch - which includes @zen/grid. <zen-grid> renders robust and reliable data grids over all of the Prisma models within the project, with minimal configuration needed.
  • OpenTelemetry branch demonstrates how to integrate and expose telemetry data for the API server.

๐Ÿก Developer Operations

  • Nx for project management to allow for the use of Nx Console extensions for VSCode. Nx Console is a GUI interface for monorepos that adds a lot of modern developer conveniences. It also helps to simplify the use of the various Angular & Nest code generation schematics available in the ecosystem.
  • Strict typings with Typescript for everything. Even the code generation tools are written in Typescript.
  • Angular Language Service for VSCode for modern IDE tooling.
  • npm scripts for versioned releases of the Nest api server as a containerized Docker image. node:18-alpine is used as the Docker container base image and the appropriate tsconfig.app.json configurations are being applied for the Nest app.
  • Example Kubernetes deployment scripts.
  • Enforced code formatting via Prettier & import-sort, guaranteeing all contributions to the project are standardized with predictable structure and clear legibility.
  • Commitizen for standardizing git commits.
  • @nestjs-modules/mailer for automated emailing and pre-configured Handlebars e-mail templates for the various web portal's emailing needs. Handlebars has similar double bracket {{contextField}} template interpolation, akin to Angular templates. Custom HTML e-mail triggers within Nest are made very simple by simply passing a JSON context and the template's filename as parameters to the class injectable MailService.
  • Compodoc to generate Nest & Angular documentation.

zen's People

Contributors

github-actions[bot] avatar zensoftware avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.