pgx
PGX — Lightweight Postgres for AI agents. Written in Rust. Thousands of isolated databases in one runtime. 🐘
翻譯準備中
尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證製作者的介紹僅有上面的一句話。 更多詳情請閱讀儲存庫 README。 儲存庫 README ↗
正在載入完整 README。
檢視完整 README ↗Website for displaying analytics and providing insights into your Codeforces profile.
Visit it at https://cf-insights.org.
The dashboard is split into four parts:
The data for the abovementioned charts is from the Codeforces API.
Performance calculation for the entire history of the user, displayed over the rating history chart.
This uses the standard elo rating system to calculate the probability of one rating achieving a higher rank in a contest than another.
It also utilizes Goroutines in a master-worker pattern for concurrent computation.
For more details see the performance documentation.
Practice problem recommendations based on the first problem the user did not solve in recent contests.
This is done by representing each problem as a vector of its tags.
Then we can take the vector sum of the recent unsolved problems, and find other problems with vectors similar to this.
For more details see the recommendation documentation.
Go for its high performance concurrency without sacrificing development speed.
PostgreSQL is primarily used as a local data store for caching Codeforces data to avoid waiting for their API.
SQLite would probably be a great fit for this as well.
To keep things fast and lean, also can't go wrong with the basics.
Docker is (very surprisingly) used for containerization and deploying the backend. The different images should be listed under "packages" on GitHub and are automatically updated when the main branch is pushed to. Chose Docker due to its simplicity when deploying, and Kubernetes would likely be overkill for this project.
esbuild is used for bundling and minimization. Chosen due to its speed.
The frontend is hosted on Cloudflare Pages, which also automatically redeploys on pushes to main.
This project uses Docker and Docker Compose for containerization and container orchestration.
If you want to install for use with a CLI you need to follow these instructions:
If you prefer a GUI you can install Docker Desktop instead. Here are the official instructions.
[!NOTE] Docker only runs natively on Linux. If you are on Windows I recommend using WSL2. Installation docs.
You can also use Docker Desktop, which should set this up automatically. (Haven't tested this).
To make the PostgreSQL database work, you need to create a .env file with these variables:
POSTGRES_DB, the name of the database.POSTGRES_USER, the name of the database user.POSTGRES_PASSWORD, the password to the user.It does not matter what these are for the dev environment, but they must be set.
If you wish to run the frontend in addition to the server, you must enable the frontend compose profile.
This can be done by adding COMPOSE_PROFILES=frontend to .env.
For running the site locally use the provided Makefile.
To build and start the containers normally:
make
and to stop them:
make stop
It is intended to visit the site locally through Nginx on port 443, for HTTP/2 with support for request cancellation.
Hot reload is also automatically configured with esbuild to watch for changes and rebuild the frontend,
while Browsersync automatically reloads the page.
[!NOTE] The Nginx container uses self-signed SSL certificates which will likely cause your browser to warn you about entering the site.
You can ignore this warning by clicking "Advanced" and then "Continue"/"Proceed" (or something similar depending on what browser you use).
When the Nginx container has started visit https://localhost.
The job of the fetcher is to fetch and store Codeforces data in a database to avoid waiting for the Codeforces API when requests are made.
It is mainly used as a cron job on the server, but is also useful for fetching data for local development.
To run this you can use the Makefile with arguments depending on what you want to fetch.
To fetch all data run:
make fetch ARGS="-contests -problems"
-contests to enable contest fetching.-maxContestAge contests older than this will be re-fetched. Example: -maxContestAge=24h to fetch all problems older than 24 hours.-maxContestUpdates to set maximum amount of contest fetches.-maxContestAge. Example: -maxContestUpdates=100.The fetcher finds all available Codeforces contests that are not currently stored in the database and fetches them.
This drastically speeds up performance calculations, as the server does not have to wait on the Codeforces API.
However, this is not mandatory, and the server figures out whether to use stored contests or fetch live from Codeforces on its own.
-problems to enable problem fetching.The fetcher finds all Codeforces problems with at least one tag and stores them in the database.
This is used for recommending problems, and is required for it to work, unlike the contests.
[!NOTE] The fetcher only stores problems of contests that already exist in the DB.