Introduction to the source

Marcel Klehr edited this page Jan 9, 2015 · 1 revision

General

Resources

For Developers

How to's

Set up

Advanced steps

Integrating Etherpad in your web app

for Developers

Clone this wiki locally

This is the official introduction to the source of etherpad. First, we're gonna take a look at the root directories...

Directories

etherpad
|- bin/
|- src/
|- doc/
|- tests/
|- node_modules/
|- var/

bin/ contains some useful scripts for e.g. running tests, checking pad integrity, deleting pads, migrating from DirtyDB to MySQL, etc.

src/ contains the etherpad source code.

doc/ contains the documentation in markdown format. Use $ make docs in etherpad root to build the html docs.

tests/ contains backend and frontend tests. To run the frontend tests, point your browser to <yourdomainhere>/tests/frontend. To run the backend tests, run bin/backendTests.sh.

node_modules/ contains installed plugins. The contents of src/ are deployed to node_modules/ep_etherpad-lite once you run bin\run.sh.

var/ contains the DirtyDB and some other stuff.

The source

Now, the source directory. This is what it looks like:

etherpad/src/
|- locales/
|- node/
|- static/
|- templates/
|- ep.json
|- package.json

locales/

locales/ contains the translations, which are managed by http://translatewiki.net

node/

node/ contains server-side code.

etherpad/src/node
|- db
|- eejs
|- handler
|- hooks
|- utils

db/ contains modules for accessing the database as well as the code handling the HTTP API. A commonly used module for example is Pad.js, which manages pad state. Take a peek!

eejs/ contains the templating engine. What's special about this is that templates are rendered on the server.

handler/ contains modules the handle stuff like import/export and collab messaging -- an important part of etherpad lives in PadMessageHandler.js. Go check it out!

hooks/ contains mostly express-related code for registering specific routes. E.g. i18n.js builds the translation files and registers routes to serve them; express/specialpages.js registers the routes that serve pads, the timeslider and others; express/static.js sets up a yajsml server which serves the client-side code. Click through the others to discover more!

utils/ contains modules for handling different import/export formats (e.g. ExportHtml.js), as well as parsing the settings file (Settings.js), the toolbar creation manager (toolbar.js), etc.

static/

static/ contains client-side js code, css and fonts. Most of this is self-explanatory.

etherpad/src/static
|- css/
|- custom/
|- font/
|- js/

js/ contains the client-side code.

templates/

templates/ contains the templates for the public pages index, pad and timeslider as well as the admin pages. Looking through the template code, you can find named eejs blocks. You can use these in your plugins to add custom html to the template.