This repository provides an integrated full-stack implementation combining a Django REST API with a React frontend. Authentication and data management are handled via Supabase.
- Frontend: React 18 (Vite build system, styled with Tailwind CSS)
- State/Data: TanStack Query, Supabase JS client
- Auth: Supabase (email/password + Google OAuth)
- Backend: Django 5 + Django REST Framework + CORS headers
- Tooling: TypeScript, ESLint, ShadCN UI components
- LLM: Llama 2.7 HF
- Python 3.11+
- Node.js 20+
- PostgreSQL (managed via Supabase)
Ensure both frontend and backend
.envfiles are configured before running the application.
- Create a Supabase project and enable the Google OAuth provider (Auth -> Providers -> Google).
- Run the SQL in
supabase/initial-setup.sqlfrom the Supabase SQL editor to create theprofilestable, enable row-level security, and auto-seed profiles when new users sign up. - Record the project URL and anonymous API key for use in frontend and backend environment variables.
- Do not commit keys or credentials to source control. Store them in your environment manager
cd frontend
npm install
npm run devThe frontend relies on Supabase for user authentication and profile persistence:
- Email/password sign up & sign in
- Google OAuth sign-in (redirect handled by Supabase)
- Persisted profiles (
profilestable) keyed to the authenticated user
Key Modules:
src/lib/supabaseClient.ts– shared Supabase clientsrc/context/AuthContext.tsx– wraps the app with session state + auth helperssrc/pages/Auth.tsx– auth UI wired to Supabase (email/password + Google)src/components/Navbar.tsx– reflects auth state (sign in/out buttons)
Environment variables:
VITE_API_BASE_URL=http://127.0.0.1:8000/api
VITE_SUPABASE_URL=…
VITE_SUPABASE_ANON_KEY=…
cd backend
pip install -r requirements.txt
python manage.py migrate
python manage.py runserverDefault settings give:
/api/health/– simple JSON healthcheck/api/placeholders/– example DRF ViewSet/– landing page to show the API is running
Environment variables (backend/.env.example):
DJANGO_SECRET_KEY=change-me
DJANGO_DEBUG=1
DJANGO_ALLOWED_HOSTS=127.0.0.1,localhost
DJANGO_CORS_ALLOW_ALL=1
- Profiles: During user registration, the frontend automatically synchronizes user metadata to the
profilestable via Supabase - Protected routes: Use the
useAuthhook anywhere to readuser,session, and helper functions. Gate pages or fetch user-specific data via Supabase queries or Django. - Google OAuth: Google OAuth is managed through Supabase’s redirect-based authentication flow, with session updates propagated through the frontend’s auth listener.
