I am starting an express.js project. I want to look at code of exiting large apps, especially their file system structure. Anyone knows of apps that use express.js and are on github?
7 Answers
Here's my layout.
./myapp
./public -- static files
./modules -- modules I made for reusability
./routes -- like controllers
./log -- app log file
./views -- ejs views
./config -- config.development.js, config.global.js
./templates -- email templates (text/html in ejs)
./pid -- for server
./init -- git post-receive hook for deploy
./models -- mongoose schemas

- 72,281
- 52
- 227
- 295
Take a look at my answer to ExpressJS How to structure an application. You can also look at the repo for my own web site, which although neither large nor exciting, is an express app and has a pretty sane filesystem and code organization scheme (IMHO).
Of coures, browse the list of ExpressJS applications on the main Express site. Not sure which if any are open source, but have a look through those.

- 1
- 1

- 142,938
- 30
- 279
- 274
-
Looks like the list has been moved to http://expressjs.com/resources/applications.html One of these (at least) has its source on github: https://github.com/feross/studynotes – K. P. MacGregor Apr 04 '15 at 14:06
Express is kind of notorious for not really having any specific guidance on how to lay out the folder structure and build big apps. To be fair, it's not really intended to be a "Rails", it's more of a light layer that simplifies basic HTTP features.
There may be some Express examples on Github, but none off the top of my head.
You may want to take a look at RailwayJS which is a lot closer to the expected "Rails" on top of Express. You may also want to take a look at Geddy which is used for large-scale apps. Geddy is not Express-based, but has more explicit guidance on how to structure everything.

- 44,957
- 11
- 105
- 108
-
I think the reason there is no project structure example is because everybody tends to do their own style. – Pickels Oct 23 '12 at 18:41
-
And that is bad in many cases. Proper structure is good - it improves maintainability and re-usability. – Pijusn Jul 22 '13 at 18:44
-
@Pius I agree that some guidance on structure from the Express guys would be awesome. In their defense, they were trying to build something lightweight that simply provided basic plumbing like cookies, static files, auth, variable passing. While a full-fledged web app will need things like Models, View and Controllers in specific places, Express can also be used for lots of purposes that are not "full-fledged". I have a site powered by Express that serves only static files and rendered Jade files. Not everything needs a full stack. – Gates VP Jul 23 '13 at 16:49
In my express app, I have more or less this structure:
project
|--app.js
|--bin
| `--shell scripts and stuff*
|--docroot
| `--static files, etc*
|--node_modules
| `--npm downloads go here*
|--lib
| |--vendor
| | `--jar files and stuff*
| |--my-custom-middleware1.js
| `--my-custom-middleware2.js
|--package.json
|--README.md
`--templates
`--a bunch of templates*
Works fairly well for what I need.

- 9,149
- 6
- 34
- 35
This not a very large scale project but it gives you a basic idea about how to structure you application it's a REST API https://github.com/khurrumqureshi/BotnikServer

- 933
- 1
- 8
- 13
Have a look at the examples of express that you can find at the github repository. If you are into MVC there is also an example for it. They give you a good first idea on how to structure your app.
More on how to structure your app is in the express faq under "How should I structure my application?"

- 16,171
- 8
- 62
- 96
There are a ton of apps on github that use express. For a large project you can look at krakenjs.com. Which is not really an app but more of a structure for an app that was created by paypal when they switched from java to node.js.
You can also look at more full stack app structures like mean.io or meanjs.org if you want to use angular.js and mongodb. Even if you don't you can get an idea of how they structure their code.

- 957
- 2
- 11
- 15