scaffold: modern rewrite skeleton (backend + frontend PWA) + roadmap

This commit is contained in:
TLimoges33 2025-08-28 17:05:19 +00:00
parent 2cf4b45b85
commit c64039bb2f
17 changed files with 269 additions and 0 deletions

11
modern/.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,11 @@
name: CI
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check Python syntax
run: python -m py_compile modern/backend/server.py
- name: Check frontend package.json
run: cat modern/frontend/package.json

11
modern/.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
# modern scaffold ignore
node_modules/
venv/
.env
dist/
.idea/
.DS_Store
__pycache__/
*.pyc
.env.local
/*.log

View File

@ -0,0 +1,7 @@
# Simple Dockerfile for the minimal Python backend
FROM python:3.11-slim
WORKDIR /app
COPY backend/requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt || true
COPY backend/ ./backend/
CMD ["python", "backend/server.py"]

15
modern/README.md Normal file
View File

@ -0,0 +1,15 @@
# LifeRPG Modern Scaffold
This folder contains a small scaffold to kick off the modernization of LifeRPG.
What is included:
- `backend/` - minimal stdlib-based JSON HTTP server (dev-only)
- `frontend/` - minimal React + Vite scaffold and PWA files
- `ROADMAP.md` - prioritized milestones and estimates
- Dockerfile and docker-compose for local development
Next steps:
- Replace backend with FastAPI and add DB/ORM/migrations
- Implement OAuth2 and integrations adapters
- Expand frontend with components and theming

View File

@ -0,0 +1 @@
This commit created a minimal scaffold for the modern LifeRPG rewrite (backend + frontend + PWA + roadmap). Replace the backend with FastAPI and add DB and integration implementations as next steps.

85
modern/ROADMAP.md Normal file
View File

@ -0,0 +1,85 @@
# LifeRPG Modernization Roadmap
This roadmap prioritizes work to modernize LifeRPG into a cross-platform, integrations-capable, security-focused habit-tracking "level-up" system.
Prioritization legend:
- Priority: P1 (high), P2 (medium), P3 (low)
- Effort: S (1-3 days), M (1-2 weeks), L (2-6 weeks)
Milestone 1 — Core rewrite & cross-platform skeleton (P1, S → M)
- Goal: Create a maintainable API backend, web frontend, and PWA shell.
- Tasks:
- Scaffold backend API (initial: lightweight stdlib server; target: FastAPI) — Effort: S
- Scaffold React frontend + Vite + PWA manifest — Effort: S
- Add Dockerfiles and docker-compose for local dev — Effort: S
- Add CI skeleton (lint/test/build) — Effort: S
- Success criteria: repo contains runnable dev skeleton and CI passes basic checks.
Milestone 2 — Data model & persistence (P1, M)
- Goal: Design DB schema and migration strategy.
- Tasks:
- Draft ER: Users, Profiles, Projects, Habits, Logs, Achievements, Integrations, ChangeLog — Effort: S
- Implement migrations + ORM (e.g., SQLAlchemy/Alembic or Diesel/Golang) — Effort: M
- Add encrypted backups and export/import — Effort: S
- Success criteria: migrations run and basic entities can be persisted.
Milestone 3 — Auth, security, and infra (P1, M)
- Goal: Secure auth and deployment-ready infra.
- Tasks:
- Implement OAuth2/OIDC login with PKCE and refresh tokens — Effort: M
- Secure storage for tokens (Keystore/Keychain) — Effort: M
- Add 2FA (TOTP) and account hardening — Effort: M
- Add security middleware (CSP, HSTS, secure cookies) — Effort: S
- Success criteria: secure login flows and CI security checks enabled.
Milestone 4 — Integrations platform (P1, M → L)
- Goal: Add Google Calendar, Todoist, GitHub, Slack integrations.
- Tasks:
- Build pluggable adapter interface + webhook receiver — Effort: S
- Implement Google Calendar adapter (OAuth + sync) — Effort: M
- Implement Todoist adapter and sample sync — Effort: M
- Add rate-limited worker queue for background sync (Redis/RQ/RabbitMQ) — Effort: M
- Success criteria: successful demo sync for at least Google Calendar.
Milestone 5 — Mobile & offline (P2, M)
- Goal: Provide Android support and offline-first experience.
- Tasks:
- Implement PWA caching + background sync — Effort: S
- Optionally scaffold React Native / Flutter app with local DB sync — Effort: M
- Implement conflict resolution strategy and sync indicators — Effort: M
- Success criteria: PWA installable on Android with offline tasks and sync.
Milestone 6 — Gamification & analytics (P2, M)
- Goal: Rebuild gamification engine and analytics dashboard.
- Tasks:
- Implement XP/levels, achievements, streaks model — Effort: S
- Add analytics endpoints and frontend charts (heatmap, time series) — Effort: M
- Add opt-in anonymized telemetry — Effort: S
- Success criteria: visible progress UI and charts in frontend.
Milestone 7 — Extensibility and portfolio polish (P3, M → L)
- Goal: Plugins, documentation, security portfolio artifacts.
- Tasks:
- Add plugin system (sandbox with WASM or Lua) — Effort: L
- Add thorough docs, CONTRIBUTING, CODE_OF_CONDUCT, architecture guides — Effort: M
- Add security writeups, SBOM, CI SAST scans, and demo accounts — Effort: M
- Success criteria: repo is ready for public demo with documentation and security artifacts.
Roadmap timeline (example pace: solo maintainer ~10 hrs/week):
- Month 0 (weeks 02): Milestone 1
- Month 1 (weeks 36): Milestone 2 + start Milestone 3
- Month 2 (weeks 710): Finish Milestone 3
- Month 34: Milestone 4
- Month 5: Milestone 5
- Month 6: Milestone 6
- Months 7+: Milestone 7 and polish
Risks & mitigations:
- Third-party API rate limits — use queued workers and backoff.
- OAuth complexity on mobile — use PKCE and server-side token exchange patterns.
- Privacy/regulatory requirements — provide E2EE option and clear privacy policy.
Deliverables created in this commit:
- Minimal scaffold for backend and frontend
- `ROADMAP.md` (this file)

13
modern/backend/README.md Normal file
View File

@ -0,0 +1,13 @@
Backend README
This is a minimal scaffold for the LifeRPG backend. It currently ships a tiny stdlib-based HTTP JSON endpoint for local development.
Next steps:
- Replace with FastAPI + Uvicorn for production.
- Add ORM (SQLAlchemy/Alembic) and migrations.
- Add OAuth2 and integration adapters.
Run (dev):
python server.py

View File

@ -0,0 +1,8 @@
# Example dependencies for later
fastapi
uvicorn[standard]
sqlalchemy
alembic
psycopg2-binary
pydantic
redis

34
modern/backend/server.py Normal file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env python3
"""
Minimal JSON HTTP server for the LifeRPG modern scaffold.
This intentionally uses only the Python stdlib so it's runnable without installing dependencies.
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
class Handler(BaseHTTPRequestHandler):
def _send_json(self, data, status=200):
payload = json.dumps(data).encode("utf-8")
self.send_response(status)
self.send_header("Content-Type", "application/json")
self.send_header("Content-Length", str(len(payload)))
self.end_headers()
self.wfile.write(payload)
def do_GET(self):
if self.path == "/health":
self._send_json({"status": "ok"})
return
if self.path == "/api/v1/hello":
self._send_json({"message": "Hello from LifeRPG modern backend"})
return
self._send_json({"error": "not_found"}, status=404)
if __name__ == "__main__":
server = HTTPServer(("0.0.0.0", 8000), Handler)
print("LifeRPG backend listening on http://0.0.0.0:8000")
try:
server.serve_forever()
except KeyboardInterrupt:
server.shutdown()

View File

@ -0,0 +1,8 @@
version: '3.8'
services:
backend:
build:
context: .
dockerfile: Dockerfile.backend
ports:
- "8000:8000"

View File

@ -0,0 +1,7 @@
Frontend README
This folder contains a minimal React + Vite app scaffold with PWA manifest and a small Service Worker.
Next steps:
- Run `npm install` then `npm run dev` to start local dev server.
- Replace placeholder UI with real components and integrate with backend.

View File

@ -0,0 +1,12 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>LifeRPG Modern</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>

View File

@ -0,0 +1,9 @@
{
"name": "LifeRPG Modern",
"short_name": "LifeRPG",
"start_url": "/",
"display": "standalone",
"background_color": "#ffffff",
"description": "A modern, cross-platform habit-leveling app.",
"icons": []
}

View File

@ -0,0 +1,17 @@
{
"name": "liferpg-modern-frontend",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"vite": "^5.0.0"
}
}

View File

@ -0,0 +1,10 @@
import React from 'react'
export default function App(){
return (
<div style={{padding:20,fontFamily:'system-ui, sans-serif'}}>
<h1>LifeRPG Modern</h1>
<p>Welcome frontend scaffold. Connect to backend at <code>/api/v1</code>.</p>
</div>
)
}

View File

@ -0,0 +1,9 @@
import React from 'react'
import { createRoot } from 'react-dom/client'
import App from './App'
createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
</React.StrictMode>
)

12
modern/frontend/sw.js Normal file
View File

@ -0,0 +1,12 @@
// Minimal service worker (cache-first for shell)
const CACHE = 'liferpg-shell-v1'
self.addEventListener('install', (e) => {
e.waitUntil(
caches.open(CACHE).then((cache) => cache.addAll(['/','/index.html']))
)
})
self.addEventListener('fetch', (e) => {
e.respondWith(
caches.match(e.request).then((r) => r || fetch(e.request))
)
})