openKB is a Markdown Knowledge base application (FAQ) built with Nodejs and ExpressJS. The application uses an embedded database (nedb) by default but can also use a MongoDB server by changing the config (see below). The application is designed to be easy to use and install and based around search rather than nested categories. Simply search for what you want and select from the results.
git clone https://github.com/mrvautin/openKB.git && cd openKB
Running the application in Production using minified code can be done by:
npm run uglify
NODE_ENV=production node app.js
openKBsupports Nodejs version 0.12 and above.
Don't want to manage, upgrade and install
openKB yourself? ezyFAQ is a hosted solution with all the benefits and features of
openKB and more but using a fully managed/hosted
public/themes/. See the example theme for more information.
admincan be a little difficult editing Markdown on smaller screens.
Admin article management
A new user form will be shown where a user can be created.
Most of the configuration can be done on the
/settings page but there are some addition values which require setting manually in the
||Sets the value in the URL for viewing an article (defaults to
||Sets the number of results shown on the home page|
||Sets the global date formatting. Uses moment.js date formatting, see more here: http://momentjs.com/docs/#/displaying|
||Shows the view count next to the results on the homepage and search|
||Updates the view count if the user is logged in, as well as for anonymous users|
||Shows the published date next to the results on the homepage and search|
||The order to sort articles|
||The title of your website|
||Whether to show any articles set to featured in a sidebar|
||Whether to show any articles set to featured in a sidebar when viewing an article|
||The number of featured articles shown|
||The theme to use for public facing pages. Leave blank for default.|
||The language to use for public facing pages. Leave blank for default (English).|
||Setting to "true" will require a user to login before viewing ANY pages|
||Whether to show article meta data including published date, last updated date, author etc|
||If enabled non authenticated users can submit article suggestions for approval|
||Controls whether the authors email address is displayed in the meta. Requires "Show article meta data" to be true.|
||Whether to allow Mermaid charts within articles|
||Whether to allow MathJax inputs within articles|
||Allows for the website to be run from a non root path. Eg: http://127.0.0.1:4444/openkb/|
||Controls whether links within articles open a new page (tab)|
||Whether to add HTML anchors to all heading tags for linking within articles or direct linking from other articles|
||Add live typeahead search results on the search inputs|
||Whether to add the body of your articles to the search index (requires restart)|
||Controls whether to show the
||A short website description when listing the homepage URL in search engines|
||The database type to use. See Database setup|
||Adds Google Analytics to public facing pages. Include the entire code from Google including the <script> tags.|
You can control the sort order or articles. You can sort on anything but popular fields are
sort_by field in the
config.json like so:
field: 'kb_viewcount' order: -1;
order values are:
1 = ascending order
-1 = decending order
has it's limitations if you wanted to scale your application to handle many articles and concurrent users. For this reason,
openKB also supports using a MongoDB server by simply changing the config file.
Here is the
config.json for the embedded database (NeDB):
Here is an example
config.json for a MongoDB server. You can use your own localhost MongoDB instance or you may choose a hosted MongoDB server like mLab.
"database":"type": "mongodb""connection_string": "mongodb://127.0.0.1:27017/openkb"
Alternately, for security reasons, you can use the Node environment variable (below) to store your MongoDB connection string.
An optional public API can be enabled through
/settings to allow inserting of documents by HTTP POST using services like IFTTT etc.
Note:The API is disabled by default
Once turned on, the API is hosted on route:
example.com/api/newArticle via POST of a Object. The JSON schema is:
'type': 'object''properties':'api_auth_token': 'type': 'string''kb_title': 'type': 'string''kb_body': 'type': 'string''kb_permalink': 'type': 'string''kb_published': 'type': 'boolean''kb_keywords': 'type': 'string''kb_author_email': 'type': 'string''kb_password': 'type': 'string''kb_featured': 'type': 'boolean''kb_seo_title': 'type': 'string''kb_seo_description': 'type': 'string''required': 'api_auth_token' 'kb_title' 'kb_body' 'kb_author_email' 'kb_published'
Note: An API access token is required to be able to use the API. If the API is turned on without a token, all requests will reject. Please use a hard to guess token
The return Object from the API will be as follows:
"result": false"errors":"Any error messages"
errors value will have any validation or error message which have occured. The
result is an approval boolean. Eg:
true was successful and
You can upgrade from NeDB to Mongodb by running the following command:
Note: You will first need to setup a valid MongoDB connection as per the "Database setup" instructions.
npm run-script dbUpgrade
please raise a Github issue if errors are encountered
The typeahead search is great! Your user types in the word or phrase and the results pop up under the search box. But... One of the things to consider is that there is a little more data being transmitted from server to browser to enable this functionality. This is not normally a big issue for most browsers as the data is cached but you may run into issues if the number of articles in your app is quite large.
As a general rule there is about 3KB of compressed data being transferred from server to browser for 20 articles with long titles and keywords. If you have hundreds of articles, the amount of data will increase and could cause performance issues. It is something to consider if your app seems to slow down once the article numbers increase. If this is the case, you can simply just turn it off.
Have design skills? Want to design theme(s) for
openKB? Please design and submit PR.
Have openKB running on a public facing server? Submit a PR with your URL and it will be updated here.
Using PM2 seems to be the easiest and best option for running production websites. See the PM2 for more information or a short guide here: https://mrvautin.com/Running-Nodejs-applications-in-production-forever-vs-supervisord-vs-pm2.