pengu is lightweight web chat built with HTML 5 resembling Club Penguin.
The project uses npm to install dependencies and Node.js to run. Download them by running Nix’s nix-shell
command, using your system’s package manager or from their website.
Optionally, you will also need PostgreSQL database server if you want Pengu to remember player inventories across restarts.
- Create the following table in PostgreSQL database and set
DATABASE_URL
to correct connection string.
CREATE TABLE "penguin" (
"name" character varying NOT NULL PRIMARY KEY,
"closet" json DEFAULT '{}' NOT NULL,
"clothing" json DEFAULT '[]' NOT NULL,
"registered" timestamptz DEFAULT current_timestamp NOT NULL,
"banned" boolean DEFAULT false NOT NULL,
"group" character varying DEFAULT 'basic' NOT NULL
);
- Run
npm install
. - Compile assets using
npm run build
. - Start with
npm start
, the game will run on port set byPORT
env variable.
pengu uses the following environment variables for configuration:
PORT
– The port a web server will be running on. Of not specified it defaults to8080
.DATABASE_URL
– Connection string for the PostgreSQL database. If omitted, persistence will be missing.NODE_ENV
– Can be set toproduction
for less verbose logs. Defaults todevelopment
.OPENID_PROVIDER
– If this is set, pengu will use OpenID to log-in. Though it only supports using a hardcoded identity specified by this variable. User will be redirected to the provider, where they will confirm their credentials, and then be redirected back to Pengu with an access code. Pengu will then verify the access code against the OpenID verification URL and realm specified byOPENID_VERIFY
,OPENID_REALM
environment variables.ACCEPTED_ORIGINS
– comma-separated list of domain names that are allowed to access the WebSockets server. This is necessary to prevent cross-site request forgery. When the environment variable is not set, onlylocalhost
and127.0.0.1
will be allowed to connect.
The front-end of Pengu is stored in the assets/
directory and needs to be rebuilt when it is changed. You can use npm run build
command to do that, or npm run dev
if you want it to rebuild automatically on changes. Its build artefacts end up in the client/
directory, from where the server will serve them.
pengu source code is made available under MIT license.