liteBB is a very tiny BBS/forum written in Node.js.
It's goals are
- To have No frontend JavaScript. Everything is server-side rendered.
- To be small and fast.
- To have a code-base that can be easily understood by newcomers to the language.
- To be easy to deploy. ie. less or no moving parts.
Note: The choice of sequelize is that, if you, the user decide, you want a bigger database powering your community discussions, you can change it just like that, in the config. SQLite was chosen because its fits my needs perfectly.
P.S the name liteBB
comes from SQLite
and oh! there's a live instance running
on https://litebb.aktsbot.in/
$ git clone --depth=1 https://github.com/aktsbot/litebb litebb
$ cd litebb
$ npm i
$ mkdir dbs
$ NODE_ENV=production ./node_modules/.bin/sequelize db:migrate
$ cp example.env .env
$ # change the values in .env
$ npm start
- The forum has boards.
- Boards have posts.
- Posts have replies.
- Every user has a unique
username
. - Only
admin
users can create Boards. regular
users can create posts and replies.admin
s have access to the Settings page.- From the settings page, one can control the world.
- In the
.env
file, if there is aFIRST_RUN=1
entry, then users created while the app is running areadmin
s. - So ideally when you set the forum up, have
FIRST_RUN=1
in the.env
file. Then create your admin user. - Stop the server. Comment out
FIRST_RUN=1
or remove it and then restart the server. - I understand, this isn't ideal, but the software will be improved on.
-
SQLite is the star here. So have the
sqlite3
binary installed on our machine. For a GUI tool, there's sqlitebrowser. If you're using thesqlite3
binary, having the following in$HOME/.sqliterc
helps..header on .mode column
-
We'll need node.js installed on our machine. This is a node project after all. Also it helps, to install some tools like the
sequelize
cli globally.export NPM_PACKAGES=$HOME/.npm export NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH" export PATH=$NPM_PACKAGES/bin:$HOME/bin:$PATH
I don't like to
sudo npm i -g package
. With the above 3 lines in our$HOME/.profile
, we could do the same without sudo.$ npx sequelize
works too, but hey! -
We make use of the
sequelize
cli, if one does not like installing packages globally, just add an alias to our$HOME/.bashrc
. This is what I havealias sequelize="node_modules/.bin/sequelize"
-
To start the app in debug mode
$ DEBUG=litebb:* npm start
-
Sequelize cheatsheet, shamelessly ripped off from their README
Commands: sequelize db:migrate Run pending migrations sequelize db:migrate:schema:timestamps:add Update migration table to have timestamps sequelize db:migrate:status List the status of all migrations sequelize db:migrate:undo Reverts a migration sequelize db:migrate:undo:all Revert all migrations ran sequelize db:seed Run specified seeder sequelize db:seed:undo Deletes data from the database sequelize db:seed:all Run every seeder sequelize db:seed:undo:all Deletes data from the database sequelize db:create Create database specified by configuration sequelize db:drop Drop database specified by configuration sequelize init Initializes project sequelize init:config Initializes configuration sequelize init:migrations Initializes migrations sequelize init:models Initializes models sequelize init:seeders Initializes seeders sequelize migration:generate Generates a new migration file [aliases: migration:create] sequelize model:generate Generates a model and its migration [aliases: model:create] sequelize seed:generate Generates a new seed file [aliases: seed:create]
-
The app and session databases will be generated in
./dbs
.
Boards
------
id
name
description
slug
createdAt
updatedAt
Posts
-----
id
name
content
renderedContent
slug
boardId
createdByUser
createdAt
updatedAt
Replies
-------
id
postId
content
createdByUser
createdAt
updatedAt
Users
-----
id
username
email
passwordHash
role
resetPasswordToken
createdAt
updatedAt
- This software was influenced by writings of Nikita Prokopov and Matt Reyer. Thank you both for the teachings.
- The styling of the forum is borrowed from Slimvoice, with accents from ubuntu. Without them, liteBB wouldn't exist.
- This project was generated with the wonderful express-generator cli.
- The amazing wesbos for his Learn-Node repo.
- https://handyman.dulare.com/session-management-in-express/
- https://github.com/sequelize/express-example
- https://www.npmjs.com/package/connect-session-sequelize