All Projects → yantrab → nest-angular

yantrab / nest-angular

Licence: other
Full-stack with nest js & angular 8

Programming Languages

typescript
32286 projects
HTML
75241 projects
SCSS
7915 projects

Projects that are alternatives of or similar to nest-angular

Testing Nestjs
A repository to show off to the community methods of testing NestJS including Unit Tests, Integration Tests, E2E Tests, pipes, filters, interceptors, GraphQL, Mongo, TypeORM, and more!
Stars: ✭ 685 (+2040.63%)
Mutual labels:  mongo, nestjs
ionic4-image-crop-upload
Ionic 4, Angular 7 and Cordova Crop and Upload Image
Stars: ✭ 16 (-50%)
Mutual labels:  cordova, angular7
Node Typescript Mongodb
node js typescript mongodb express generator yo
Stars: ✭ 96 (+200%)
Mutual labels:  mongo, generator
nest-js-boilerplate
Nest.js boilerplate
Stars: ✭ 79 (+146.88%)
Mutual labels:  generator, nestjs
server-next
😎 The next generation of RESTful API service and more for Mix Space, powered by @nestjs.
Stars: ✭ 43 (+34.38%)
Mutual labels:  mongo, nestjs
Stator
Stator, your go-to template for the perfect stack. 😍🙏
Stars: ✭ 217 (+578.13%)
Mutual labels:  generator, nestjs
nestjs-api-mongoose
Collection example apps with NestJS and Typeorm, Sequelize, Mongodb, PostgreSQL, MySQL, GraphQL, Mercurius, etc. for the NestJS community 😻
Stars: ✭ 153 (+378.13%)
Mutual labels:  mongo, nestjs
Nest User Auth
A starter build for a back end which implements managing users with MongoDB, Mongoose, NestJS, Passport-JWT, and GraphQL.
Stars: ✭ 145 (+353.13%)
Mutual labels:  mongo, nestjs
TASK-Management-System
Spring Boot and Angular 7 web application for task management .
Stars: ✭ 34 (+6.25%)
Mutual labels:  angular-material, angular7
Angular-Cordova-Google-PlayStore-Publish
How to publish Angular app to Google Play Store using Cordova
Stars: ✭ 25 (-21.87%)
Mutual labels:  cordova, angular7
Covalent
Teradata UI Platform built on Angular Material
Stars: ✭ 2,230 (+6868.75%)
Mutual labels:  angular-material, angular7
nx-ng-nest-universal
Nx Workspace with a seperated Nest App for Angular Universal SSR.
Stars: ✭ 32 (+0%)
Mutual labels:  nestjs, angular7
Angular-Movies
Angular Movies | TV Shows is a simple web app that consumes The Movie DB API - Angular 13 + Material Angular
Stars: ✭ 35 (+9.38%)
Mutual labels:  angular-material, angular7
Generator Ngx Rocket
🚀 Extensible Angular 11+ enterprise-grade project generator
Stars: ✭ 1,329 (+4053.13%)
Mutual labels:  cordova, generator
ionic4-angular7-example
Ionic 4, Angular 7 and Cordova Tutorial: Build CRUD Mobile Apps
Stars: ✭ 57 (+78.13%)
Mutual labels:  cordova, angular7
blog3.0
博客V3.0 目前使用的技术(Nuxtjs + Nestjs + Vue + Element ui + vuetify),存储(MongoDB + Redis + COS)
Stars: ✭ 37 (+15.63%)
Mutual labels:  mongo, nestjs
angular-enterprise-application-development-samples
Angular Enterprise Application Development Samples. 《Angular企业级应用开发实战》源码
Stars: ✭ 38 (+18.75%)
Mutual labels:  angular-material, angular7
ListBot
ListBot is a Discord Bot which let's you create community lists on each channel.
Stars: ✭ 22 (-31.25%)
Mutual labels:  mongo
daruma-backend
🎎 Shared Expense Manager (Backend) - NestJS+DDD+CQRS+Event Sourcing 🎎
Stars: ✭ 70 (+118.75%)
Mutual labels:  nestjs
setup-ionic
Set up your GitHub Actions workflow with Cordova/Ionic environment
Stars: ✭ 23 (-28.12%)
Mutual labels:  cordova

nest-angular-starter

This is a repo for a starter appliation for a Single Page MEAN Stack application includes nest js + fastify + http2 + angular 7 + angular material + client api generator.

Installation

git clone https://github.com/yantrab/nest-angular.git
cd .\nest-angular
npm i

To use ssl with localhost, open cmd one level above the root and run:

choco install mkcert
mkcert localhost
mkcert -install

debug server

npm run debug-server

build client

npm run build-client

Run both server&client

npm run dev

Hit F5 and select the process

client api generator

server controller:

