Skip to content

Repository files navigation

SufyanWithCode AI

A production-oriented, ChatGPT-style AI assistant: a FastAPI streaming backend, a Flutter Android client, and a full DevOps + observability stack (Docker, Nginx, Prometheus, Grafana, Loki, Alertmanager, OpenTelemetry).

Read this first — honest status. This repository is a tested, working foundation, not a finished consumer product. The backend is real and covered by an automated test suite. The infra and mobile app are complete, coherent starting points. Turning this into something that survives millions of users and passes Google Play review still requires the work listed in ROADMAP.md (load testing, security review, store assets, real secrets management, etc.). Nothing here is stubbed or faked, but "clone and ship to millions tomorrow" is not a claim this repo makes.

What works today

  • Auth: JWT (access + refresh), bcrypt password hashing, Google Sign-In verification, OAuth2 password flow.
  • Chat: real Server-Sent-Events streaming, conversation history, per-user isolation, full-text-ish search.
  • LLM: provider abstraction — Anthropic streaming or an offline mock provider so the stack runs with zero API keys. Model is a config value.
  • Analytics: privacy-preserving usage events (salted pseudonymous user hash, derived topics, consent-gated query preview) feeding an admin dashboard API.
  • Admin: overview stats, user management, aggregation — behind role checks.
  • Files: upload + text extraction (PDF / DOCX / TXT / image).
  • Ops: Redis rate limiting, security headers, structured JSON logs, /metrics, optional OTel tracing, /health + /ready, Alembic migrations.

Quick start (backend + infra, no API key needed)

cp .env.example .env
# edit .env: set JWT_SECRET, POSTGRES_PASSWORD, ANALYTICS_SALT (openssl rand -hex 32)
# leave LLM_PROVIDER=mock for a first run, or set anthropic + ANTHROPIC_API_KEY

make certs          # self-signed TLS for local dev
make up             # postgres + redis + migrate + backend + nginx
# API docs:   https://localhost/docs   (self-signed cert warning is expected)
# health:     https://localhost/healthz

Add the monitoring stack:

make monitoring     # + Prometheus, Grafana, Loki, Alertmanager, OTel, exporters
# Grafana:    http://localhost:3000   (admin / $GRAFANA_ADMIN_PASSWORD)
# Prometheus: http://localhost:9090

Run the backend tests:

cd backend && python -m venv .venv && .venv/bin/pip install -r requirements.txt
.venv/bin/python -m pytest -q      # 10 passing

Mobile

See mobile/README.md — one flutter create . to generate platform folders, then flutter run --dart-define=API_BASE_URL=....

Repository layout

backend/       FastAPI app, models, Alembic, tests, Dockerfile
mobile/        Flutter client (Riverpod, go_router, SSE, markdown+highlight)
nginx/         reverse proxy, TLS, rate limiting, SSE-safe buffering
monitoring/    Prometheus, Grafana, Loki, Promtail, Alertmanager, OTel configs
.github/       CI (backend + mobile) and build/deploy pipelines
docs/          architecture, security, deployment, privacy, terms, Play Store

See ARCHITECTURE.md, SECURITY.md, DEPLOYMENT.md.

Pushing this to your GitHub

cd sufyanwithcode-ai
git init && git add . && git commit -m "feat: initial SufyanWithCode AI foundation"
git branch -M main
git remote add origin https://github.com/<your-username>/SufyanWithCode.git
git push -u origin main

About

sufyanwithcode

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages