A complete lead management applicationbuilt with Codexirra, using a React, Vite, TypeScript frontend, a FastAPI backend, and Postgres database.
This template was generated with Codexirra, an AI development workspace for building real web applications. Codexirra helps you generate, edit, preview, debug, and refine full-stack web apps from simple prompts.
Want to build your own CRM, dashboard, portal, or SaaS app?
Try Codexirra: https://codexirra.com
This project is an example of what can be created using Codexirra.
Codexirra can help generate complete web applications with:
- Frontend pages and components
- Backend API routes
- Database-aware app logic
- Clean SaaS-style UI layouts
- Forms, tables, dashboards, filters, and detail pages
- Full project structure
- Editable code and live preview
LeadFlow CRM is designed as a practical business application template for managing leads, contacts, follow-ups, notes, pipeline stages, and sales activity.
LeadFlow CRM is a complete lead management web application for tracking leads, statuses, contacts, notes, follow-ups, and pipeline activity.
It uses a modern SaaS sidebar layout with dashboard analytics, searchable tables, forms, filters, and lead detail workspaces.
- React
- Vite
- TypeScript
- Python
- FastAPI
- Postgres
- Dashboard cards for total leads, open pipeline value, weighted forecast, and overdue follow-ups
- Pipeline breakdown by stage and status
- Recent activity feed and upcoming follow-up queue
- Leads table with search and filters for status, stage, priority, and source
- Lead creation workflow with validation
- Lead detail page with editable status, stage, owner, priority, value, and close date
- Contact management per lead
- Notes with author and timestamp
- Follow-up scheduling and completion
- Automatic pipeline activity logging
- Realistic seed data on first startup
npm install
npm run devThe frontend API client reads the backend URL from VITE_API_URL or VITE_API_BASE_URL. If neither is set, it falls back to same-origin /api, which works with preview/runtime proxying. If a configured URL is only an origin, the client automatically appends /api so requests still hit the FastAPI routes.
For local Vite development, same-origin /api requests can be proxied to the FastAPI backend by setting VITE_API_PROXY_TARGET for the Vite process, for example VITE_API_PROXY_TARGET=http://127.0.0.1:8000 npm run dev. The project does not hardcode a localhost proxy target so preview routing can connect the frontend and backend correctly.
cd backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
export DATABASE_URL="postgresql://USER:PASSWORD@HOST:PORT/DATABASE"
# Either entrypoint works from /backend:
uvicorn app.main:app --reload
# or
uvicorn main:app --reloadThe backend exports the FastAPI application as app from both /backend/app/main.py and /backend/main.py for compatibility with different Uvicorn runners. It initializes the Postgres schema when the API is reached and seeds sample business leads when the leads table is empty.
If the UI reports that /api returned the frontend HTML instead of backend JSON, verify these in order:
- Start the FastAPI backend and confirm
GET /api/healthreturns JSON. You can also confirmGET /apireturns{ "service": "LeadFlow CRM API", "status": "online" }. - Ensure
DATABASE_URLis set to a reachable Postgres database for the backend process. - In local Vite development, confirm
/apiis proxied to the backend or setVITE_API_PROXY_TARGETfor the Vite process. - Do not set
VITE_API_URLorVITE_API_BASE_URLto the frontend origin; leave them unset for same-origin/apipreview routing. If you are running locally and need Vite to proxy API calls, setVITE_API_PROXY_TARGETinstead.
The backend now stays online if Postgres is not ready at startup and returns JSON health/degraded responses instead of crashing during startup.
All application routes are under /api:
GET /apiGET /api/healthGET /api/dashboardGET /api/leadsPOST /api/leadsGET /api/leads/{lead_id}PATCH /api/leads/{lead_id}POST /api/leads/{lead_id}/contactsPOST /api/leads/{lead_id}/notesPOST /api/leads/{lead_id}/follow-upsPATCH /api/leads/{lead_id}/follow-ups/{follow_up_id}/complete
Create a local backend env file from /backend/.env.example if desired. The app calls load_dotenv(override=False), so platform-provided environment variables are not overwritten at runtime.