Files
gitea-native/README.md
T
JustZoe101 1ee0f95b3f feat: demo mode + demo end-to-end tests
- built-in mock Gitea backend (src/core/demo): repositories, issues, comments,
  reactions, labels/milestones, pulls, files, diff, reviews, inline comments,
  releases, notifications, activity, Actions runs/jobs/logs/artifacts/workflows,
  repo settings, orgs/teams/packages/credentials/admin, and benign writes
- session wires demoFetch for the demo instance; welcome screen 'Try the demo'
- demo E2E (16 tests over the real endpoint layer) + UI render E2E; minimal
  reanimated jest mock; README demo-mode section
2026-10-09 19:18:41 +02:00

9.8 KiB
Raw Blame History

Gitea Native

An unofficial, open-source Gitea client for iOS and Android, built with React Native (Expo) and TypeScript.

Unofficial project. Gitea Native is not affiliated with, endorsed by, or connected to the Gitea project or Codeberg. "Gitea" and "Codeberg" are names and trademarks of their respective owners. This app talks to your Gitea instance using the public REST API.


What it does today

Gitea Native is a real, working client — not a prototype. The current build covers the read-heavy Git workflow:

  • Connect to any Gitea instance with a personal access token (PAT); the internet address is validated and remote instances must use HTTPS.
  • Multiple instances, multiple accounts per instance, with instant switching and account-isolated caches.
  • Biometric app lock (Face ID / Touch ID / Android biometrics) that also redacts the app-switcher snapshot.
  • Home dashboard with your identity, recent repositories, assigned issues, review requests, activity feed and an unread-notification badge.
  • Repository browsing: list/search your repositories (and starred ones), repository overview, topics, statistics and languages.
  • Files: directory navigation with breadcrumbs, common image previews, Markdown rendering and source file viewing.
  • History: paginated commit list, commit details with file changes, branches and tags.
  • Issues & pull requests: cross-repository lists (assigned, created, review-requested), per-repository lists, and detail screens with Markdown bodies, labels, assignees, milestones and reviewers.
  • Collaboration: comment threads with compose/edit/delete, create and edit issues, approve / request-changes / comment reviews, merge (squash or merge commit), a native unified diff viewer, and CI check statuses.
  • Quick Edit: edit a file in-app and commit it through the Contents API — to a branch or a new branch (protected branches are handled), optionally opening a pull request in the same step.
  • Repository actions: star/unstar, watch/unwatch, fork, plus releases and assets, and a configurable "Open in editor" action.
  • Repository management: create repositories, edit settings and feature toggles, delete, transfer ownership, and manage collaborators, webhooks, branch protections and deploy keys.
  • Gitea Actions: workflow runs, jobs, job logs and artifacts, with re-run, cancel and workflow dispatch; plus repository secrets and variables.
  • Account: profile editing, organizations (list, repos, teams, create), packages (list, delete a version or all) and credential listings (SSH keys, GPG keys, tokens).
  • Instance administration: read-only users/organizations/repositories for instance admins.
  • Notification inbox: unread/all filters, mark-as-read, mark-all-read, and life-cycle-aware polling.
  • English & Dutch, light/dark/system theme, accessible touch targets and loading/empty/error states throughout.

See docs/FEATURE_PARITY.md for the full matrix of what is implemented versus planned.

Technology

Concern Choice
Runtime Expo SDK 57, React Native 0.86, React 19
Language TypeScript (strict)
Navigation React Navigation 7 (native stack + bottom tabs)
Server state TanStack Query 5 (+ AsyncStorage persister for offline reads)
Client state Zustand 5
i18n i18next + react-i18next + expo-localization (en, nl)
Secure storage Expo SecureStore (Keychain / Android Keystore)
Biometrics expo-local-authentication
Lists Shopify FlashList 2
Markdown marked + a native renderer (no WebView)
Testing Jest (jest-expo) + @testing-library/react-native

Requirements

  • Node.js 20+ (developed on Node 24) and npm 10+.
  • A Gitea instance reachable over HTTPS (self-hosted or a public host such as gitea.com).
  • A personal access token created in Gitea under Settings → Applications → Manage access tokens. Read scopes (read:repository, read:issue, read:notification, …) are enough for everything implemented today.

Expo Go vs. development build

This project uses native modules (SecureStore, biometrics, expo-symbols, gesture handler, reanimated). They are all part of the Expo Go runtime or require a development build depending on the SDK. If anything native is missing, create a development build:

