:evergreen_tree: Modern Web Application Framework for Node.js.

Overview

Gitter NPM version Linux + OSX Build Status Windows Build Status Test Coverage Follow @trailsjs on Twitter

Trails is a modern, community-driven web application framework for Node.js. It builds on the pedigree of Rails and Grails to accelerate development by adhering to a straightforward, convention-based, API-driven design philosophy.

Getting Started

Install

$ npm install -g yo generator-trails
$ yo trails

Trailblaze

Trails uses Yeoman to generate scaffolding for new applications, and to create resources inside the application.

$ yo trails --help

Usage:
  yo trails

Generators:

  Create New Model
    yo trails:model <model-name>

  Create New Controller
    yo trails:controller <controller-name>

  Create New Policy
    yo trails:policy <policy-name>

  Create New Service
    yo trails:service <service-name>

Run

Once installation is complete, begin your journey!

$ node server.js

Happy Trails!

Trailpacks

Trailpacks extend the framework's capabilities and allow developers to leverage existing ecosystem tools through a simple and well-defined API. New features, behavior, APIs, and other functionality can be added to the Trails framework through Trailpacks.

Many Trails installations will include some of the following Trailpacks:

Compatibility

  • Windows, Mac, and Linux
  • Node 7.0 and newer

Documentation

See trailsjs.io/doc for complete documentation.

More Resources

Tutorials

Videos

Support

FAQ

See https://github.com/trailsjs/trails/wiki/FAQ

Contributing

We love contributions! Please check out our Contributor's Guide for more information on how our projects are organized and how to get started.

License

MIT

