karnova

Karnova (React + FastAPI + MongoDB)

A production-ready starter that includes:

Default Admin Login

Change admin credentials immediately in production using environment variables.


Project Structure


Backend Environment Variables (backend/.env)

Copy backend/.env.example to backend/.env and set values:

JWT_SECRET=replace-with-strong-secret
JWT_EXPIRE_MINUTES=120
FRONTEND_ORIGIN=http://localhost:5173

MONGODB_URI=mongodb+srv://<username>:<password>@<cluster-url>/?retryWrites=true&w=majority
MONGODB_DB_NAME=karnova

ADMIN_EMAIL=admin@gmail.com
ADMIN_PASSWORD=admin123

EMAIL_PROVIDER_API_KEY=replace-email-provider-key
THIRD_PARTY_API_KEY=replace-third-party-key

What each env is for


Frontend Environment Variables (frontend/.env)

Copy frontend/.env.example to frontend/.env:

VITE_API_BASE_URL=http://localhost:8000

Local Development

1) Backend

cd backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --host 0.0.0.0 --port 8000 --reload

2) Frontend

cd frontend
npm install
npm run dev

Open http://localhost:5173


MongoDB Setup

  1. Create a MongoDB Atlas cluster.
  2. Create a DB user.
  3. Add your IP to Network Access list.
  4. Get connection string and set MONGODB_URI.
  5. Start backend. Collections (users, user_queries, user_issues) are auto-used.

Deploy on Render (Backend)

  1. Push code to GitHub.
  2. Create Web Service on Render from repo.
  3. Root directory: backend.
  4. Build command:
    pip install -r requirements.txt
    
  5. Start command:
    uvicorn main:app --host 0.0.0.0 --port $PORT
    
  6. Add environment variables from backend .env format.
  7. Deploy.

Example backend URL after deploy:


Deploy on Vercel (Frontend)

  1. Import repo in Vercel.
  2. Set root directory to frontend.
  3. Framework preset: Vite.
  4. Add env:
    • VITE_API_BASE_URL=https://your-backend.onrender.com
  5. Deploy.

API Overview


Production Hardening Checklist