0.3.9 • Published 5 years ago

generator-nbgen v0.3.9

Weekly downloads
20
License
Apache-2.0
Repository
github
Last release
5 years ago

Still under construction...

Introduction

This is a yeoman generator for generating code baseline for developing full stack web application. It is composed of opinionated use of AngularJS as front-end framework and Meteor as the backend.

On the front-end the following frameworks/libraries are used:

On the back-end the following frameworks/libraries are used:

  • Meteor - main backend application server and framework used including the following modules:
    • Publish / Subscribe
    • Methods - implementing remote APIs
    • Collections - encapsulate MongoDB operations
    • Accounts / Roles - for handling user identity and roles management to enforce application access control
    • Email - for sending email
  • HTML PDF - for generating reports in pdf
  • later - for handling task scheduling

Other components used both on front-end and backend:

Getting Started

Installation

  1. Install Meteor.
  2. Install Node.js. V8 is the preferred version. You may also opt not to install Node.js and use the version that comes with Meteor. To run node that comes with Meteor just prepend the command with meteor (e.g. meteor npm install).
  3. Install Yeoman CLI
npm install -g yo
  1. Install nbgen generator.
npm install -g generator-nbgen

Usage

Creating a Baseline Code

  • Create a project folder, and from the project folder run the following to generate the code baseline.

  • yo nbgen

    You will be prompted with application name. Enter your desired application name. The tool will then start scaffolding the code baseline.

  • To run the application

  • npm start

Customising Basic UI Components

Change Color Theme

  • To change the color theme used by the app, edit client/imports/ui/app/nbgenApp/nbgenAppConfig.js and modify the default color theme. Optionally, add a secondary theme. For color theme reference, please visit Material Design's color palette reference.
const config = {
    // change to the user readable application name
    applicationName: "nbGenAppBase",
    applicationLogo: imagesToPreload[0],
    applicationLogoSquare: imagesToPreload[1],
    applicationBgs: applicationBgs,
    imagesToPreload,
    colorTheme: {
        // change the default color theme used by application
        primary: "indigo",
        accent: "teal",
    },
    secondaryTheme: {
        // secondary color theme used
        primary: "indigo",
        accent: "amber",
    }
}

Images

  • public/assets/images/application-bg.jpg - application background.
  • public/assets/images/application-logo.png - used in the toolbar header
  • public/assets/images/application-logo-square.png - used in sidenav navigation

You may also want to change the favicons located in public/assets/icons folder.

Built-in Routes

There are client-side routes that came with the generated baseline codes. You may customize these according to your application needs.

  • nbgenMain - The home screen located in client/imports/ui/app/nbgenApp/nbgenMain/ directory.
  • nbgenLogin - Contains the login facility. Located in client/imports/ui/app/nbgenApp/nbgenLogin/ directory.
  • nbgenRegister - Contains the self-registration facility. Located in client/imports/ui/app/nbgenApp/nbgenRegister/ directory.

Sub-Generators

Mongo DB Collection Maintenance

To generate set of codes for maintaining a MongoDB collection, complete with front-end and back-end codes:

yo nbgen:collection collectionName

You must provide the name of the mongo collection to create (e.g. yo nbgen:collection Customers)

Generated codes:

  • Front end mainly located in client/imports/ui/app/collectionName folder
    • collection.js - declaration of minimongo collection which can be imported to access from other parts of the code.
    • _collection.scss - may be modified to change css styles of the component
    • actionToolbarListView.html - to include other UI components on the top toolbar shown when viewing the collection list
    • actionToolbarFormView.html - to include other UI components on the top toolbar shown when viewing or editing a specific document from the collection.
    • config.js - this is where you put codes to customize the behaviour of the component.
    • listLayout.js - contains configuration on how to layout the list of collections.There are several options you can put in here to modify or override the default operations of the collection maintenance which will be explained on a separate section below.
    • formSchema.js - contains configuration describing how to layout and composition of the forms. More details about this on the form components section.
    • setup.js - this is where the component and its options are setup. For instance if you want to limit the access to of the client-side route to a set of roles, you will modify the alloweRoles variable declared in this file.
    • i18n.hjson - this is located in client/imports/i18n/en
    • An entry into the menu will be injected into client/imports/ui/app/nbgenApp/nbgenAppMenu.js
  • Back end mainly located in server/imports/api/collectionName folder
    • index.js - declaration of mongo collection
    • fixture.js - where you put initialization routines
    • publish.js - control the publication of the collection to the client including filtering of exposed information based on user's group or role
    • permissions.js - provides mechanism to control who can perform create, update and delete operations.
    • methods.js - where to declare and define remote API methods, specific to the application requirements.

Angular Component

To generate code templates for creating an angular component

yo nbgen:ngcomponent componentName

Generated codes will be located in client/imports/ui/app/componentName.

  • _component.scss - may contain styles specific to the component
  • component.html - the UI template used by the component
  • config.js - any pertinent data which may be used by the component
  • ctrl.js - the actual implenentation of the component

documentation on other sub-generators to follow.

UI Components

Security and Identity Service

documentation to be provided later

Collection Maintenance Component

documentation to be provided later

Form Components

documentation to be provided later

i18n Provisioning

documentation to be provided later

UI Helper Services

documentation to be provided later

Server Components

Collection Initialization

documentation to be provided later

Publish Control

documentation to be provided later

Permission Handling

documentation to be provided later

Provisioning APIs

documentation to be provided later

0.3.9

5 years ago

0.3.8

5 years ago

0.3.7

5 years ago

0.3.6

5 years ago

0.3.5

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.30

5 years ago

0.2.29

5 years ago

0.2.28

6 years ago

0.2.27

7 years ago

0.2.26

7 years ago

0.2.25

7 years ago

0.2.24

7 years ago

0.2.23

7 years ago

0.2.22

7 years ago

0.2.21

7 years ago

0.2.20

7 years ago

0.2.19

7 years ago

0.2.18

7 years ago

0.2.17

7 years ago

0.2.16

7 years ago

0.2.14

8 years ago

0.2.13

8 years ago

0.2.12

8 years ago

0.2.11

8 years ago

0.0.11

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago