{"id":27396875,"url":"https://github.com/kristapsdz/kcgi-framework","last_synced_at":"2026-03-02T13:12:57.074Z","repository":{"id":86151255,"uuid":"71175678","full_name":"kristapsdz/kcgi-framework","owner":"kristapsdz","description":"basic framework for a simple kcgi application","archived":false,"fork":false,"pushed_at":"2020-10-01T08:06:44.000Z","size":168,"stargazers_count":34,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-12-25T23:16:07.841Z","etag":null,"topics":["bchs","cgi-script","kcgi"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kristapsdz.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,"zenodo":null}},"created_at":"2016-10-17T19:54:53.000Z","updated_at":"2025-11-13T16:15:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"316d7abd-c0de-4a61-8e42-b8c30ae7caee","html_url":"https://github.com/kristapsdz/kcgi-framework","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/kristapsdz/kcgi-framework","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristapsdz%2Fkcgi-framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristapsdz%2Fkcgi-framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristapsdz%2Fkcgi-framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristapsdz%2Fkcgi-framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kristapsdz","download_url":"https://codeload.github.com/kristapsdz/kcgi-framework/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristapsdz%2Fkcgi-framework/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30003748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T12:19:43.414Z","status":"ssl_error","status_checked_at":"2026-03-02T12:19:02.215Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["bchs","cgi-script","kcgi"],"created_at":"2025-04-14T00:48:33.854Z","updated_at":"2026-03-02T13:12:57.067Z","avatar_url":"https://github.com/kristapsdz.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Synopsis\n\n**kcgi-framework** is a set of file priming a [BCHS](https://learnbchs.org)\nproject using [kcgi](https://kristaps.bsd.lv/kcgi) and\n[openradtool](https://kristaps.bsd.lv/openradtool).\n\nThe framework implements logging in and logging out over a session-based,\nRESTful JSON API.  It includes the full application stack:\n\n- database initialisation\n- database interface (C language)\n- REST interface (JSON)\n- front-end formatting (JavaScript)\n\nIt also includes a skeleton [port](https://man.openbsd.org/ports) for\n[OpenBSD](https://www.openbsd.org).\n\nThe existing code tries to follow best practises for all elements of the\nstack: clean ([style(9)](https://man.openbsd.org/style.9)), secure C\ncode that's logically separated, HTML and JavaScript that are\nwell-formed and satisfy CSP policies, and so on.\n\nAll parts are documented as fully as possible, from the database schema\nto the REST API.\n\nThe framework is portable for most modern UNIX systems as provided by\n[oconfigure](https://github.com/kristapsdz/oconfigure).  This includes\nOpenBSD, NetBSD, FreeBSD, Linux, Mac OS X, Solaris, and IllumOS.\n\nYou'll only use this framework *once* for your project---it's not\nsomething that's installed.\n\n## Installation\n\nYou'll need an up-to-date [kcgi](https://kristaps.bsd.lv/kcgi) and\n[openradtool](https://kristaps.bsd.lv/openradtool).\n\n1. Copy all files into your project directory.\n\n   Then read and edit the [Makefile](Makefile): it will list all of the\n   variables you'll need to set for your installation.  Override these\n   in a *Makefile.local* or directly in the Makefile.\n\n2. Review [yourprog.ort](yourprog.ort).  This describes your data model\n   and how data passes into and from the database.  Its syntax is\n   documented in\n   [ort(5)](https://kristaps.bsd.lv/openradtool/ort.5.html).\n\n3. Browse [main.c](main.c).  It uses the interfaces created by\n   [ort-c-header(1)](https://kristaps.bsd.lv/openradtool/ort-c-header.1.html)\n   to drive the REST API.\n\n4.  Read [index.xml](index.xml) and [index.js](index.js), both of\n    which interface the REST API.\n\nYou should probably use [TypeScript](https://www.typescriptlang.org/)\ninstead of JavaScript, but I'm keeping this simple.  Realistically that\nonly means installing the TypeScript compiler, adding some TypeScript to\nJavaScript in the Makefile, and that's it.\n\nThen deploy in the usual way:\n\n```\n% ./configure\n% make\n# make install\n```\n\nThere are several additional targets:\n\n- `installwww`: only HTML and JS sources\n\n- `installapi`: REST [OAS2.0](https://www.openapis.org/) API docs\n\n- `installcgi`: CGI script and a fresh copy of the database\n  (**warning**: this will replace the existing database)\n\n- `updatecgi`: install only the CGI script\n\n## Users\n\nIf you want to create a user, use\n[encrypt(1)](https://man.openbsd.org/encrypt.1) to generate a password\nhash and insert those into the database prior to `make installcgi`.\n(The hashing method depends upon the operating system.)\n\nAssuming a user `foo@bar.com` and substituting `yourpassword` for your\npassword and `yourhash` for the output of the encryption:\n\n```sh\n% make\n% printf 'yourpassword' | encrypt\n% sqlite3 yourprog.db\nsqlite\u003e insert into user values ('foo@bar.com', 'yourhash', 1);\nsqlite\u003e .quit\n```\n\nThe `printf` instead of `echo` is so that the trailing newline is not\nconsidered part of the password.\n\nYou can also run this on your live database, of course.\n\n## Package management\n\n**kcgi-framework** includes the building blocks for an OpenBSD\n[port](https://man.openbsd.org/ports.7) by including necessary files.\n\nThe port is in the [OpenBSD](openbsd) directory.  As-is, it installs the\nCGI script in */var/www/cgi-bin* and the database and database\nspecification in */var/www/data*.\n\nThe port uses the `yourprog-upgrade` script, which generates the\ndifference between the database specification for the existing database\nin */var/www/data* with the current version's specification.  It then\npatches the database and installs the current specification.  This keeps\nyour database smoothly up to date.\n\nIt's possible to embed this directly into the port *PLIST*, if desired.\n\nOf course, this is something you'll need to carefully test!  It uses\n[ort-sqldiff(1)](https://kristaps.bsd.lv/openradtool/ort-sqldiff.1.html),\nwhich has its limitations.\n\n## License\n\nAll sources use the ISC (like OpenBSD) license.\nSee the [LICENSE.md](LICENSE.md) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkristapsdz%2Fkcgi-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkristapsdz%2Fkcgi-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkristapsdz%2Fkcgi-framework/lists"}