Welcome to the RetentionBrain repository. This project contains a modern Next.js frontend (App Router) and a Django REST Framework backend designed for a clean, modular architecture ready for ML integration.
Frontend Link (https://retention-brain.vercel.app/)
Backend Link (https://retentionbrain.onrender.com/)
RetentionBrain/
├── frontend/ # Next.js 14 (App Router, TailwindCSS, TypeScript)
├── backend/ # Django REST Framework
└── README.md # This file
- Node.js (v18+)
- Python (3.10+)
-
Open a terminal and navigate to the backend folder:
cd backend -
Create and activate a virtual environment (Windows):
python -m venv venv .\venv\Scripts\activate
(On macOS/Linux:
source venv/bin/activate) -
Install the required dependencies:
pip install django djangorestframework djangorestframework-simplejwt django-cors-headers psycopg2-binary python-dotenv
(Note: The current configuration uses SQLite for rapid development. PostgreSQL and psycopg2 are ready when you decide to switch databases in
settings.py) -
Run the initial database migrations:
python manage.py makemigrations python manage.py migrate
-
(Optional) Create a superuser to access the Django admin panel (
http://localhost:8000/admin/):python manage.py createsuperuser
-
Start the development server:
python manage.py runserver
The backend API will run on http://localhost:8000
POST /api/register/- Register a new userPOST /api/login/- JWT Login (returnsaccessandrefreshtokens)POST /api/login/refresh/- Refresh JWT tokenGET /api/health/- Check if API is runningPOST /api/upload/- Upload a CSV file (Requires JWT auth header)
-
Open a new terminal and navigate to the frontend folder:
cd frontend -
Install the necessary NPM dependencies:
npm install
(Axios and Lucide React icons are already configured)
-
Start the Next.js development server:
npm run dev
The frontend will run on http://localhost:3000
- Axios Configuration: Pre-configured at
frontend/lib/axios.tsto automatically attach JWT tokens from local storage. - Routing: Setup via Next App Router.
/- Landing Page/login- Auth Page (Login/Registration Forms)/dashboard- Protected dashboard shell displaying metrics/upload- Protected CSV Upload page
- UI Components: Check
frontend/components/ui/for custom built components likeButton,Card, andTable.
Currently, the upload API performs a mockup successful intake of CSV files while adhering to the initial project phase constraints. In Phase 2, the ML and SHAP integrations will be connected natively through the Django endpoints.