https://github.com/hackinggate/alttube-go
Backend code for alternative YouTube with no Ads, a YouTube clone avaliabe to Chinese users without censorship as of Feb 2024. (hosted on my home Raspberry Pi server behind Cloudflare tunnel)
https://github.com/hackinggate/alttube-go
backend golang no-ads privacy-protection video-streaming youtube
Last synced: about 1 year ago
JSON representation
Backend code for alternative YouTube with no Ads, a YouTube clone avaliabe to Chinese users without censorship as of Feb 2024. (hosted on my home Raspberry Pi server behind Cloudflare tunnel)
- Host: GitHub
- URL: https://github.com/hackinggate/alttube-go
- Owner: HackingGate
- License: mit
- Created: 2024-02-08T00:52:46.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-24T11:08:34.000Z (about 1 year ago)
- Last Synced: 2025-03-28T21:51:09.224Z (about 1 year ago)
- Topics: backend, golang, no-ads, privacy-protection, video-streaming, youtube
- Language: Go
- Homepage: https://efficiency-node-alttube.hackinggate.com/swagger/index.html
- Size: 243 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AltTube-Go
[](https://github.com/HackingGate/AltTube-Go/actions/workflows/lint.yml)
[](https://github.com/HackingGate/AltTube-Go/actions/workflows/golangci-lint.yml)
[](https://github.com/HackingGate/AltTube-Go/actions/workflows/ci-atlas.yaml)
[](https://github.com/HackingGate/AltTube-Go/actions/workflows/build-and-test.yml)
[](https://github.com/HackingGate/AltTube-Go/actions/workflows/github-code-scanning/codeql)
[](https://github.com/HackingGate/AltTube-Go/actions/workflows/dependabot/dependabot-updates)
## Getting Started
### Common steps
Generate `DB_PASSWORD` and `JWT_KEY` in `.env` and `.env.docker` file
```sh
python3 generate_credentials.py
```
Remove `data/` directory after generating `DB_PASSWORD`
```sh
rm -rf data/
```
### Local environment
Build and run
```sh
docker compose up -d --build alttube-postgres piped piped-postgres piped-proxy
go mod download
go run main.go
```
### Docker environment
Build and run
```sh
docker compose build
docker compose up
```
Build and run in background in one command
```sh
docker compose up --build -d
```
## Database Development
#### Dependencies
- [ent](https://entgo.io)
- [atlas](https://atlasgo.io)
#### Generate ent if ent/schema is updated
```sh
go generate ./ent
```
#### Generate Migration SQL
```sh
atlas migrate diff add_something_awesome \
--dir "file://ent/migrate/migrations" \
--to "ent://ent/schema" \
--dev-url "postgres://AltTube:AltTube@localhost:5432/AltTube?search_path=public&sslmode=disable"
```
#### Apply Migration SQL
```sh
atlas migrate apply \
--dir "file://ent/migrate/migrations" \
-u "postgres://AltTube:AltTube@localhost:5432/AltTube?search_path=public&sslmode=disable"
```
#### Visualize Database Schema
```sh
atlas schema inspect -w \
-u "postgres://AltTube:AltTube@localhost:5432/AltTube?search_path=public&sslmode=disable"
```
## API Documentation
#### Generate
Install [swag](https://github.com/swaggo/swag)
```sh
go install github.com/swaggo/swag/cmd/swag@latest
```
At the root of the project, run
```sh
swag init --parseDependency --parseInternal --parseDepth 1
```
#### Access
http://localhost:8072/swagger/index.html
https://efficiency-node-alttube.hackinggate.com/swagger/index.html