# Farga Farga is a FOSS lightweight and easily self-hostable Git forge meant for personal use. It's so tiny you could theoretically run it on a PS3. ## Features - It's small and uses less than 50MB of RAM. Host it on a PS3! - It uses SQLite as a database and stores all git repos on-disk. It's self-contained. - All features work without Javascript. It uses a couple HTML/CSS tricks to minimize JS usage. - Access your repos via SSH. - Its useful web view allows you to browse different branches: - `tree`, `blob` and `raw` modes let you view directories, files and raw files. - Create issues (optionally anonymously) and reply to them. - View a repo's git history. - Download a repo or branch as a ZIP. - The Hackatime integration shows how much time you've spent on a repo. - Signups are toggleable: only let people you trust in with an invite. - Create gists and save code snippets. It obviously includes no tracking, no advertising, no fingerprinting, etc. ## Running Farga ### Quick setup ```sh sudo pacman -Syu go git git clone https://tangled.org/poy.ooo/farga && cd farga cp example.env .env go run . ``` Note: this "quick setup" will only work on machines running Arch Linux. ### Prerequisites - Go 1.26.3 or higher. - Git + Git knowledge. ### Setup 1. Clone this repository, and `cd` into it. 2. Copy `example.env` and rename it to `.env`. 3. Modify any environment variables you need. CSRF_KEY will be automatically set by Farga. Set PUBLIC_URL to the URL at which you would access Farga's index, including http(s) (e.g: `https://localhost:3333`). 4. (Optional) Setup Hackatime OAuth: If you want to enable the hackatime integration, go to Hackatime's [OAuth2 Applications](https://hackatime.hackclub.com/oauth/applications) page, create a new application, and put the generated App ID and Secret to the the `.env`. 5. `go run .` ### Creating an ADMIN account To create an "Admin" account, run `go run . --new-admin`. It will generate a special invite token and print it to the terminal: ``` Your ADMIN invite token is: 'XOX2NFYR'. DO NOT SHARE IT. ``` Redeem it like any other invite. You'll be assigned "Admin" on registration. ## TODO: Farga is a work-in-progress. Here's a list of what's implemented and what's not. Items with a `?` prefix are possible future features. - [ ] Auth: - [x] Registration, login, logout. - [x] Auth Middleware. - [x] Invite system. - [x] Toggleable signups - Allow and disallow strangers. - [x] Hackatime OAuth2. - [x] Admin creation. (terminal) - [ ] Account deletion. - [ ] Export ALL data. - [ ] Repos: - [x] Repo creation. - [x] Repo deletion. - [x] Repo visibility toggle. - [ ] Repo log: - [x] Per-branch list - [ ] Commit view - [ ] Update description. - [x] Different branches. - [ ] Issues: - [x] Issue creation. - [x] Issue closing. - [ ] Issue deletion. - [ ] Replies and comments. - [x] Reply creation. - [ ] ? Reply deletion. - [ ] Polling. - [ ] Tags. - [x] Raw, Blob and Tree views. - Blob: - [ ] Fix code identation mismatch caused by line counter. - [ ] SSH: - [ ] Validate file size. (256MB/file, 1GB/repo) - [x] Private repos. - [x] Cloning and pushing. - [x] Public repos. - [x] Private repos. - [x] Pubkeys. - [ ] HTTP: - [ ] Cloning. - [ ] Public repos. - [ ] Private repos. - [x] ZIP: - [x] Generate ZIP. - [x] Stream ZIP. - [x] Per-branch ZIP. - [x] Hackatime: - [x] "Time spent" badge on repos. - [x] Link Hackatime. - [ ] Gists: - [x] Gist creation. - [x] Gist viewing. - [x] Gist edition. - [x] Gist deletion. - [ ] Gist list. - [ ] User profile. - [x] Repo list. - [x] Gist list. - [ ] Bio editing. - [ ] Custom palette CSS. - [ ] Frontend: - [ ] Make it responsive. - [x] Error and Message middleware. - [x] Tests. - [ ] ? RSS Feeds: - [ ] ? Per user. - [ ] ? Per repo. - [ ] ? CI: - [ ] ? Lua config files. - [ ] ? CI is just running .sh scripts. - [ ] Debug errors in CI. ## Contributing Contributions are welcome and greatly appreciated. Read [DEVELOPMENT.md](DEVELOPMENT.md) for reference. Main development is happening at [https://tangled.org/poy.ooo/farga](https://tangled.org/poy.ooo/farga) Don't hesitate to contact me if you have any questions or want to talk about the project itself. ## Security If you believe you have found a security vulnerability, please email [webmaster@poy.ooo](mailto:webmaster@poy.ooo) as soon as possible with the following details: - Explanation of the issue. - Steps to reproduce / PoC. - How to mitigate or fix the issue. (optional) I'll get back to you ASAP. ## License Farga is Free Libre Open Source Software (FLOSS) licensed under the GNU AGPLv3 license. See the [LICENSE.txt](LICENSE.txt) file for details.