2 |
3 |
4 |
5 |
8 | Angular Seed Plug and play Seed application built with ❤️ using Angular5, Redux/ngrx-store4, Observables & ImmutableJs. 9 |
10 | 11 |12 | Check demo | Docs 13 |
14 | 15 | ## [API Doc](https://documenter.getpostman.com/view/1691659/angular-seed/77mY1dq) 16 | 17 | ## What's included? 18 | Currently, this is a fairly basic vesion of the application. We are calling it a pre-alpha release. 19 | 20 | ### What's working and ready to be deployed? 21 | * Authentication (Login/Signup) 22 | * ngrx/store version 4 with lazy loaded feature added. 23 | * Auth Guard for route. 24 | * Toasty notification. 25 | * Bootstrap 4 beta 2. 26 | * Progress Bar for http requests. 27 | * Angular animation implemented for login form. 28 | 29 | ## Development server 30 | 31 | Run `yarn start` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 32 | 33 | ## Code scaffolding 34 | 35 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 36 | 37 | ## Build 38 | 39 | Run `yarn build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build. 40 | 41 | ## Prod Build 42 | Run `yarn build:prod` to build the project. The build artifacts will be stored in the `dist/` directory. 43 | 44 | ## Running unit tests 45 | 46 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 47 | 48 | ## Running end-to-end tests 49 | 50 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 51 | 52 | ## Who are we? 53 | 54 | We are [Aviabird Technologies](https://aviabird.com). 55 | 56 | __We love to create awesome Web & Mobile products.__ 57 | 58 | __We are very proud of our work.__ 59 | 60 | We love technologies like Golang, Elixir, Scala, Ruby, Javascript, Typescript, Swift, Java. 61 | 62 | We love some frameworks too:- 63 | * Ruby On Rails 64 | * Phoenix/Elixir framework. 65 | * Spring framework. 66 | * AngularJs (1.x+ & 2.x+) 67 | * ReactJs 68 | * BackboneJs 69 | 70 | ### We are avialible for hire 71 | -------------------------------------------------------------------------------- /e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('Angular Seed App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Welcome to app!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "hosting": { 3 | "public": "dist", 4 | "rewrites": [ 5 | { 6 | "source": "**", 7 | "destination": "/index.html" 8 | } 9 | ], 10 | "headers": [ 11 | { 12 | "source": "**/*", 13 | "headers": [ 14 | { 15 | "key": "Content-Security-Policy", 16 | "value": "script-src 'self' 'nonce-2726c7f26c' www.googletagmanager.com cdnjs.cloudflare.com www.google-analytics.com" 17 | }, 18 | { 19 | "key": "X-Frame-Options", 20 | "value": "SAMEORIGIN" 21 | }, 22 | { 23 | "key": "X-XSS-Protection", 24 | "value": "1; mode=block" 25 | } 26 | ] 27 | }, 28 | { 29 | "source": "**/*.@(jpg|jpeg|gif|png|svg)", 30 | "headers": [ 31 | { 32 | "key": "Cache-Control", 33 | "value": "max-age=2592000" 34 | } 35 | ] 36 | }, 37 | { 38 | "source": "**/*.@(js|css)", 39 | "headers": [ 40 | { 41 | "key": "Cache-Control", 42 | "value": "max-age=691200" 43 | } 44 | ] 45 | }, 46 | { 47 | // Sets the cache header for 404 pages to cache for 5 minutes 48 | "source": "404.html", 49 | "headers": [ 50 | { 51 | "key": "Cache-Control", 52 | "value": "max-age=300" 53 | } 54 | ] 55 | } 56 | ] 57 | } 58 | } -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular/cli'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular/cli/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | angularCli: { 23 | environment: 'dev' 24 | }, 25 | reporters: ['progress', 'kjhtml'], 26 | port: 9876, 27 | colors: true, 28 | logLevel: config.LOG_INFO, 29 | autoWatch: true, 30 | browsers: ['Chrome'], 31 | singleRun: false 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ng2-seed", 3 | "version": "0.0.0", 4 | "license": "MIT", 5 | "scripts": { 6 | "ng": "node_modules/@angular/cli/bin/ng", 7 | "start": "ng serve --host 0.0.0.0 --port 4200", 8 | "build": "ng build", 9 | "test": "ng test", 10 | "bundle-report": "webpack-bundle-analyzer dist/stats.json", 11 | "compodoc": "./node_modules/.bin/compodoc -p src/tsconfig.app.json -d docs/", 12 | "build:prod": "ng build --target production --aot --build-optimizer --extract-css --output-hashing all", 13 | "test:prod": "cd dist && python -m SimpleHTTPServer 8800", 14 | "lint": "ng lint", 15 | "e2e": "ng e2e" 16 | }, 17 | "private": true, 18 | "dependencies": { 19 | "@angular/animations": "^5.0.0", 20 | "@angular/common": "^5.0.0", 21 | "@angular/compiler": "^5.0.0", 22 | "@angular/core": "^5.0.0", 23 | "@angular/forms": "^5.0.0", 24 | "@angular/http": "^5.0.0", 25 | "@angular/platform-browser": "^5.0.0", 26 | "@angular/platform-browser-dynamic": "^5.0.0", 27 | "@angular/router": "^5.0.0", 28 | "@compodoc/compodoc": "^1.0.1", 29 | "@ngrx/core": "^1.2.0", 30 | "@ngrx/effects": "^4.1.0", 31 | "@ngrx/router-store": "^4.1.0", 32 | "@ngrx/store": "^4.1.0", 33 | "@ngrx/store-devtools": "^4.0.0", 34 | "bootstrap": "^4.0.0-beta.2", 35 | "core-js": "^2.4.1", 36 | "font-awesome": "^4.7.0", 37 | "immutable": "^3.8.2", 38 | "ng2-toasty": "^4.0.3", 39 | "ngrx-store-freeze": "^0.2.0", 40 | "ngx-bootstrap": "~1.9.3", 41 | "ngx-progressbar": "^2.1.1", 42 | "reselect": "^3.0.1", 43 | "rxjs": "^5.5.0", 44 | "web-animations-js": "^2.3.1", 45 | "zone.js": "^0.8.14" 46 | }, 47 | "devDependencies": { 48 | "@angular/cli": "1.5.0", 49 | "@angular/compiler-cli": "^5.0.0", 50 | "@angular/language-service": "^5.0.0", 51 | "@angular/service-worker": "^1.0.0-beta.16", 52 | "@types/jasmine": "~2.5.53", 53 | "@types/jasminewd2": "~2.0.2", 54 | "@types/node": "~6.0.60", 55 | "codelyzer": "~3.2.0", 56 | "jasmine-core": "~2.6.2", 57 | "jasmine-spec-reporter": "~4.1.0", 58 | "karma": "~1.7.0", 59 | "karma-chrome-launcher": "~2.1.1", 60 | "karma-cli": "~1.0.1", 61 | "karma-coverage-istanbul-reporter": "^1.2.1", 62 | "karma-jasmine": "~1.1.0", 63 | "karma-jasmine-html-reporter": "^0.2.2", 64 | "protractor": "~5.1.2", 65 | "ts-node": "~3.2.0", 66 | "tslint": "~5.7.0", 67 | "typescript": "~2.5.3", 68 | "webpack-bundle-analyzer": "^2.9.0" 69 | }, 70 | "main": "index.js" 71 | } 72 | -------------------------------------------------------------------------------- /protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import { AuthGuard } from './auth/services/auth-guard.service'; 4 | 5 | const routes: Routes = [ 6 | {path: '', redirectTo: 'home', pathMatch: 'full'}, 7 | { 8 | path: 'home', 9 | loadChildren: './home/home.module#HomeModule', 10 | canActivate: [AuthGuard] 11 | } 12 | ]; 13 | 14 | @NgModule({ 15 | imports: [RouterModule.forRoot(routes)], 16 | exports: [RouterModule] 17 | }) 18 | export class AppRoutingModule { } 19 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { AuthModule } from './auth/auth.module'; 2 | import { CoreModule } from './core/core.module'; 3 | import { BrowserModule } from '@angular/platform-browser'; 4 | import { NgModule } from '@angular/core'; 5 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 6 | 7 | import { StoreModule } from '@ngrx/store'; 8 | import { StoreRouterConnectingModule, RouterStateSerializer } from '@ngrx/router-store'; 9 | import { StoreDevtoolsModule } from '@ngrx/store-devtools'; 10 | import { EffectsModule } from '@ngrx/effects'; 11 | 12 | import { AppComponent } from './core/containers/app/app.component'; 13 | 14 | import { AppRoutingModule } from './app-routing.module'; 15 | import { reducers, metaReducers } from './core/store/reducers/root.reducer'; 16 | import { CustomRouterStateSerializer } from './shared/utils'; 17 | 18 | import { environment } from '../environments/environment'; 19 | 20 | // RX imports 21 | import 'rxjs/add/operator/catch'; 22 | import 'rxjs/add/operator/do'; 23 | import 'rxjs/add/operator/exhaustMap'; 24 | import 'rxjs/add/operator/map'; 25 | import 'rxjs/add/operator/filter'; 26 | import 'rxjs/add/operator/switchMap'; 27 | import 'rxjs/add/operator/finally'; 28 | import 'rxjs/add/operator/retry'; 29 | 30 | @NgModule({ 31 | declarations: [], 32 | imports: [ 33 | BrowserModule, 34 | AppRoutingModule, 35 | BrowserAnimationsModule, 36 | 37 | /** 38 | * StoreModule.forRoot is imported once in the root module, accepting a reducer 39 | * function or object map of reducer functions. If passed an object of 40 | * reducers, combineReducers will be run creating your application 41 | * meta-reducer. This returns all providers for an @ngrx/store 42 | * based application. 43 | */ 44 | StoreModule.forRoot(reducers, { metaReducers }), 45 | 46 | /** 47 | * @ngrx/router-store keeps router state up-to-date in the store. 48 | */ 49 | StoreRouterConnectingModule, 50 | 51 | /** 52 | * Store devtools instrument the store retaining past versions of state 53 | * and recalculating new states. This enables powerful time-travel 54 | * debugging. 55 | * 56 | * To use the debugger, install the Redux Devtools extension for either 57 | * Chrome or Firefox 58 | * 59 | * See: https://github.com/zalmoxisus/redux-devtools-extension 60 | */ 61 | !environment.production ? StoreDevtoolsModule.instrument() : [], 62 | 63 | /** 64 | * EffectsModule.forRoot() is imported once in the root module and 65 | * sets up the effects class to be initialized immediately when the 66 | * application starts. 67 | * 68 | * See: https://github.com/ngrx/platform/blob/master/docs/effects/api.md#forroot 69 | */ 70 | EffectsModule.forRoot([]), 71 | 72 | CoreModule.forRoot(), 73 | 74 | AuthModule.forRoot() 75 | ], 76 | providers: [ 77 | /** 78 | * The `RouterStateSnapshot` provided by the `Router` is a large complex structure. 79 | * A custom RouterStateSerializer is used to parse the `RouterStateSnapshot` provided 80 | * by `@ngrx/router-store` to include only the desired pieces of the snapshot. 81 | */ 82 | { provide: RouterStateSerializer, useClass: CustomRouterStateSerializer }, 83 | ], 84 | bootstrap: [AppComponent] 85 | }) 86 | export class AppModule { } 87 | -------------------------------------------------------------------------------- /src/app/auth/auth-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { SignUpComponent } from './container/sign-up/sign-up.component'; 2 | import { NgModule } from '@angular/core'; 3 | import { Routes, RouterModule } from '@angular/router'; 4 | import { LoginComponent } from './container/login/login.component'; 5 | 6 | const routes: Routes = [ 7 | {path: '', redirectTo: 'auth', pathMatch: 'full'}, 8 | {path: 'auth', children: [ 9 | {path: 'login', component: LoginComponent}, 10 | {path: 'sign-up', component: SignUpComponent} 11 | ]} 12 | ]; 13 | 14 | @NgModule({ 15 | imports: [RouterModule.forChild(routes)], 16 | exports: [RouterModule] 17 | }) 18 | export class AuthRoutingModule { } 19 | -------------------------------------------------------------------------------- /src/app/auth/auth.module.ts: -------------------------------------------------------------------------------- 1 | import { SignUpFormComponent } from './components/sign-up-form/sign-up-form.component'; 2 | import { SignUpComponent } from './container/sign-up/sign-up.component'; 3 | import { AuthGuard } from './services/auth-guard.service'; 4 | import { AuthService } from './services/auth.service'; 5 | import { SharedModule } from './../shared/shared.module'; 6 | import { NgModule } from '@angular/core'; 7 | import { CommonModule } from '@angular/common'; 8 | import { StoreModule } from '@ngrx/store'; 9 | import { EffectsModule } from '@ngrx/effects'; 10 | 11 | import { AuthRoutingModule } from './auth-routing.module'; 12 | import { LoginComponent } from './container/login/login.component'; 13 | import { LoginFormComponent } from './components/login-form/login-form.component'; 14 | import { reducers } from './store/reducers'; 15 | import { AuthEffects } from './store/effects/auth.effect'; 16 | 17 | export const COMPONENTS = [ 18 | LoginComponent, 19 | LoginFormComponent, 20 | SignUpComponent, 21 | SignUpFormComponent 22 | ]; 23 | 24 | @NgModule({ 25 | imports: [CommonModule, SharedModule], 26 | declarations: COMPONENTS 27 | }) 28 | export class AuthModule { 29 | static forRoot() { 30 | return { 31 | ngModule: RootAuthModule, 32 | providers: [AuthService, AuthGuard] 33 | }; 34 | } 35 | } 36 | 37 | @NgModule({ 38 | imports: [ 39 | AuthModule, 40 | AuthRoutingModule, 41 | StoreModule.forFeature('auth', reducers), 42 | EffectsModule.forFeature([AuthEffects]), 43 | ], 44 | }) 45 | export class RootAuthModule {} 46 | -------------------------------------------------------------------------------- /src/app/auth/components/login-form/login-form.component.html: -------------------------------------------------------------------------------- 1 |