Skip to content

Commit e3e98bb

Browse files
committed
Initial commit
0 parents  commit e3e98bb

34 files changed

+7202
-0
lines changed

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.DS_Store
2+
*.log
3+
.idea
4+
node_modules
5+
coverage
6+
.nyc_output

.nojekyll

Whitespace-only changes.

.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
media

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.remarkignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
template/README.md
2+
test/snapshots/**/*.md

.travis.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
language: node_js
2+
node_js:
3+
- '8'
4+
after_success:
5+
npm run coverage

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Nick Baugh <[email protected]> (http://niftylettuce.com/)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+250
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
<h1 align="center">
2+
<a href="https://ladjs.github.io/lad/"><img src="media/lad.png" alt="lad" /></a>
3+
</h1>
4+
<div align="center">
5+
<a href="http://slack.crocodilejs.com"><img src="http://slack.crocodilejs.com/badge.svg" alt="chat" /></a>
6+
<a href="https://semaphoreci.com/niftylettuce/lad"> <img src="https://semaphoreci.com/api/v1/niftylettuce/lad/branches/master/shields_badge.svg" alt="build status"></a>
7+
<a href="https://codecov.io/github/ladjs/lad"><img src="https://img.shields.io/codecov/c/github/ladjs/lad/master.svg" alt="code coverage" /></a>
8+
<a href="https://github.com/sindresorhus/xo"><img src="https://img.shields.io/badge/code_style-XO-5ed9c7.svg" alt="code style" /></a>
9+
<a href="https://github.com/prettier/prettier"><img src="https://img.shields.io/badge/styled_with-prettier-ff69b4.svg" alt="styled with prettier" /></a>
10+
<a href="https://github.com/lassjs/lass"><img src="https://img.shields.io/badge/made_with-lass-95CC28.svg" alt="made with lass" /></a>
11+
<a href="LICENSE"><img src="https://img.shields.io/github/license/ladjs/lad.svg" alt="license" /></a>
12+
</div>
13+
<br />
14+
<div align="center">
15+
Lad scaffolds a <a href="">Koa</a> webapp and API framework for <a href="https://nodejs.org">Node</a>
16+
</div>
17+
<div align="center">
18+
<sub>
19+
A lad that fell in love with a <a href="https://github.com/lassjs/lass"><strong>lass</strong></a>
20+
&bull; Built by <a href="https://github.com/niftylettuce">@niftylettuce</a>
21+
and <a href="#contributors">contributors</a>
22+
</sub>
23+
</div>
24+
25+
26+
## Table of Contents
27+
28+
* [Philosophy](#philosophy)
29+
* [Features](#features)
30+
* [Microservices](#microservices)
31+
* [Frontend](#frontend)
32+
* [Backend](#backend)
33+
* [Performance](#performance)
34+
* [Security](#security)
35+
* [Get Started](#get-started)
36+
* [Requirements](#requirements)
37+
* [Install](#install)
38+
* [Usage](#usage)
39+
* [Tutorials](#tutorials)
40+
* [Community](#community)
41+
* [Related](#related)
42+
* [Contributors](#contributors)
43+
* [Trademark Notice](#trademark-notice)
44+
* [License](#license)
45+
46+
47+
## Philosophy
48+
49+
> Lad is designed according to three core beliefs.
50+
51+
1. Adhere to [MVC][], [Unix][], [KISS][], [YAGNI][] and [Twelve Factor][twelve-factor] principles
52+
2. Design for a scrappy, bootstrapped, and [ramen-profitable][] hacker
53+
3. Stay simple, modern, lightweight, stellar, highly-configurable, and developer-friendly
54+
55+
56+
## Features
57+
58+
> Lad boasts dozens of features and is extremely configurable.
59+
60+
The following is a brief list of features; as you use Lad you will discover more.
61+
62+
### Microservices
63+
64+
* Webapp server (via `app.js`)
65+
* API server (via `api.js`)
66+
* Job server (via `agenda.js`)
67+
* Proxy server (via `proxy.js`)
68+
69+
### Frontend
70+
71+
* Pug
72+
* Bootstrap 4
73+
* Font Awesome
74+
* SpinKit
75+
* SweetAlert2
76+
* Dense
77+
* Waypoints
78+
* LiveReload
79+
* Frisbee
80+
81+
### Backend
82+
83+
* Redis, sessions, and flash messaging
84+
* Koa-based webapp and API servers
85+
* RESTful API with BasicAuth and versioning
86+
* Agenda-based job scheduler with cron and human-readable syntax
87+
* Passport-based authentication and group-based permissioning
88+
* Stripe-inspired error handling with Boom
89+
* Mongoose and MongoDB with common database plugins
90+
* Email template engine with Nodemailer and local rendering
91+
* Proxy eliminates need for Nginx reverse-proxy or Apache virtual hosts
92+
* Multilingual through i18n and i10n
93+
* Automatic phrase translation with Google Translate
94+
* Sitemap generator for simple SEO
95+
96+
### Performance
97+
98+
* Compression and zero-bloat approach
99+
* Stream-based file uploading
100+
* Graceful reloading, shutdown, and reconnection handling
101+
* Manifest asset revisioning
102+
* Amazon S3 and CloudFront ready
103+
104+
### Security
105+
106+
* Database security plugins and helpers
107+
* Automated tests and code coverage
108+
* CSRF, XSS, and rate limited protection
109+
* Dotenv support for environment-based configurations
110+
* App, user, and request-based logging
111+
* SSL-ready
112+
113+
114+
## Get Started
115+
116+
> We strictly support Mac and Ubuntu-based operating systems (Windows _might_ work).
117+
118+
### Requirements
119+
120+
Please ensure your operating system has the following software installed:
121+
122+
* [git][] - see [GitHub's tutorial][github-git] for installation
123+
124+
* [Node.js][node] (v8.x+) - use [nvm][] to install it on any OS
125+
126+
* After installing `nvm` you will need to run `nvm install node`
127+
* We also recommend you install [yarn][], which is an alternative to [npm][]
128+
129+
* [MongoDB][] (v3.x+):
130+
131+
* Mac (via [brew][]): `brew install mongodb`
132+
* Ubuntu:
133+
134+
```sh
135+
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
136+
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
137+
sudo apt-get update
138+
sudo apt-get -y install mongodb-org
139+
```
140+
141+
* [Redis][] (v4.x+):
142+
143+
* Mac (via [brew][]): `brew install redis-server`
144+
* Ubuntu:
145+
146+
```sh
147+
sudo add-apt-repository -y ppa:chris-lea/redis-server
148+
sudo apt-get update
149+
sudo apt-get -y install redis-server
150+
```
151+
152+
### Install
153+
154+
[npm][]:
155+
156+
```sh
157+
npm install -g lad
158+
```
159+
160+
[yarn][]:
161+
162+
```sh
163+
yarn global add lad
164+
```
165+
166+
### Usage
167+
168+
```sh
169+
lad new-project
170+
cd new-project
171+
```
172+
173+
### Tutorials
174+
175+
* [Writing Your App](https://github.com/koajs/koa#getting-started)
176+
* [Continous Integration and Deployment](http://niftylettuce.com/posts/automated-node-app-ci-graceful-zerodowntime-github-pm2/)
177+
178+
### Community
179+
180+
* [Follow us on Twitter][twitter]
181+
* [Join our Slack channel][slack]
182+
* [Subscribe to our Twitch channel][twitch]
183+
* [Visit Koa's Community section](https://github.com/koajs/koa#community).
184+
185+
186+
## Related
187+
188+
* [lass][] - Scaffold a modern boilerplate for [Node.js][node]
189+
190+
191+
## Contributors
192+
193+
| Name | Website |
194+
| -------------- | ------------------------- |
195+
| **Nick Baugh** | <http://niftylettuce.com> |
196+
197+
198+
## Trademark Notice
199+
200+
Lad, Lass, and their respective logos are trademarks of Niftylettuce LLC.
201+
These trademarks may not be reproduced, distributed, transmitted, or otherwise used, except with the prior written permission of Niftylettuce LLC.
202+
If you are seeking permission to use these trademarks, then please [contact us](mailto:[email protected]).
203+
204+
205+
## License
206+
207+
[MIT](LICENSE) © [Nick Baugh](http://niftylettuce.com)
208+
209+
210+
##
211+
212+
<a href="#"><img src="media/lad-footer.png" alt="#" /></a>
213+
214+
[npm]: https://www.npmjs.com/
215+
216+
[yarn]: https://yarnpkg.com/
217+
218+
[lass]: https://github.com/lassjs/lass
219+
220+
[node]: https://nodejs.org
221+
222+
[kiss]: https://en.wikipedia.org/wiki/KISS_principle
223+
224+
[mvc]: https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
225+
226+
[yagni]: https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it
227+
228+
[twelve-factor]: https://12factor.net/
229+
230+
[ramen-profitable]: http://www.paulgraham.com/ramenprofitable.html
231+
232+
[unix]: https://en.wikipedia.org/wiki/Unix_philosophy
233+
234+
[nvm]: https://github.com/creationix/nvm
235+
236+
[mongodb]: https://www.mongodb.com/
237+
238+
[redis]: https://redis.io/
239+
240+
[github-git]: https://help.github.com/articles/set-up-git/
241+
242+
[git]: https://git-scm.com/
243+
244+
[slack]: http://slack.crocodilejs.com/
245+
246+
[brew]: https://brew.sh/
247+
248+
[twitter]: https://twitter.com/niftylettuce
249+
250+
[twitch]: https://www.twitch.tv/niftylettuce

cli.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env node
2+
3+
// Inspired by:
4+
// <https://github.com/saojs/sao/issues/50>
5+
// <https://github.com/nuxt-community/create-nuxt-app/blob/master/packages/create-nuxt-app/package.json>
6+
7+
const path = require('path');
8+
const cac = require('cac');
9+
const sao = require('sao');
10+
const update = require('update-notifier');
11+
12+
const pkg = require('./package');
13+
14+
const cli = cac();
15+
16+
cli.command('*', 'Generate a new project', input => {
17+
const folderName = input[0] || '.';
18+
const targetPath = path.resolve(folderName);
19+
console.log(`> Generating project in ${targetPath}`);
20+
21+
const templatePath = path.dirname(require.resolve('./package'));
22+
23+
return sao({
24+
template: templatePath,
25+
targetPath
26+
});
27+
});
28+
29+
cli.parse();
30+
31+
update({ pkg }).notify();

config.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
docute.init({
2+
debug: true,
3+
title: 'Lad',
4+
repo: 'ladjs/lad',
5+
'edit-link': 'https://github.com/ladjs/lad/tree/master/docs/',
6+
twitter: 'niftylettuce',
7+
nav: {
8+
default: [
9+
{
10+
title: 'Scaffold a Koa webapp and API framework for node',
11+
path: '/'
12+
}
13+
]
14+
}
15+
});

favicon.ico

1.12 KB
Binary file not shown.

index.html

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE html>
2+
3+
<html>
4+
<head>
5+
<meta charset="utf-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
8+
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
9+
<link rel="icon" href="/favicon.ico" type="image/x-icon">
10+
11+
<title>Scaffold a Koa webapp and API framework for Node.js - Lad</title>
12+
<link rel="stylesheet" href="https://unpkg.com/docute@3/dist/docute.css" type="text/css">
13+
</head>
14+
15+
<body>
16+
<div id="app">
17+
</div>
18+
<script src="https://unpkg.com/docute@3/dist/docute.js" type="text/javascript">
19+
</script><script src="./config.js" type="text/javascript">
20+
</script><script type="text/javascript">
21+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
22+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
23+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
24+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
25+
ga('create', 'UA-40007865-3', 'auto');
26+
ga('send', 'pageview');
27+
</script>
28+
</body>
29+
</html>

index.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Script {
2+
constructor(config) {
3+
config = config || {};
4+
this._name = config.name || 'script';
5+
}
6+
renderName() {
7+
return this._name;
8+
}
9+
}
10+
11+
module.exports = Script;

media/lad-footer.png

24.8 KB
Loading

media/lad.png

114 KB
Loading

0 commit comments

Comments
 (0)