Zen is a starter kit to build web portals as a stateful single-page application. This kit has everything needed for building a customized user experience utilizing only TypeScript & GraphQL. The project has end-to-end typings and this is achieved by combining several code generation packages together.
Specifically, this is an Nx integrated monorepo, utilizing Angular for the frontend, Nest for the backend, and Prisma for the data persistence solution. Apollo is deeply integrated throughout the entire tech stack, enabling for a modern approach to communication between the client and the server via GraphQL.
The project implements a fully featured authentication & authorization system with a minimalistic implementation. This includes a login component, registration component, password change component and a fully featured password reset flow. All of this while only having 1 model within the schema.prisma
file, the User
model. Guards & directives are also integrated for both RBAC & ABAC authorization schemes and can be used in conjunction. Everything needed for a malleable and robust user management system has been wired up for you.
๐ Everything is written in TypeScript, even code generation scripts are written in TypeScript.
๐๏ธ End-to-end type safety. Code generation is preconfigured and polished to perfection.
๐ฒ 100% responsive design.
๐ป 100% cross-platform. Develop on any OS and deploy to any OS, including mobile.
โพ๏ธ Minimal number of concepts required to understand. Unifying as many solutions as possible such that they are isomorphic between the frontend and backend.
๐ Modern developer conveniences with high quality Visual Studio Code extensions preconfigured for the project.
๐งฐ Nx Console VSCode extension is the UI for all Nx workspaces. This really helps to simplify the usage of the varying Angular & Nest schematics available in the ecosystem.
โค๏ธ Angular Language Service for VSCode enables sophisticated IDE tooling over all Angular templates.
๐ Apollo extension for VSCode is preconfigured and enables code completion for gql
tags.
๐ฐ๏ธ apollo-angular is our GraphQL client for Angular. This project code generates everything needed so that all queries/mutations are ready for dependency injection within Angular and are strictly typed.
๐โโฌ @nestjs/graphql - Schema first is an exceptional way of building GraphQL servers. This project configures and code generates everything needed to create a GraphQL server with end-to-end type safety.
๐ต Pal.js Generator - SDL first to help generate the GraphQL API for Prisma. Pal.js - Select to solve the GraphQL N+1 problem for all queries for free.
๐ Purpose-built user authentication & authorization modules. Full suite of authorization components, guards & directives for both Angular & Nest to tailor showing/hiding content and accepting/denying requests for a given user.
๐งผ Enforced linting and formatting rules to ensure all contributions have predictable structure and clear legibility.
๐ Storybook is integrated to catalogue available components and makes it much simpler for discoverability of reusable components.
๐พ Example deployment scripts to Kubernetes and instructions on setting up a local Kubernetes cluster for testing purposes.
โ๏ธ Feature branches are available to git merge
to enable features such as data grids, telemetry, or SocketIO.
๐ Seamless communication with the API server. Interceptors have been inserted before all client service network calls to automatically handle authorization. This in combination with the end-to-end type safety for all GraphQL requests makes communicating with the server incredibly simple.
๐งช Jest as the testing framework. Clean output for results and extraordinarily versatile with @nx/jest as the test runner.
๐จ Modern responsive components & theme with SASS (.scss) as the CSS transpiler of choice.
Requirements
We are utilizing pnpm as our package manager. Though, you can utilize npm if you prefer by running the equivalent npm commands.
# Project setup steps
git clone https://github.com/ZenSoftware/zen.git
cd zen
# Make a copy of the .env file
cp .env.example .env
# Install node modules
pnpm i
# Start the PostgreSQL server
docker-compose up -d
# Run the initial Prisma migration
pnpm prisma:migrate
# Start the Nest API
pnpm start:api
# Start the Angular app at localhost:4200
pnpm start
# Reload Apollo VSCode extension via command palette after the API has started
>Apollo: Reload schema
gql
tags for all .ts
files.GraphQLModule
to simplify the configuration of the ApolloClient
to enable/disable the varying ApolloLink
features.
ApolloClient
HTTP multi-part form requests capabilities. Enabling the uploading of files via GraphQLUpload.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.@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.start:electron
to launch the app within Electron.<zen-grid>
renders robust and reliable data grids over all of the Prisma models within the project, with minimal configuration needed.tsconfig.app.json
configurations are being applied for the Nest app.{{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
.