{"id":22544031,"url":"https://github.com/vanillaiice/itpg","last_synced_at":"2026-05-02T17:33:45.899Z","repository":{"id":239069579,"uuid":"782257215","full_name":"vanillaiice/itpg","owner":"vanillaiice","description":" ITPG - Is This Professor Good ? - a platform where students can rate their professors. ","archived":false,"fork":false,"pushed_at":"2024-09-25T19:48:05.000Z","size":184,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T08:15:41.400Z","etag":null,"topics":["api","education","go","golang","postgres","redis","server","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vanillaiice.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2024-04-05T00:02:37.000Z","updated_at":"2024-12-18T14:57:12.000Z","dependencies_parsed_at":"2024-06-19T11:16:31.205Z","dependency_job_id":null,"html_url":"https://github.com/vanillaiice/itpg","commit_stats":null,"previous_names":["vanillaiice/itpg"],"tags_count":44,"template":false,"template_full_name":null,"purl":"pkg:github/vanillaiice/itpg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanillaiice%2Fitpg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanillaiice%2Fitpg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanillaiice%2Fitpg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanillaiice%2Fitpg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vanillaiice","download_url":"https://codeload.github.com/vanillaiice/itpg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanillaiice%2Fitpg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277483275,"owners_count":25825559,"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","status":"online","status_checked_at":"2025-09-29T02:00:09.175Z","response_time":84,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["api","education","go","golang","postgres","redis","server","sqlite"],"created_at":"2024-12-07T14:05:59.888Z","updated_at":"2025-09-29T07:32:38.073Z","avatar_url":"https://github.com/vanillaiice.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Is This Professor Good ? - Backend (itpg-backend) [![Go Reference](https://pkg.go.dev/badge/golang.org/x/example.svg)](https://pkg.go.dev/github.com/vanillaiice/itpg) [![Go Report Card](https://goreportcard.com/badge/github.com/vanillaiice/itpg)](https://goreportcard.com/report/github.com/vanillaiice/itpg)\n\nBackend server for itpg, which is a platform where students can grade their professors after taking courses.\nThis allows students to make more informed decisions when choosing their courses.\nThis package handles http requests, database transactions, and user state management.\n\n# Installation\n\n## Go install\n\n```sh\n$ go install github.com/vanillaiice/itpg@latest\n```\n\n## Docker\n\n```sh\n$ docker pull vanillaiice/itpg:latest\n```\n\n## Git\n\n```sh\n$ git clone https://github.com/vanillaiice/itpg\n$ cd itpg\n$ go install .\n```\n\n# Setup\n\n## Installation\n\nFirst, install the itpg package following the instructions above.\n\n## Super admin user\n\nWhen running itpg for the first time you will be prompted to create a super admin user.\n\nYou can set the super admin's credentials using environment variables:\n\n```sh\n$ export ADMIN_USERNAME=admin ADMIN_PASSWORD=password ADMIN_EMAIL=admin@admin.com\n# or\n$ ADMIN_USERNAME=admin ADMIN_PASSWORD=password ADMIN_EMAIL=admin@admin.com itpg ---load config.toml\n# or put them in a file named .env\n$ itpg --load config.toml\n```\n\nOr enter them interactively when running the server:\n\n```sh\n$ itpg\n{\"level\":\"info\",\"time\":\"2024-06-10T13:32:02+00:00\",\"message\":\"Initializing users database users.db\"}\nenter admin username:\nadmin\nenter admin password:\npassword\nenter admin email:\nadmin@admin.com\n{\"level\":\"info\",\"time\":\"2024-06-10T13:32:21+00:00\",\"message\":\"Initialized users database users.db with super admin admin\"}\n```\n\n## Mail client\n\nTo send confirmation and reset codes to users, you need a SMTP mail server.\n\nYou can use a third party mail sending service like [Mailtrap](https://mailtrap.io/), [SendGrid](https://sendgrid.com/) or [Mailgun](https://mailgun.com/).\n\nOr manually set up a self-hosted mail server using the following guides:\n- [Landchad](https://landchad.net/mail/smtp/)\n- [linuxbabe](https://www.linuxbabe.com/mail-server/postfix-send-only-multiple-domains-ubuntu)\n\nYou can also use Docker:\n- [ixtodai/smtp](https://gitlab.com/ix.ai/smtp/)\n- [docker-mailserver](https://github.com/docker-mailserver/docker-mailserver)\n\nAfter setting up the mail server, store the SMTP credentials in an .env file:\n\n```sh\nSMTP_HOST = \"example.com\"\nSMTP_PORT = \"587\"\nMAIL_FROM = \"mailer@example.com\"\nUSERNAME = \"mailer\"\nPASSWORD = \"mailerr\"\n```\n\nIf the mail server is running on the same machine as itpg, the .env file should look like this:\n\n```sh\nSMTP_HOST = \"localhost\"\nSMTP_PORT = \"25\"\nMAIL_FROM = \"mailer@example.com\"\n```\n\n## Handlers\n\nThe handlers.json file contains the configuration for the server's HTTP endpoints.\n\n### Configuring handlers\n\n- `path` is the path of the HTTP endpoint (e.g. `/course/grade`).\n\n- `pathType` is the type of the path.\n\n\u003e Path types include `super`, `admin`, `user`, and `public`.\n\n- `handler` is the name of the Go function that handles the HTTP request.\n\n- `limiter` is the type of the limiter function that handles the HTTP request.\n\n\u003e Limiter types include `lenient` (1000 req/s/ip), `moderate` (1000 req/min/ip), `strict` (500 req/hr/ip), and `veryStrict` (100 req/hr/ip).\n\n- `method` is the HTTP method of the HTTP request.\n\n\u003e Methods include `GET`, `POST`, `PUT`, and `DELETE`.\n\n\u003e Method names should be in uppercase.\n\n### handlers.json snippet:\n\n```json\n{\n\t\"handlers\": [\n\t\t{\n\t\t\t\"path\": \"/course/grade\",\n\t\t\t\"pathType\": \"user\",\n\t\t\t\"handler\": \"gradeCourseProfessor\",\n\t\t\t\"limiter\": \"moderate\",\n\t\t\t\"method\": \"POST\"\n\t\t},\n\t\t{\n\t\t\t\"path\": \"/refresh\",\n\t\t\t\"pathType\": \"user\",\n\t\t\t\"handler\": \"refreshCookie\",\n\t\t\t\"limiter\": \"lenient\",\n\t\t\t\"method\": \"POST\" \n\t\t},\n```\n\n\u003e There should be a sample handlers.json file in the root of the project that can be used as a reference.\n\n## HTTPS\n\nIt is \u003cstrike\u003e`mandatory`\u003c/strike\u003e recommended to use HTTPS when running the itpg server.\n\n### Manual setup\n\n#### Certbot\n\nYou can use `certbot` to generate the needed server.key and server.crt files:\n\n```sh\n$ sudo certbot certonly --standalone -d \u003cYOUR_DOMAIN\u003e\n```\n\nThe needed files should be available at `/etc/letsencrypt/live/\u003cYOUR_DOMAIN\u003e/`.\nThe `privkey.pem`and `fullchain.pem` represent the `server.key` and `server.crt` files, respectively.\n\n\u003e note: make sure to renew the certificate before they expire as they are only valid for 90 days.\n\n#### Self signed (not recommended)\n\nYou can also generate the server.key and server.crt files using `openssl`:\n\n```sh\n$ openssl genrsa -out server.key 2048\n$ openssl req -new -x509 -key server.key -out server.crt -days 3650\n```\n\n\u003e source: https://github.com/denji/golang-tls\n\nAfter getting the files, pass them to the server like so:\n\n```sh\n$ itpg --key server.key --cert server.crt\n```\n\n### Using Caddy\n\nYou can set up automatic HTTPS with `Caddy`.\n\nFirst, run the itpg server locally on the machine with HTTP.\n\nFor example, let's run it on port 5555:\n\n```sh\n$ itpg --port 5555 -http\n```\n\nThen, create a Caddy reverse proxy to the itpg server through the following Caddyfile:\n\n```\nhttps://\u003cYOUR_DOMAIN\u003e {\n    reverse_proxy localhost:5555\n}\n```\n\nFinally, run Caddy:\n\n```sh\n$ caddy run --config Caddyfile\n```\n\n\u003e note: ports 80 and 443 need to be open for Caddy to generate the certificates.\n\n\u003e source: https://caddyserver.com/docs/quick-starts/reverse-proxy\n\n\u003e source: https://caddyserver.com/docs/automatic-https\n\n## Seeding the database\n\nFor the itpg server to be functional, we need to seed the database with data.\n\nIt can easily be done in most programming languages that have support for sqlite/postgres.\n\nThere is an example in [Go](https://github.com/vanillaiice/itpg-seeder), that uses the [jaswdr/faker](https://github.com/jaswdr/faker) package to seed the database with fake data.\n\n\u003e note: Ideally, we will need to gather data on the institutions where we want to implement itpg.\n\n\u003e The needed data include course codes, names, professor names, and the courses given by professors.\n\n\u003e For more information about the structure of the database, please read the table schemas in the db package.\n\n## Config\n\nPlease read the sample-config.toml file in the root of the project.\n\n# Usage\n\n```sh\nNAME:\n   itpg-backend - Backend server for ITPG, handles database transactions and user state management through HTTP(S) requests.\n\nUSAGE:\n   itpg-backend [global options] command [command options]\n\nVERSION:\n   v0.7.0\n\nAUTHOR:\n   vanillaiice \u003cvanillaiice1@proton.me\u003e\n\nCOMMANDS:\n   run, r    run itpg server\n   admin, a  admin management\n   help, h   Shows a list of commands or help for one command\n\nGLOBAL OPTIONS:\n   --port PORT, -p PORT                                                               listen on PORT (default: \"443\")\n   --db-backend value, -b value                                                       database backend, either sqlite or postgres (default: \"sqlite\")\n   --db URL, -d URL                                                                   database connection URL (default: \"itpg.db\")\n   --users-db value, -u value                                                         user state management bolt database (default: \"users.db\")\n   --cache-db URL, -C URL                                                             cache redis database connection URL\n   --cache-ttl value, -T value                                                        cache time-to-live in seconds (default: 10)\n   --log-level value, -g value                                                        log level (default: \"info\")\n   --cookie-timeout value, -i value                                                   cookie timeout in minutes (default: 30)\n   --env FILE, -e FILE                                                                load SMTP configuration from FILE (default: \".env\")\n   --pass-reset-url URL, -r URL                                                       password reset web page URL\n   --allowed-origins value, -o value [ --allowed-origins value, -o value ]            only allow specified origins to access resources (default: \"*\")\n   --allowed-mail-domains value, -m value [ --allowed-mail-domains value, -m value ]  only allow specified mail domains to register (default: \"*\")\n   --smtp, -s                                                                         use SMTP instead of SMTPS (default: false)\n   --http, -t                                                                         use HTTP instead of HTTPS (default: false)\n   --cert-file FILE, -c FILE                                                          load SSL certificate file from FILE\n   --key-file FILE, -k FILE                                                           laod SSL secret key from FILE\n   --code-validity-min value, -I value                                                code validity in minutes (default: 180)\n   --code-length value, -L value                                                      length of generated codes (default: 8)\n   --min-password-score value, -S value                                               minimum acceptable password score computed by zxcvbn (default: 3)\n   --handler-config FILE, -n FILE                                                     load JSON handler config from FILE (default: \"handlers.json\")\n   --load FILE, -l FILE                                                               load TOML config from FILE\n   --help, -h                                                                         show help\n   --version, -v                                                                      print the version\n```\n\n# Examples\n\n## Using Go\n\nIf itpg was installed using `go install`, you can simply run it from the command line:\n\n```sh\n# run the server with HTTP and pass an env file containing SMTP credentials\n$ itpg -t -e .smtp-env\n\n# run the server with a TOML config file\n$ itpg -l config.toml\n```\n\n## Using Docker\n\n```sh\n# run the server with HTTPS and pass a TOML config file\n$ ls itpg-data\n# output: server.crt cert.key config.toml\n$ docker run --rm -v ${PWD}/itpg-data:/itpg-data vanillaiice/itpg --load itpg-data/config.toml\n```\n\n# Related Projects\n\n- [itpg-docker-compose](https://github.com/vanillaiice/itpg-docker-compose)\n- [itpg-frontend](https://github.com/vanillaiice/itpg-frontend)\n\n# Author\n\nvanillaiice\n\n# Licence\n\nGPLv3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanillaiice%2Fitpg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvanillaiice%2Fitpg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanillaiice%2Fitpg/lists"}