Comments
  • yo trails crashing when trailpack doesn't have v2-latest tag

    yo trails crashing when trailpack doesn't have v2-latest tag

    Issue Description

    yo trails not generating default folders controllers & models in api folder. Due to this config/web.js also not generating itself.

    Some trailpacks's not been installed, Error is as below

    npm ERR! Linux 4.8.0-32-generic
    npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "trailpack-express@v2-latest" "trailpack-mongoose@v2-latest" "trailpack-footprints@v2-latest" "[email protected]" "--save" "--silent" "--loglevel=error"
    npm ERR! node v6.0.9
    npm ERR! npm  v4.1.1
    npm ERR! code ETARGET
    npm ERR! notarget No compatible version found: trailpack-mongoose@v2-latest
    npm ERR! notarget Valid install targets:
    npm ERR! notarget 0.1.0, 0.2.0, 0.2.2, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 1.0.0, 1.0.1
    npm ERR! notarget 
    npm ERR! notarget This is most likely not a problem with npm itself.
    npm ERR! notarget In most cases you or one of your dependencies are requesting
    npm ERR! notarget a package version that doesn't exist.
    npm ERR! Please include the following file with any support request:
    npm ERR!     /home/nd/Desktop/ND/trails-hello/npm-debug.log
    1
    ┌───────────────────────────────────────────┐
    │ Your Trails Application has been created! │
    │ ---                                       │
    │ To start your application, run: npm start │
    

    Environment

    • node version: 6.0
    • trails version: 2
    • operating system: Ubuntu16.10 & Mac Sierra
    bug crash 
    opened by Nishchit14 30
  • standardized controller/policies API

    standardized controller/policies API

    In order to make all Trailpacks compatible whatever the web server choice, we need a unified API for controllers and policies.

    module.exports = class MyController extends Controller{
      /**
        * params : url parameters
        * query : get parameters
        * body : payload
      **/
      info(params, query, body, next){
        next(null, {status: 200, data: {whatever:'ok’}, headers:[]})
      } 
    }
    

    But actually controllers/policies are bind directly to web server so I don't see how we can implement this :/. Any idea ?

    discussion task 
    opened by jaumard 26
  • Unable to generate a Trails project with Yo

    Unable to generate a Trails project with Yo

    Issue Description

    Unable to generate a Trails project with Yo. I just install yo and generator-trails. Then, I execute this command yo trails. I enter my options and nothing happens after the module name option.

    trails generator

    Environment

    • node version: v6.1.0
    • trails version: ???
    • operating system: Windows 10 64bits
    bug 
    opened by KevinNTH 22
  • Tutorial Issue, routes?

    Tutorial Issue, routes?

    Issue Description

    I apologize if this is not the write way to report this.

    Watching what I think is a video by you guys (https://www.youtube.com/watch?v=AbSp8jqFDAY) I am not able to get a response from the GET request to /api/v1/user:

    # curl http://localhost:3000/api/v1/user
    
    {
      "statusCode": 404,
      "error": "Not Found"
    }
    

    To recreate this, I created a new project, installed the latest generator-waterline (alpha-6, prior versions don't seem to work anymore), and added require('trailpack-waterline') to main.js.

    The tutorial seems to autogenerate routes for the builtin User model. Am I missing something?

    Environment

    • node version: 5.10.1
    • trails version: 1.0.0-beta-1
    • operating system: Linux 4.2.0-34-generic #39-Ubuntu x86_64 x86_64 x86_64 GNU/Linux

    Edit: Here are the packages I have (noticed I put the wrong version for trails):

    "dependencies": {
        "lodash": "^4.0",
        "trailpack-core": "^1.0.0-beta-3",
        "trailpack-hapi": "^1.0.0-beta-3",
        "trailpack-repl": "^1.0.0-beta-3",
        "trailpack-router": "^1.0.0-beta-4",
        "trails": "^1.0.0-beta-1",
        "trails-controller": "^1.0.0-beta-2",
        "trails-model": "^1.0.0-beta-2",
        "trails-policy": "^1.0.1",
        "trails-service": "1.0.0-beta-2",
        "waterline-sqlite3": "^1.0.0",
        "winston": "^2.1.1"
      },
    
    
    bug 
    opened by jdell64 19
  • Class for models, controllers, policies and services

    Class for models, controllers, policies and services

    It would be nice to have some classes : TrailsModel, TrailsController, TrailsPolicy and TrailsService instead of {} directly. It can be useful to extends some trailpack functionalities from trails project. It can be more 'cleaner' / easy to understand/learn to have classes for this kind of objects.

    discussion 
    opened by jaumard 17
  • Trails compilers support

    Trails compilers support

    Issue Description

    Actually it's not possible to write Trails files (api/config) with TypeScript or CoffeeScript format. A trailpack can't do it because when Trails start nothing was load (because they are no JS files, only .ts or .coffee).

    In order to fix this we can create trails-compiler module witch need to be override by trails-compiler-typescript and trails-compiler-coffee ...

    The Trails app is launch by node server.js so the first thing to do in server.js is to check if there a trails-compiler, if one (or more ?) is present server.js launch them to compile every sources into JS. Once compiled server.js can do like now and start the Trails app :)

    Some interface need to be think/create for trails-compiler in order to work correctly but like this Trails can be compatible with any JS derivate languages (even Dart if some are courageous lol).

    For instance each trails-compiler will embed an archetype of Trails project (but in ts, coffee...) that can be use in the generator to generator a Trails project in ts, coffee...

    That's a start and it's an open discussion here ^^

    discussion 
    opened by jaumard 16
  • v3 config merge fix

    v3 config merge fix

    Description

    Config between app/trailpack is merge in the wrong way.

    No fix yet, just create the right unit test of what we really want. Waiting for @tjwebb feedback on #316 issue

    Issues

    • resolves #316
    opened by jaumard 15
  •  AssertionError: missing path in new trails application

    AssertionError: missing path in new trails application

    info: Starting...
    debug: trails event: trails:start
    verbose: Trailpacks: All Validated.
    debug: trails event: trailpack:all:validated
    debug: trails event: trailpack:core:configured
    debug: trails event: trailpack:repl:configured
    debug: trails event: trailpack:router:configured
    debug: trails event: trailpack:hapi:configured
    debug: trails event: trailpack:all:configured
    debug: trails event: trailpack:core:initialized
    debug: trails event: trailpack:repl:initialized
    debug: trails event: trailpack:router:initialized
    error:
     AssertionError: missing path
        at Module.require (module.js:364:3)
        at require (module.js:385:17)
        at Object.registerViews (/Volumes/Repos/Coding/OpenSource/trails/test/node_modules/trailpack-hapi/lib/server.js:28:15)
        at Hapi.initialize (/Volumes/Repos/Coding/OpenSource/trails/test/node_modules/trailpack-hapi/index.js:37:16)
        at /Volumes/Repos/Coding/OpenSource/trails/test/node_modules/trails/index.js:65:26
        at process._tickDomainCallback (node.js:422:9)
        at Function.Module.runMain (module.js:459:11)
        at startup (node.js:138:18)
        at node.js:974:3
    debug: trails event: trails:stop
    
    crash 
    opened by konstantinzolotarev 14
  • when creating new project and try to start error Cannot find module 'colors'

    when creating new project and try to start error Cannot find module 'colors'

    Issue Description

    Every time need to install colors after using yo tails

    C:\Users\Scw\Desktop\tra>node server.js
    module.js:327
        throw err;
        ^
    
    Error: Cannot find module 'colors'
        at Function.Module._resolveFilename (module.js:325:15)
        at Function.Module._load (module.js:276:25)
        at Module.require (module.js:353:17)
        at require (internal/module.js:12:17)
        at Object.<anonymous>  (C:\Users\Scw\Desktop\tra\node_modules\trailpackrepl\node_modules\big-tree-cli\index.js:1:76)
        at Module._compile (module.js:409:26)
        at Object.Module._extensions..js (module.js:416:10)
        at Module.load (module.js:343:32)
        at Function.Module._load (module.js:300:12)
        at Module.require (module.js:353:17)
    

    Environment

    • node version: v4.4.4
    • trails version: ^1.0.0-beta-1
    • operating system: Window 7
    bug 
    opened by ycpatel813 12
  • Footprint delete http request on multiple items

    Footprint delete http request on multiple items

    Issue Description

    As I see under all trailpacks, to remove multiple items you need to call url like DELETE http://localhost:3000/api/v1/mymodel?name=test

    This will remove all items with name = test with works fine. But if you try something like : DELETE http://localhost:3000/api/v1/mymodel?isOk=true DELETE http://localhost:3000/api/v1/mymodel?nbTodo=4

    None of this url will work because when params are parse they are all in string so on Footprint Controller and FootprintService we have isOk = "true" and nbTodo="4" and the ORM will crash or worse execute the query successfully but 0 items was deleted.

    Environment

    • node version: all
    • trails version: all
    • operating system: all
    bug 
    opened by jaumard 12
  • Inaccurate wording of FAQ answer

    Inaccurate wording of FAQ answer

    Some of the wording in the answer to 'Is Trails a fork of Sails?' is a little misleading, so would be a good idea to change it to avoid confusion about this project. Right now it says:

    Trails is built and maintained by former members of the Sails.js core team

    But that makes it sound like the core maintainers of Sails have become involved in this project. It would be more accurate to change it to something along the lines of:

    Trails is built and maintained by a former Sails contributor and his team

    (Would have submitted a PR myself, but I figured you might want to work with the wording a bit more before changing it.)

    discussion sails 
    opened by rachaelshaw 12
  • start application

    start application

    Hello,

    I'm using Trails for the first time, when I type npm start in the terminal I have no answer.

    @ 0.0.0 start /var/projects/sources/trails-hello-world node server.js

    opened by gideaoms 0
  • 3.1.x

    3.1.x

    Description

    Hello there. sorry for creating this pull request. for a while i was following you guys and i liked the idea behind trails js. But there is a fact that i have some ideas about implementation and have things i wanna add to trails frameworks and generators. I think this repository and other trailsjs related repositories are being inactive. so before forking whole project and starting to go my own way with it wanted to know whats up with you guys? you have any plans in mind which i can possibly help with? to avoid overlapping works

    Issues

    • resolves #???
    opened by Mishel-M-IT 0
  • Trails Application not starting first time

    Trails Application not starting first time

    I have setup a trails application through yo trails.But when I start my application It is giving me this error. I have installed fresh application

    image

    Environment

    • node version: 8.11.0
    • trails version: 3.1.0
    • operating system: windows 10
    opened by kamal-bhatt 0
  • Problem with nodejs 10

    Problem with nodejs 10

    Issue Description

    Hi, I have a problem with my installation...

    https://imgur.com/a/R5l8KER

    https://pastebin.com/9HgkrWeS

    9 http fetch GET 404 https://registry.npmjs.org/trailpack-other 1169ms 10 silly fetchPackageMetaData error for trailpack-other@^3 404 Not Found: trailpack-other@^3 11 silly fetchPackageMetaData error for trailpack-other@^3 404 Not Found: trailpack-other@^3 12 http fetch GET 404 https://registry.npmjs.org/trailpack-none 2350ms 13 silly fetchPackageMetaData error for trailpack-none@^3 404 Not Found: trailpack-none@^3 14 timing stage:rollbackFailedOptional Completed in 1ms 15 timing stage:runTopLevelLifecycles Completed in 2656ms 16 verbose stack Error: 404 Not Found: trailpack-other@^3

    Environment

    • node version: 10.2.1
    • trails version: 3
    • operating system: WINDOWS
    opened by farnetani 0
  • V3 `this.app.config.get` doesn't behave as expected

    V3 `this.app.config.get` doesn't behave as expected

    @jaumard I think I found another issue with the config.

    On trailpack-koa I have:

    // index.js
    ...
    configure() {
    ...
    // line 56
    this.app.config.set('web', result[1])
    ...
    }
    ...
    

    which updates the current configuration with various defaults and checks using JOI.

    Now if on my app or another trailpack I see this result:

    this.app.config.get('web.server') // undefined
    this.app.config.get.web.server // 'koa'
    

    I've been careful to ask for this config value after trailpack-koa 's configure method is completed.

    opened by matteozambon89 1
Releases(2.0)
  • 2.0(Dec 27, 2016)

    Release Notes

    Changelog Summary

    • Built-in Trails Error objects are global.
    • Built-in Trails resource classes (Model, Controller, Service, Policy) are now global
    • trailpack-core functionality merged into Trails core. trailpack-core is deprecated and will be removed in v3.0. trailpack-core 2.0 is a no-op trailpack.
    • trails-model, trails-service, trails-policy, and trails-controller are merged into Trails core, and made available via require(). The individual modules are deprecated and will be removed in 3.0.
    • the trailpack subtypes merged into trailpack core interface.
    • Configuration now accessible via Map interface.

    Potentially Breaking Changes:

    • The Trails constructor now requires config, and api properties to be set. These properties can no longer be sent into the start() method. This is not an issue unless using a custom server.js to launch Trails.
    Source code(tar.gz)
    Source code(zip)
Owner
Trails
A Modern Web Application Framework for Node.js
Trails
Fast, unopinionated, minimalist web framework for node.

Fast, unopinionated, minimalist web framework for node. const express = require('express') const app = express() app.get('/', function (req, res) {

null 59.5k Jan 5, 2023
Fast and low overhead web framework, for Node.js

An efficient server implies a lower cost of the infrastructure, a better responsiveness under load and happy users. How can you efficiently handle the

Fastify 26k Jan 2, 2023
A serverless web framework for Node.js on AWS (CloudFormation, CloudFront, API Gateway, Lambda)

---- Sorry, this project is not maintained anymore. ---- dawson is a serverless web framework for Node.js on AWS (CloudFormation, CloudFront, API Gate

dawson 717 Dec 30, 2022
A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications on top of TypeScript & JavaScript (ES6, ES7, ES8) 🚀

A progressive Node.js framework for building efficient and scalable server-side applications. Description Nest is a framework for building efficient,

nestjs 53.2k Dec 31, 2022
Realtime MVC Framework for Node.js

Website Get Started Docs News Submit Issue Sails.js is a web framework that makes it easy to build custom, enterprise-grade Node.js apps. It is design

Balderdash 22.4k Dec 31, 2022
🚀 The Node.js Framework highly focused on developer ergonomics, stability and confidence

Sponsored by FOSS United is a non-profit foundation that aims at promoting and strengthening the Free and Open Source Software (FOSS) ecosystem in Ind

AdonisJS Framework 13.4k Dec 31, 2022
:rocket: Progressive microservices framework for Node.js

Moleculer Moleculer is a fast, modern and powerful microservices framework for Node.js. It helps you to build efficient, reliable & scalable services.

MoleculerJS 5.5k Jan 4, 2023
MVC framework making it easy to write realtime, collaborative applications that run in both Node.js and browsers

Derby The Derby MVC framework makes it easy to write realtime, collaborative applications that run in both Node.js and browsers. Derby includes a powe

DerbyJS 4.7k Dec 23, 2022
Node.js framework

Node.js framework Total.js framework is a framework for Node.js platfrom written in pure JavaScript similar to PHP's Laravel or Python's Django or ASP

Total.js 4.2k Jan 2, 2023
Marble.js - functional reactive Node.js framework for building server-side applications, based on TypeScript and RxJS.

Functional reactive Node.js framework for building server-side applications, based on TypeScript and RxJS. Ecosystem Name Description @marblejs/core F

Marble.js 2.1k Dec 16, 2022
LoopBack makes it easy to build modern API applications that require complex integrations.

LoopBack makes it easy to build modern applications that require complex integrations. Fast, small, powerful, extensible core Generate real APIs with

StrongLoop and IBM API Connect 4.4k Jan 4, 2023
🦄 0-legacy, tiny & fast web framework as a replacement of Express

tinyhttp ⚡ Tiny web framework as a replacement of Express ?? tinyhttp now has a Deno port (work in progress) tinyhttp is a modern Express-like web fra

v 1 r t l 2.4k Jan 3, 2023
Component based MVC web framework for nodejs targeting good code structures & modularity.

Component based MVC web framework for nodejs targeting good code structures & modularity. Why fortjs Based on Fort architecture. MVC Framework and fol

Ujjwal Gupta 47 Sep 27, 2022
Proof of concept for the Quark.js web framework

Quark.js Proof of Concept Proof of concept for the Quark.js web framework. Examples Express.js Implimentation using express.js as a web server: im

Quark.js 3 Feb 18, 2022
Realtime.js - a fast frontend framework based on Web-Components.

Realtime.js is a fast frontend framework based on Web-Components and Proxies. It has a lot of features to simplify your way of live as a vanillajs developer. The framework is programmed in such a way, that you can edit it yourself if you need additional features.

Kilian Hertel 7 Nov 1, 2022
A well documented set of tools for building node web applications.

Perk Framework Perk is a well documented set of tools for building node web applications. The goal of Perk is first and foremost to provide a well doc

Aaron Larner 179 Oct 26, 2022
The React Framework

Next.js Getting Started Visit https://nextjs.org/learn to get started with Next.js. Documentation Visit https://nextjs.org/docs to view the full docum

Vercel 98.6k Jan 5, 2023
The Intuitive Vue Framework

Build your next Vue.js application with confidence using Nuxt: a framework making web development simple and powerful. Links ?? Documentation: https:/

Nuxt 41.8k Jan 9, 2023
The Simple, Secure Framework Developers Trust

@hapi/hapi The Simple, Secure Framework Developers Trust Build powerful, scalable applications, with minimal overhead and full out-of-the-box function

hapi.js 14.1k Dec 31, 2022