1
0
Fork
You've already forked alfagok
0
My own spin on a Dutch version of the fun alphaguess.com https://alfagok.diginaut.net
  • Python 36.9%
  • JavaScript 35.8%
  • HTML 21.6%
  • CSS 5.7%
2026年06月30日 19:36:24 +02:00
src/alfagok v0.3.4 2025年10月22日 10:12:10 +02:00
wordlist Only use Scrabble words when available 2024年11月19日 15:20:20 +01:00
.gitignore Ignore direnv en venv 2026年01月08日 12:59:31 +01:00
pyproject.toml Initial version 2024年11月02日 21:42:56 +01:00
README.md example.com 2024年11月05日 16:43:55 +01:00
requirements-server.in Requirements to run on server 2024年11月02日 21:49:59 +01:00
requirements-server.txt Latest requirements 2026年06月30日 19:36:24 +02:00
requirements.in Use unidecode for accent-less word comparison; latest requirements 2025年09月24日 12:04:50 +02:00
requirements.txt Latest requirements 2026年06月30日 19:36:24 +02:00
tox.ini Initial version 2024年11月02日 21:42:56 +01:00

alfagok

Omdat Nederlanders ook alphaguess willen spelen :)

My own implementation of an alphaguess like game with custom word lists, tailored to be used with a Dutch source.

Using Alpine.js on the frontend and FastAPI as backend.

Environment variables

set -x WORD_LIST /path/to/alfagok_wordlist.txt
set -x START_DATE 2024-11-02
set -x DICTIONARY_LIST /path/to/dictionary.txt

In src/alfagok, with an active virtualenv with packages installed (uv pip sync requirements.txt), run:

fastapi dev main.py

Example configs

nginx

/etc/nginx/sites-enabled/alfagok.example.com.conf

server {
 listen [::]:443 ssl; # managed by Certbot
 listen 443 ssl; # managed by Certbot
 server_name alfagok.example.com;
 real_ip_header X-Forwarded-For;
 access_log /var/log/nginx/access_alfagok.example.com.log;
 error_log /var/log/nginx/error_alfagok.example.com.log warn;
 location / {
 proxy_pass http://127.0.0.1:8889;
 proxy_read_timeout 60;
 proxy_connect_timeout 60;
 proxy_redirect off;
 # Allow the use of websockets
 proxy_http_version 1.1;
 proxy_set_header Upgrade $http_upgrade;
 proxy_set_header Connection 'upgrade';
 proxy_set_header Host $host;
 proxy_cache_bypass $http_upgrade;
 }
 ssl_certificate /etc/letsencrypt/live/alfagok.example.com/fullchain.pem; # managed by Certbot
 ssl_certificate_key /etc/letsencrypt/live/alfagok.example.com/privkey.pem; # managed by Certbot
 include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
 if ($host = alfagok.example.com) {
 return 301 https://$host$request_uri;
 } # managed by Certbot

 listen [::]:80;
 listen 80;
 server_name alfagok.example.com;
 return 404; # managed by Certbot
}

systemd unit file

/etc/systemd/system/alfagok.service

[Unit]
Description=Gunicorn Daemon for alfagok game FastAPI
After=network.target
[Service]
User=USERNAME (fill in!)
Group=USERGROUP (fill in!)
WorkingDirectory=/srv/www/alfagok.example.com/alfagok/src
Environment="START_DATE=2024年11月02日"
Environment="WORD_LIST=/srv/www_data/alfagok.example.com/wordlist.txt"
Environment="DICTIONARY_LIST=/srv/www_data/alfagok.example.com/dictionary.txt"
Environment="STATIC_DIR=/srv/www/alfagok.example.com/alfagok/src/alfagok/static"
Environment="TEMPLATE_DIR=/srv/www/alfagok.example.com/alfagok/src/alfagok/templates"
ExecStart=/srv/www/alfagok.example.com/venv/bin/gunicorn -c /srv/www/_webconfig/sites/alfagok.example.com/gunicorn_alfagok_conf.py alfagok.main:app
[Install]
WantedBy=multi-user.target

gunicorn config file

# gunicorn_conf.py
from multiprocessing import cpu_count
bind = "127.0.0.1:8889"
# Worker Options
#workers = cpu_count() + 1
workers = 1
worker_class = 'uvicorn.workers.UvicornWorker'
# Logging Options, dir should be writable for User in systemd unit file
loglevel = 'debug'
accesslog = '/var/log/alfagok/access_log'
errorlog = '/var/log/alfagok/error_log'