Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .air.api.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
root = "services/api"
testdata_dir = "testdata"
tmp_dir = "tmp"

[build]
args_bin = []
bin = "./tmp/main"
cmd = "go build -o ./tmp/main ./cmd/api/main.go"
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = ["cmd", "internal", "pkg"]
include_ext = ["go", "tpl", "tmpl", "html", "toml"]
include_file = []
kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = true

[log]
main_only = false
time = false

[misc]
clean_on_exit = false

[screen]
clear_on_rebuild = false
keep_scroll = true
37 changes: 37 additions & 0 deletions .air.auth.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
root = "services/auth"
testdata_dir = "testdata"
tmp_dir = "tmp"

[build]
args_bin = []
bin = "./tmp/main"
cmd = "go build -o ./tmp/main ./cmd/auth/main.go"
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = ["cmd", "internal", "pkg"]
include_ext = ["go", "tpl", "tmpl", "html", "toml"]
include_file = []
kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = true

[log]
main_only = false
time = false

[misc]
clean_on_exit = false

[screen]
clear_on_rebuild = false
keep_scroll = true
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: FitFeed CI

on:
push:
branches: [ master, main, gemini ]
pull_request:
branches: [ master, main ]

jobs:
backend-test:
name: Backend Tests (Go)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true

- name: Auth Service Tests
run: cd services/auth && go test -v ./... -coverprofile=coverage.out

- name: API Service Tests
run: cd services/api && go test -v ./...

- name: Run Govulncheck
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
cd services/auth && govulncheck ./...
cd ../api && govulncheck ./...

frontend-test:
name: Frontend Tests (React)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install dependencies
run: cd services/web && bun install

- name: Lint
run: cd services/web && bun run lint

- name: Build
run: cd services/web && bun run build

security-scan:
name: Security Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
args: ./...
43 changes: 43 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: FitFeed Docs

on:
push:
branches:
- master
- main
paths:
- 'docs/**'
- 'mkdocs.yml'

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com

- uses: actions/setup-python@v5
with:
python-version: 3.x

- run: echo "cache_id=$(date --utc +%V)" >> $GITHUB_ENV

- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-

- name: Install dependencies
run: pip install mkdocs-material pymdown-extensions

- name: Deploy Docs
run: mkdocs gh-deploy --force --config-file docs/mkdocs.yml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.venv
site
config.toml
62 changes: 62 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Main Makefile for FitFeed project

.PHONY: help init dev dev-db dev-stop dev-auth dev-api dev-web migrate-up migrate-down

help:
@echo "FitFeed Development Environment"
@echo ""
@echo "Usage:"
@echo " make init - Check and install required tools"
@echo " make dev - Run all services in development mode"
@echo " make dev-db - Run only the database (Docker)"
@echo " make dev-stop - Stop the database and other containers"
@echo " make dev-auth - Run Auth service with hot-reload (Air)"
@echo " make dev-api - Run API service with hot-reload (Air)"
@echo " make dev-web - Run Web frontend (Vite)"
@echo " make migrate-up - Run database migrations up"
@echo " make migrate-down - Run database migrations down"

init:
@echo "Checking development tools..."
@command -v go >/dev/null 2>&1 || { echo >&2 "Go is not installed. Install it from https://golang.org/doc/install"; exit 1; }
@command -v docker >/dev/null 2>&1 || { echo >&2 "Docker is not installed. Install it from https://docs.docker.com/get-docker/"; exit 1; }
@command -v air >/dev/null 2>&1 || { echo >&2 "Air is not installed. Install it with: go install github.com/air-verse/air@latest"; exit 1; }
@command -v node >/dev/null 2>&1 || { echo >&2 "Node.js is not installed. Install it from https://nodejs.org/"; exit 1; }
@command -v bun >/dev/null 2>&1 || { echo >&2 "Bun is not installed. Install it with: curl -fsSL https://bun.sh/install | bash"; exit 1; }
@if [ ! -f config.toml ]; then cp config.toml.template config.toml; echo "Created config.toml from template"; fi
@echo "All tools found and config initialized."

dev-db:
@echo "Starting Database..."
@docker compose -f deployments/docker-compose/postgres/docker-compose.yml up -d