npx expo run:ios      # local build (needs Xcode)
npx expo run:android  # local build (needs Android Studio)
# or in the cloud:
bunx eas-cli build --profile development   # Bun projects
npx eas-cli@latest build --profile development

Getting started

# 1. Install dependencies
npm install

# 2. Start the dev server
npx expo start

Then press i (iOS simulator), a (Android emulator) or scan the QR code with a development build. Use npx expo start and open the app on a device/emulator with a dev build for the full feature set.

Demo mode

To try the app without a Gitea instance, tap “Try the demo” on the welcome screen. It registers a local demo account whose API requests are served by an in-app mock backend (src/core/demo/demo-fetch.ts) with sample repositories, issues, pull requests, reviews, releases, notifications, Actions runs and more. No network access or credentials are used, and every screen works exactly as it does against a real instance. Remove the demo from Settings → Accounts to leave demo mode.

Configuration

There is no server URL or credential in the repository. Everything is entered at runtime and stored on-device:

  • The instance URL and PAT are collected on the Connect screen.
  • The PAT is written to SecureStore only (token.<accountId> under the gitea-native.credentials keychain service). It is never written to AsyncStorage, logs, or the account registry.
  • App metadata lives in app.json (name, slug, icons, splash, iOS/Android identifiers). There is no .env file to configure for normal use.

A small in-memory copy of the active token exists in the Zustand store so the API client can attach it to requests; it is deliberately excluded from all persistence paths.

Commands

Command Purpose
npm start Start the Expo dev server
npm run ios / npm run android Start for a specific platform
npm run typecheck tsc --noEmit
npm run lint ESLint (Expo config)
npm test Jest unit/component tests
npm run verify typecheck + lint + tests
npm run format Prettier write

Run npm run verify before opening a pull request.

Project structure

src/
  App.tsx                     # Providers + navigation container + app lock
  components/                 # UI kit, layout, and Git-specific components
  core/
    api/                      # HTTP client, endpoints, types, errors, query keys
    accounts/                 # registry (pure logic), token store, Zustand store
    security/                 # biometric helpers
    utils/                    # formatting, infinite-query helpers
  features/
    accounts/ auth/ home/ inbox/ issues/ notifications/
    repositories/ repository/  # feature folders: hooks + screens + components
  i18n/                       # i18next init + en/nl locales
  navigation/                 # navigators, typed param lists, linking, themes
  theme/                      # design tokens and theme provider

Feature folders keep non-screen code (hooks, helpers, components) outside screens/. Every navigator lives under src/navigation/.

Internationalization

All user-facing strings go through t() from react-i18next. The device language is detected with expo-localization; the user can override it in Settings (system, en, nl). New keys must be added to both src/i18n/locales/en.json and src/i18n/locales/nl.json; a test enforces key parity and matching interpolation placeholders.

Security

See docs/SECURITY.md for the full threat model. Summary:

  • Tokens only in the platform keystore (SecureStore).
  • HTTPS enforced for remote instances; embedded credentials rejected.
  • No secrets in logs, error messages, or crash reports.
  • Biometric lock protects the UI and blanks the app switcher snapshot.

Architecture

See docs/ARCHITECTURE.md for the navigation graph, state/data-flow, API client and account-registry design.

Roadmap

See ROADMAP.md. Phases 0–5 are implemented. The only explicit gaps are OAuth sign-in (PAT is the supported path), content code search (no REST endpoint), and a line-level diff preview before committing.

Known limitations

  • OAuth / device flow is not implemented: Gitea has no OAuth2 device flow, and authorization-code OAuth needs a per-instance app registration. Personal access tokens remain the supported mobile sign-in.
  • Content code search has no Gitea REST endpoint; the app offers "Find file" (path search over the git tree) instead.
  • The in-app editor is CodeMirror 6 (bundled at build time) with line numbers, syntax highlighting and a search/replace panel.
  • Inline review comments can be composed at a line position (best-effort diff position mapping) — verify placement against your Gitea version.
  • Gitea's issues API exposes no sort parameter, so issue sorting is client-side (labels/milestone filtering is server-side).
  • Gitea's REST API exposes no total count for some endpoints, so infinite scroll falls back to a page-length heuristic.
  • Features that are unavailable or disabled on a given instance degrade to a clear empty/error state, or open in the browser where that is the only path (wiki). A version-based capability probe gates features without a server flag.

License

MIT © the Gitea Native contributors. See LICENSE. This is an independent project and is not derived from or endorsed by the Gitea project.