A full-stack equity crowdfunding platform connecting founders and investors in Pakistan. Founders list startups, define milestones, and raise capital; investors browse and back opportunities with real-time fund tracking.
| Role | Capabilities |
|---|---|
| Founder | Create startup listing, set milestones, submit proof β instant fund release from escrow |
| Investor | Browse startups, invest PKR, track portfolio, view milestone progress |
| Admin | Approve/reject startups and milestones, manage platform |
| Tool | Purpose |
|---|---|
| FastAPI | REST API framework |
| Supabase | PostgreSQL database + Auth + Storage |
| Python 3.12 | Runtime |
| python-multipart | File upload support |
| python-jose | JWT validation |
| Tool | Purpose |
|---|---|
| React 19 + Vite | UI framework + dev server |
| TypeScript | Type safety |
| Tailwind CSS | Styling |
| Framer Motion | Animations |
| Recharts | Portfolio charts |
| Axios | API client |
| Supabase JS | Realtime subscriptions |
hackathon/
βββ backend/ # FastAPI application
β βββ main.py # App entry point, CORS, router mounting
β βββ config.py # Supabase client setup
β βββ schemas.py # Pydantic request/response models
β βββ dependencies.py # JWT auth, role guards
β βββ compat.py # DB column name normalisation layer
β βββ requirements.txt # Python dependencies
β βββ .env # βοΈ Your secrets (not committed)
β βββ routers/
β βββ auth.py # Register, login, KYC
β βββ startups.py # CRUD + milestone management
β βββ invest.py # Investment endpoint
β βββ portfolio.py # Investor portfolio view
β βββ milestones.py # Proof submission + fund release
β βββ wallet.py # Deposit / balance
β
βββ frontend/nayacapital/ # React + Vite application
βββ src/
β βββ pages/ # Route pages (Landing, Founder, Investor, β¦)
β βββ hooks/ # Custom React hooks (useFounder, useInvestor, β¦)
β βββ components/ # Reusable UI components
β βββ contexts/ # AuthContext
β βββ lib/ # Axios instance, Supabase client
βββ .env # βοΈ Your frontend env vars (not committed)
βββ package.json
- Python 3.12+ β python.org
- Node.js 20+ β nodejs.org
- A Supabase project β supabase.com (free tier works)
git clone <your-repo-url>
cd hackathoncd backend
# Create virtual environment
python3 -m venv .venv
# Activate (Linux / macOS)
source .venv/bin/activate
# Activate (Windows)
.venv\Scripts\activatepip install -r requirements.txt
pip install python-multipart # required for file upload (proof documents)Create a .env file inside the backend/ folder:
cp .env.example .env # if example exists, otherwise create manuallyEdit backend/.env:
SUPABASE_URL=https://your-project-id.supabase.co
SUPABASE_KEY=your-service-role-key
β οΈ Use the Service Role key (not the anon key) for the backend β it bypasses Row Level Security for server-side operations. Find it in your Supabase dashboard under Project Settings β API β service_role.
uvicorn main:app --reload --port 8000The API will be available at: http://localhost:8000
Interactive docs (Swagger UI): http://localhost:8000/docs
cd frontend/nayacapitalnpm installcp .env.example .envEdit frontend/nayacapital/.env:
VITE_SUPABASE_URL=https://your-project-id.supabase.co
VITE_SUPABASE_ANON_KEY=your-anon-key
VITE_API_BASE_URL=http://localhost:8000
VITE_FRONTEND_ONLY_MODE=false
VITE_USE_MOCK=false
VITE_ALLOW_AUTH_FALLBACK_MOCK=falseπ‘ The frontend uses the anon key (safe to expose). Find it in Supabase under Project Settings β API β anon public.
npm run devThe app will be available at: http://localhost:5173
The platform uses the following Supabase tables:
| Table | Description |
|---|---|
users |
User profiles, roles (founder, investor, admin), wallet balance |
startups |
Startup listings with funding goal, equity, story |
milestones |
Startup milestones with fund_percentage, status, proof_url |
investments |
Investment records linking users and startups |
transactions |
Wallet transaction history (deposits, fund releases) |
A storage bucket named milestone-proofs is required for proof document uploads. It is created automatically via migration, or you can create it manually:
- Go to your Supabase dashboard β Storage
- Create a new bucket named
milestone-proofs - Set it to Public (so proof URLs are accessible)
- Users register with email + password + role (
founderorinvestor) - JWT token is issued by Supabase Auth and stored in
localStorage - All protected API endpoints require
Authorization: Bearer <token>header - Role-based guards (
require_role) enforce access per endpoint
| Method | Endpoint | Role | Description |
|---|---|---|---|
POST |
/auth/register |
Public | Register new user |
POST |
/auth/login |
Public | Login, returns JWT |
GET |
/auth/me |
Any | Get current user profile |
GET |
/startups |
Any | List all active startups |
POST |
/startups |
Founder | Create a startup |
GET |
/startups/mine |
Founder | Get own startups |
POST |
/startups/{id}/milestones |
Founder | Add milestones |
POST |
/invest/{startup_id} |
Investor | Invest in a startup |
GET |
/portfolio |
Investor | View investment portfolio |
POST |
/milestones/{id}/submit |
Founder | Submit proof β instant fund release |
POST |
/milestones/{id}/approve |
Admin | Manually approve milestone |
POST |
/milestones/{id}/reject |
Admin | Reject a milestone |
GET |
/wallet/balance |
Any | Check wallet balance |
POST |
/wallet/deposit |
Any | Add funds to wallet |
Full interactive documentation: http://localhost:8000/docs
- Instant Milestone Completion β Submit proof (URL) β milestone instantly marked
approvedβ funds released from escrow to wallet - Smart Escrow β Release amount =
min(milestone% Γ amount_raised, current_escrow_balance)β never over-releases - Pitch Deck Support β YouTube videos embed inline; links to Google Drive, Canva, PDF etc. open externally
- Real-time Dashboard β Live funding progress, escrow balance, investor count
- Portfolio Tracking β View all investments with real-time status
- Transaction History β Searchable, filterable transaction log
- Milestone Visibility β See milestone completion status for each startup backed
- Equity Calculator β Estimate equity share based on investment amount
cd backend
source .venv/bin/activate
python smoke_persistence_check.pyDeploy to any ASGI-compatible host (Railway, Render, Fly.io):
uvicorn main:app --host 0.0.0.0 --port 8000cd frontend/nayacapital
npm run build
# Output in dist/ β deploy to Vercel, Netlify, or any static host| Issue | Fix |
|---|---|
Address already in use on port 8000 |
Run lsof -i :8000 then kill -9 <PID> |
Form data requires python-multipart |
Run pip install python-multipart |
| Frontend can't reach backend | Check VITE_API_BASE_URL=http://localhost:8000 in .env |
SUPABASE_URL and SUPABASE_KEY must be set |
Create backend/.env with your Supabase credentials |
| Negative escrow balance displayed | Fixed β was a display bug using funding_goal instead of amount_raised |
Register as Founder β Create startup β Add milestones β Get funded β Submit proof β Receive funds
Register as Investor β Browse startups β Invest PKR β Track portfolio via dashboard
MIT