CodiMD - Realtime collaborative markdown notes on all platforms. https://hackmd.io/c/codimd-documentation
Go to file
Wu Cheng-Han f8b029b2f4 Fixed checkCursorTag and checkCursorMenu not calculate doc height properly, fixed jquery-textcomplete support upSideDown 2015-09-25 13:39:08 +08:00
lib Fixed doc length should only limit when "both the doc length exceed the doc max length" and "the new doc length is more than previous doc" 2015-09-24 11:45:17 +08:00
public Fixed checkCursorTag and checkCursorMenu not calculate doc height properly, fixed jquery-textcomplete support upSideDown 2015-09-25 13:39:08 +08:00
tmp Jump to 0.3.1 2015-07-02 00:10:20 +08:00
LICENSE Initial commit 2015-05-04 14:06:46 +08:00
README.md Update README.md 2015-09-25 10:39:09 +08:00
app.js Updated realtime.js, use socket.io built-in broadcast function instead self iterate to avoid extra issues 2015-09-24 11:36:41 +08:00
config.js Fixed missing config for useCDN in index template 2015-09-24 11:29:09 +08:00
hackmd_schema.sql Changed db schema, table "note", column "title", type from "character varying(256)" to "text". 2015-09-15 17:37:00 +08:00
package.json Marked as 0.3.2 2015-07-11 12:52:04 +08:00

README.md

HackMD 0.3.2

Join the chat at https://gitter.im/hackmdio/hackmd

HackMD is a realtime collaborative markdown notes on all platforms.
Inspired by Hackpad, but more focusing on speed and flexibility.
Still in early stage, feel free to fork or contribute to this.

Thanks for your using! 😄

Get started

  1. Install PostgreSQL and MongoDB (yes, currently we need both)
  2. Import database schema, see more on below
  3. Setup the configs, see more on below
  4. Setup environment variables, which will overwrite the configs
  5. Run the server as you like (node, forever, pm2)

Database dependency

  • PostgreSQL 9.3.6 or 9.4.1
  • MongoDB 3.0.2

Import database schema

The notes are store in PostgreSQL, the schema is in the hackmd_schema.sql
To import the sql file in PostgreSQL, type psql -i hackmd_schema.sql

The users, temps and sessions are store in MongoDB, which don't need schema, so just make sure you have the correct connection string.

Structure

hackmd/
├── tmp/			--- temporary files
├── lib/			--- server libraries
└── public/			--- client files
	├── css/		--- css styles
	├── js/			--- js scripts
	├── vendor/		--- vendor includes
	└── views/		--- view templates

Configuration files

There are some config you need to change in below files

./config.js				--- for server settings
./public/js/index.js	--- for client settings

Client-side index.js settings

variables example values description
debug true or false set debug mode, show more logs
version 0.3.2 current version, must match same var in server side config.js

Environment variables

variables example values description
NODE_ENV production or development show current environment status
DATABASE_URL postgresql://user:pass@host:port/hackmd PostgreSQL connection string
MONGOLAB_URI mongodb://user:pass@host:port/hackmd MongoDB connection string
PORT 80 web port
SSLPORT 443 ssl web port
DOMAIN localhost domain name

Server-side config.js settings

variables example values description
testport 3000 debug web port, fallback to this when not set in environment
testsslport 3001 debug web ssl port, fallback to this when not set in environment
usessl true or false set to use ssl
urladdport true or false set to add port on oauth callback url
debug true or false set debug mode, show more logs
usecdn true or false set to use CDN resources or not
version 0.3.2 currnet version, must match same var in client side index.js
alloworigin ['localhost'] domain name whitelist
sslkeypath ./cert/client.key ssl key path
sslcertpath ./cert/hackmd_io.crt ssl cert path
sslcapath ['./cert/COMODORSAAddTrustCA.crt'] ssl ca chain
tmppath ./tmp/ temp file path
postgresqlstring postgresql://user:pass@host:port/hackmd PostgreSQL connection string, fallback to this when not set in environment
mongodbstring mongodb://user:pass@host:port/hackmd MongoDB connection string, fallback to this when not set in environment
sessionname connect.sid cookie session name
sessionsecret secret cookie session secret
sessionlife 14 * 24 * 60 * 60 * 1000 cookie session life
sessiontouch 1 * 3600 cookie session touch
heartbeatinterval 5000 socket.io heartbeat interval
heartbeattimeout 10000 socket.io heartbeat timeout
documentmaxlength 100000 note max length
facebook, twitter, github, dropbox, imgur multiple values your own api keys, see source code for details

Operational Transformation

From 0.3.2, we start support operational transformation.
Which make concurrent editing safe and not break up other users' operations.
Even more, now can show other clients' selections.
See more at http://operational-transformation.github.io/

License under MIT.