|OK, so you’ve read the [[dev||Development]] page, you’re running the code locally, and now you’re ready to dive into the code. Wonderful. Welcome.|
Trustroots was built on MEAN. MEAN isn’t active anymore so it’s better not to rely too much on their documentation. Here’s a few general pointers to get started:
- The app uses MongoDB for data storage.
- Node / Express server side to publish APIs.
- Angular client side to pull from APIs and render templates.
- The development stack is glued together with grunt and other magic.
Also note that as of 2018Q4 we’re moving to [React](. See also https://github.com/Trustroots/trustroots/labels/React
You might want to read the folder structure to get a handle on how things are laid out. A quick summary:
modules/contains one folder for each “component” of the site, this is where most of the interesting stuff lives
modules/**/server/contains all the backend, server side stuff
/modelsdefines the Mongoose models. There are only a few, so it might be worth scanning them to understand the data model. For in depth description, see [[database]].
/controllersas you’d expect, Express controllers live here.
/routeslinks url paths to controllers
/testsdefines tests run server side
/jobsAgenda job scheduler (~cron) jobs (see config/lib/agenda.js for more)
modules/core/server/viewscontains email templates and initial rendered index.html
modules/**/client/contains all the client side stuff
modules/core/client/app/lesscontains the site wide style variables and
application.lessfile which includes rest of the modules.
/lessis where you’ll find CSS styles in LESS format. Each module should have .less file with the module name, which then includes rest of the less files from the same folder. E.g.:
modules/messages/client/app/less/messages.lesswhich then includes
thread.lessfrom the same directory.
/viewsis where you’ll find templates
/servicesis where you’ll find Angular service, mostly for connecting to REST API points
/configcontains the client side routes and other configs
/directivescontains the Angular directives
/controllerscontains the angular client side controllers
config/ta-da, configs! Server side.
/assetsDefines paths for assets (serverside JS, frontend CSS/JS/LESS, lib files etc)
/lib/envprimary config files. Don’t modify anything else here except
/lib/env/local.jsfile overriding other
env/*files. Put here your adjustments you don’t want have publicly at the repo (it’s git-ignored).
/lib/agenda.jsAgenda job scheduler (kinda like cron)
bower.jsfrontend packages, managed with Bower
package.jsbackend packages, managed with NPM
fontello.conf.jsconfig for icon font. Drag it to Fontello to edit.
Get stuck in
Easy issues are a great place to start. These should be issues which are fairly easily fixable. Hopefully with the folder layout above, and a little diving into the code, you should be able to find and fix one or two of these issues. If you’re just starting out with the code, these are a great way to contribute something really useful very quickly.
If you feel like checking out some docs before diving in, we recommend getting familiar especially with AngularJS as it intends to have steep learning curve.
Adding more significant features, major refactoring, and so on are typically handled by more experienced developers in the team. Don’t forget to jump on #trustroots on freenode to say hola, and hit us up there or in the issues if you have any questions. Thanks for helping out, we really appreciate it.
PS. You can also contact Mikael and he’ll walk you in to the project.