{"id":14967580,"url":"https://github.com/ferg1e/comment-castles","last_synced_at":"2025-04-10T05:06:52.964Z","repository":{"id":43771066,"uuid":"374354361","full_name":"ferg1e/comment-castles","owner":"ferg1e","description":"Lightweight internet forum","archived":false,"fork":false,"pushed_at":"2025-02-02T17:16:27.000Z","size":904,"stargazers_count":64,"open_issues_count":14,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-24T08:12:08.806Z","etag":null,"topics":["comment-system","internet-forum","link-aggregator","node","oauth2","postgres","pug","reddit-clone","server-side-rendering"],"latest_commit_sha":null,"homepage":"https://www.commentcastles.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ferg1e.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-06T12:26:33.000Z","updated_at":"2025-02-02T17:16:31.000Z","dependencies_parsed_at":"2024-01-27T18:25:09.906Z","dependency_job_id":"38f48f48-bb92-428a-8934-2aa736039c61","html_url":"https://github.com/ferg1e/comment-castles","commit_stats":{"total_commits":1051,"total_committers":2,"mean_commits":525.5,"dds":0.0009514747859181716,"last_synced_commit":"2001394891cc360ae17bc887a808a33db8a19b3e"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ferg1e%2Fcomment-castles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ferg1e%2Fcomment-castles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ferg1e%2Fcomment-castles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ferg1e%2Fcomment-castles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ferg1e","download_url":"https://codeload.github.com/ferg1e/comment-castles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246916761,"owners_count":20854514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["comment-system","internet-forum","link-aggregator","node","oauth2","postgres","pug","reddit-clone","server-side-rendering"],"created_at":"2024-09-24T13:38:18.391Z","updated_at":"2025-04-03T01:12:47.660Z","avatar_url":"https://github.com/ferg1e.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Comment Castles\n\nComment Castles is an internet forum project. Users write posts, nested comments, user profiles and sub descriptions. Each post is assigned to a sub. There is a site-wide moderator and each sub has a moderator. There is an instance running at [commentcastles.org](https://www.commentcastles.org)!\n\nOther Features:\n\n* OAuth 2 JSON API\n* inbox for direct comments you receive\n* [help page](https://www.commentcastles.org/help)\n* light mode and dark mode\n\n## Install\n\nInstall one of the [tagged releases](https://github.com/ferg1e/comment-castles/releases), preferably the most recent.\n\nCreate a PostgreSQL 11 database and execute all the code in `sql/structure.sql`. This will create all the database tables, triggers, etc. PostgreSQL 11+ is probably fine.\n\nInstall Redis. This is only for the session store. Redis versions 2 and 6 worked for us, so most versions are probably fine.\n\nMake sure you have Node.js installed. I am using v20.10.0 locally and the live site uses v20.12.1.\n\nRun `npm install` to download all the Node.js dependencies that are listed in `package.json`.\n\nSet the following environment variables:\n\n* `PGHOST`: PostgreSQL host (usually `localhost`)\n* `PGUSER`: PostgreSQL username\n* `PGDATABASE`: PostgreSQL database name\n* `PGPASSWORD`: PostgreSQL password\n* `PGPORT`: PostgreSQL port\n* `HTTP_PORT`: Port this app will use\n* `REDIS_PORT`: Redis port\n* `IS_PROD`: This is a redundant production flag (there's already the built-in `NODE_ENV`) that must be set. If `NODE_ENV` is `\"production\"` then set this flag to `1`, otherwise use `0`.\n* `SESSION_NAME`: `express-session` `name`\n* `SESSION_SECRET`: `express-session` `secret`\n* `NODE_ENV`: built-in node environment flag\n\nOn Windows you can use a `.env` and `npm start` to set the environment variables. Here's a sample `.env`:\n\n```\nPGHOST=localhost\nPGUSER=postgres\nPGDATABASE=mydb\nPGPASSWORD=123abc\nPGPORT=5432\nHTTP_PORT=80\nREDIS_PORT=6379\nIS_PROD=1\nSESSION_NAME=mysesh\nSESSION_SECRET=wOgw3oQpmbYbie7V\nNODE_ENV=production\n```\n\nOn Linux we used an `ecosystem.config.js` and `pm2 start ecosystem.config.js` to set the environment variables. Here is a sample `ecosystem.config.js`:\n\n```\nmodule.exports = {\n    apps : [{\n        name: \"myappid\",\n        script: \"./app.js\",\n        env: {\n            PGHOST: \"localhost\",\n            PGUSER: \"postgres\",\n            PGDATABASE: \"mydb\",\n            PGPASSWORD: \"123abc\",\n            PGPORT: 5432,\n            HTTP_PORT: 80,\n            REDIS_PORT: 6379,\n            IS_PROD: 1,\n            SESSION_NAME: \"mysesh\",\n            SESSION_SECRET: \"wOgw3oQpmbYbie7V\",\n            NODE_ENV: \"production\",\n        }\n    }]\n}\n```\n\nOn the [API page](https://www.commentcastles.org/api), a post ID and comment ID are used in URLs on the page. If you want these links to work, you must create a post and comment and then set their IDs to match the ones used on the page.\n\n## Config\nThe configuration file is located at `src/config/index.js`. The `adminUserId` config value indicates the `user_id` of the site moderator. The site moderator can delete any post or comment. This `user_id` is from the `tuser` database table.\n\n## Update\nWhen you deploy new commits to your instance of this app that is already running, make sure to also execute any new commands that are in `sql/migrations.sql`.\n\nIf you deployed your instance before commit [46d52bff7765b250317ee297d570800447cb4afa](https://github.com/ferg1e/comment-castles/commit/46d52bff7765b250317ee297d570800447cb4afa), then you need to run `scripts/gen-user-public-ids.js` in order to generate public IDs for users that are already in the database.\n\nIf you deployed your instance before commit [c88bb90499aa616cd4f1d2b777d21e9a90d470c4](https://github.com/ferg1e/comment-castles/commit/c88bb90499aa616cd4f1d2b777d21e9a90d470c4), then you need to run `scripts/populate-domain-names.js`.\n\nIf you deployed your instance before commit [90b98831eeb5785391b371cf46712f1a0b4a0e47](https://github.com/ferg1e/comment-castles/commit/90b98831eeb5785391b371cf46712f1a0b4a0e47), then you need to run `scripts/set-last-comment-times.js`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fferg1e%2Fcomment-castles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fferg1e%2Fcomment-castles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fferg1e%2Fcomment-castles/lists"}