node package manager
Don’t reinvent the wheel. Reuse code within your team. Create a free org »

@fabiospampinato/tram

TRAM

Issues NPM version

Boilerplate for building reactive isomorphic applications. Built around TypeScript, React, Apollo, MongoDB.

Features

  • Everything is written in TypeScript, including Webpack configurations and tests
  • Hot Module Replacement on the client, and automatic rebuild and restart on the server
  • MongoDB database, queried using GraphQL via Apollo
  • AVA and NYC support for testing and coverage
  • React and React-Router, with Server Side Rendering support
  • Basic authentication logic using Passport

Project Structure

TRAM
├── assets                # Place your static assets here
├── coverage              # NYC coverage output
├── dist                  # Built app, ready to serve
├── resources             # External resources, like Photoshop files
├─┬ src                   # Source files
│ ├─┬ api                 # Database-related files
│ │ ├── auth              # Authentication files
│ │ ├── counter           # Counter component
│ │ ├── todo              # Todo component
│ │ ├── user              # User component
│ │ ├── apollo.ts         # Exports configureApollo
│ │ ├── components.ts     # Imports all the components
│ │ ├── index.ts          # Exports configureApollo, Components, Mongoose, Mongease and Schema
│ │ ├── mongease.ts       # Mongease instance
│ │ ├── mongoose.ts       # Mongoose instance
│ │ └── schema.ts         # Executable GraphQL schema
│ ├─┬ client              # Client-related files
│ │ ├── index.ts          # Client entry point
│ │ ├── render.tsx        # Client's render function
│ │ └── vendor.ts         # Client's vendor entry point
│ ├── modules             # Where to place modules
│ ├─┬ server              # Server-related files
│ │ ├── hot.ts            # Hot Module Replacement server entry point
│ │ ├── index.ts          # Server entry point
│ │ ├── render.tsx        # Server's render function
│ │ └── vendor.ts         # Server's vendor entry point
│ ├── store               # Redux-related files
│ └─┬ ui                  # UI-related files
│   ├── components        # React components
│   ├── routes            # App routes
│   ├── template          # Extra front-end code/styles to load
│   └── styles.ts         # Exports all the loaded styles
├── types                 # Custom declarations
├── typings               # Typings declarations
├─┬ webpack               # Webpack configurations
│ ├── base                # Base configurations
│ ├── client              # Client configurations
│ ├── server              # Server configurations
│ └── test.js             # Tests configuration
├── .babelrc              # Babel configuration (may be enabled in Awesome Typescript Loader)
├── .gitignore            # Tells git which files to ignore
├── .todo                 # List of things to do
├── forever.json          # Forever configuration
├── LICENSE               # Contains the license
├── package.json          # NPM package.json
├── README.md             # This file
├── tsconfig.json         # TypeScript compiler configuration
├── tslint.json           # tslint configuration
└── typings.json          # Typings configuration

Scripts

To get a list of all the available scripts, as well as a brief description for each, run:

npm run help

Installation

$ git clone https://github.com/fabiospampinato/TRAM.git
$ cd TRAM
$ npm install
$ typings install

Start

Development mode:

npm run start:db # Only needed if connecting to a local MongoDB
npm run build:vendor # Only needed before the first start, or if vendor dependencies change
npm run start

Production mode:

npm run start:db:prod # Only needed if connecting to a local MongoDB
npm run build:all:prod # Only needed before the first start
npm run start:server:prod

Related

  • TRAM is a fork of vortigern, check it out as well.

License

MIT © Fabio Spampinato