API & Integration Documentation

ReCode integrates with Appwrite to handle authentication, database operations, and file storage. This ensures secure, scalable, and real‑time communication between the frontend (React Native + Expo) and backend services.


🔐 Authentication API

ReCode uses Appwrite’s Auth service for user sign‑up, sign‑in, and session management.

Endpoints:

  • account.createEmailSession(email, password) → Sign in user

  • account.create(email, password, name) → Register new user

  • account.get() → Fetch current user profile

  • account.deleteSession('current') → Log out

Integration Flow:

  1. User enters email + password in ReCode’s sign‑up/sign‑in screen.

  2. Appwrite validates credentials and creates a session.

  3. ReCode stores session state in Zustand Auth Store.

  4. Profile is automatically created with avatar, XP, and rank tracking.

Drawing

🗄️ Database API

ReCode uses Appwrite’s Database service to store and retrieve user progress, challenges, and analytics.

Collections:

  • users → Profile data (XP, rank, streak, skill scores)

  • challenges → Challenge definitions (type, domain, difficulty, hints)

  • progress → Challenge completion, XP earned, streak updates

Endpoints:

  • databases.listDocuments(databaseId, collectionId) → Fetch challenges

  • databases.createDocument(databaseId, collectionId, data) → Save progress

  • databases.updateDocument(databaseId, collectionId, documentId, data) → Update streaks, skill scores

Integration Flow:

  1. User completes a challenge.

  2. ReCode updates local state (XP, streak, skill scores).

  3. Appwrite database stores completion data.

  4. Profile analytics update in real time.


✨ Why It Matters

  • Security → Appwrite handles authentication and data protection.

  • Scalability → Modular collections support new domains and challenge types.

  • Consistency → Local state mirrors backend data for seamless UX.

  • Extensibility → Easy to add new APIs (e.g., leaderboards, multiplayer challenges).

Last updated