@Controller('rest/auth')
export class AuthController {
    @Post('login')
    async login(@Body() user: LoginRequest, @Req() req): Promise<User> {
        return req.user;
    }
    @Get('getUserAuthenticated')
    async getUserAuthenticated(@Req() req): Promise<{ user: User }> {
        return { user: req.user };
    }
}

run

npm run gen-client

result:

@Injectable()
export class AuthController {
    async login(user: LoginRequest): Promise<User> {
        return new Promise(resolve =>
            this.api.post('rest/auth/login', user).subscribe((data: any) => resolve(plainToClass(User, <User>data))),
        );
    }
    async getUserAuthenticated(): Promise<{ user: User }> {
        return new Promise(resolve => this.api.get('rest/auth/getUserAuthenticated').subscribe((data: any) => resolve(data)));
    }
    constructor(private readonly api: APIService) {}
}

Cordova

cd client
npm run cordova:init
npm run build:prod:cordova
npm run cordova:run:browser

class-transformer

User class

export class User extends Entity {
    fName: string;
    lName: string;
    roles: Role[];
    get fullName() {
        return this.fName + ' ' + this.lName;
    }
}

By using class-tranformer (auto generate), you can do:

this.authService.login(this.form.value).then(user => {
    console.log(user.fullName);
});

Shared validation using class-validator

decorate the class with validations:

export class LoginRequest {
    @IsEmail()
    email: string

    @Length(6,10)
    password: string
}
})

server validation

just use validation pipe

client validation

  constructor(private dynaFB: DynaFormBuilder) {
    this.dynaFB.buildFormFromClass(LoginRequest).then(form => this.form = form);
  }

polymorphism

By inheritance from Poly class you can do the next thing:

 // Class decleration
 export abstract class Filter extends Poly {}
 export class CheckboxFilter extends Filter{}
 export class DropdownFilter extends Filter{}

 @Component({
  selector: 'mf-root',
  template: `
  <div fxLayout='column' fxFlex='200px'>
    <p-filter [filter]="filter1"></p-filter>
    <p-filter [filter]="filter2"></p-filter>
  <div>
  `,
  styles: []
})
export classMFComponent {
  filter1: Filter;
  filter2: Filter;
  constructor() {
    this.filter1 =
      new CheckboxFilter({ options: [{ _id: '1', name: 'name1' }, { _id: '2', name: 'name2' }], selected: { _id: '2', name: 'name2' } });
    this.filter2 =
      new DropdownFilter({ options: [{ _id: '1', name: 'name1' }, { _id: '2', name: 'name2' }], selected: { _id: '2', name: 'name2' } });
  }
}

Future

-- Client generator with full types.

-- Auto transform result to real object

-- Share models between server & client

recomended vscode extensions

  1. Angular Language Service
  2. angular2-inline
  3. SCSS Formatter
  4. TSLint

First deploy

sudo apt-get update sudo apt-get install git sudo apt-get install nodejs sudo apt-get install npm git clone https://github.com/yantrab/nest-angular.git

//DB https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-debian-9

sudo ufw allow from 62.219.113.155/32 to any port 27017 sudo ufw allow from 10.110.0.3/32 to any port 27017 sudo iptables -A INPUT -s 188.64.207.118 -p tcp --destination-port 27017 -m state --state NEW,ESTABLISHED -j ACCEPT sudo iptables -A OUTPUT -d 188.64.207.118 -p tcp --source-port 27017 -m state --state ESTABLISHED -j ACCEPT sudo systemctl restart mongod

echo "export const macroConf = { db: { user: '?', password: '?', server: '?', database: '?', debug: false, max: 500, min: 0, idle: 5000, acquire: 20000, evict: 30000, handleDisconnects: true, connectionTimeout: 300000, requestTimeout: 300000, } }; " > config.ts

##Depoly adduser yaniv usermod -aG sudo yaniv apt update apt install ufw ufw allow OpenSSH ufw enable ufw status ssh yaniv@your_server_ip

sudo apt update sudo apt install nginx sudo ufw allow 'Nginx HTTP' sudo ufw status systemctl status nginx

sudo apt install curl curl -sL https://deb.nodesource.com/setup_10.x -o nodesource_setup.sh sudo bash nodesource_setup.sh sudo apt install nodejs sudo apt install git git config --global user.name "yantrab" git config --global user.email "[email protected]" mkdir tador cd tador git clone https://github.com/yantrab/nest-angular.git cd nest-angular npm i

// copy dist from windows

scp -r dist [email protected]:/home/yaniv/tador/nest-angular/client scp -r dist [email protected]:/home/yaniv/tador/nest-angular/client

sudo npm install pm2@latest -g cd server pm2 start npm -- start sudo nano /etc/nginx/sites-available/default

server { ... location / { proxy_pass http://localhost:4200; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } ... }

sudo systemctl reload nginx

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].