dev-stop:
@echo "Stopping dev environment..."
@docker compose -f deployments/docker-compose/postgres/docker-compose.yml down

dev-auth:
@echo "Starting Auth service..."
@FITFEED_CONF=$(PWD) air -c .air.auth.toml

dev-api:
@echo "Starting API service..."
@FITFEED_CONF=$(PWD) air -c .air.api.toml

dev-web:
@echo "Starting Web frontend..."
@cd services/web && bun install && bun run dev

migrate-up:
@echo "Running migrations up..."
@cd services/dbm && FITFEED_CONF=$(PWD) go run cmd/dbm/main.go up

migrate-down:
@echo "Running migrations down..."
@cd services/dbm && FITFEED_CONF=$(PWD) go run cmd/dbm/main.go down

dev: dev-db
@echo "Waiting for database to be ready..."
@sleep 3
@make migrate-up
@echo "Starting all services..."
@make -j 3 dev-auth dev-api dev-web
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,45 @@ The core functionality is split across several services located in the `services

---

## 🛠️ Development

FitFeed uses a unified development environment managed by a root `Makefile` and `Air` for Go hot-reloading.

### 1. Initial Setup

Check if you have all required tools (Go, Docker, Node.js, Bun, Air) and initialize your local configuration:

```bash
make init
```

This will create a `config.toml` from the template. Edit it to provide your OAuth credentials or adjust ports.

### 2. Running the Project

To start the database, apply migrations, and start backend services (with hot-reload) and the frontend (Vite) in parallel:

```bash
make dev
```

To stop the development environment (database and other containers):

```bash
make dev-stop
```

### 3. Database Migrations

Manage your schema evolution using the `dbm` service through the Makefile:

```bash
make migrate-up
make migrate-down
```

---

## ⚙️ Installation and Setup

*(Note: Please fill in the detailed steps here once the setup is finalized. For now, this serves as a placeholder.)*
Expand Down
44 changes: 44 additions & 0 deletions config.toml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[api]
port = 8082

[auth]
port = 8081
prefix = "auth"
secret = "MuUhv7svOw9iWmeycg7iRhsuF5hr4Gik"
max_session_age = 86400
is_prod = false

[database]
driver = "postgres"

[database.postgres]
host = "localhost"
port = 5432
username = "postgres"
password = "secret"
dbname = "fitfeed"

[web]
hostname = "localhost"
protocol = "http"
port = 5173

[auth.providers.google]
enabled = false
client_id = ""
client_secret = ""

[auth.providers.github]
enabled = false
client_id = ""
client_secret = ""

[auth.providers.yandex]
enabled = false
client_id = ""
client_secret = ""

[auth.providers.vk]
enabled = false
client_id = ""
client_secret = ""
35 changes: 35 additions & 0 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,38 @@ site_name: FitFeed
site_url: https://fitfeed.org
repo_url: https://github.com/Linux-oiD/fitfeed
docs_dir: src

theme:
name: material
features:
- navigation.tabs
- navigation.sections
- content.code.copy

markdown_extensions:
- pymdownx.highlight:
anchor_linenums: true
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.mermaid_format

nav:
- Home: index.md
- User Guides:
- Overview: user-guides/index.md
- Admin Guides:
- Overview: admin-guides/index.md
- Configuration: admin-guides/configuration.md
- Deployment: admin-guides/deployment.md
- Developer Guides:
- Getting Started: developer-guides/development.md
- Architecture: developer-guides/architecture.md
- Data Models: developer-guides/data-models.md
- Services:
- Auth: developer-guides/services/auth.md
- API: developer-guides/services/api.md
- Web: developer-guides/services/web.md
16 changes: 16 additions & 0 deletions docs/src/admin-guides/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Configuration Reference

FitFeed is configured using a unified `config.toml` file.

## Core Configuration

| Key | Description | Default |
| :--- | :--- | :--- |
| `api.port` | Port for the API service | 8082 |
| `auth.port` | Port for the Auth service | 8081 |
| `auth.secret` | JWT signing secret | (generated) |
| `database.postgres.host` | DB Host | localhost |

## OAuth Providers

OAuth providers are configured under `[auth.providers.{name}]`. You must enable them and provide Client ID/Secret from the respective provider's developer console.
Loading
Loading