API Overview

Welcome to the API documentation hub. This section contains comprehensive information about the backend services powering the portfolio ecosystem, including authentication, feedback management, analytics, and admin capabilities.

🚀 Backend API Service

The portfolio backend is an Express.js service providing RESTful APIs for:

  • User Authentication - Sign up, sign in, password management
  • Feedback Management - Public submissions with admin oversight
  • Analytics Tracking - Website metrics and event tracking
  • Admin Operations - Health monitoring, logs, and metrics
  • User Management - CRUD operations for users and roles

Base URL: http://localhost:3001 (development)
Production: Contact for production endpoint
Documentation: Backend API Reference

🔐 Authentication

The API uses Supabase Auth with JWT tokens for secure authentication.

Supported Methods

  • Supabase Auth - Email/password authentication
  • JWT Tokens - Access and refresh tokens
  • Admin Tokens - Legacy admin authentication
  • Social Auth - Google, GitHub (via Supabase)

Quick Start

# Sign up
curl -X POST http://localhost:3001/api/auth/signup \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "securepass123",
    "name": "John Doe"
  }'

# Sign in
curl -X POST http://localhost:3001/api/auth/signin \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "securepass123"
  }'

# Use access token
curl http://localhost:3001/api/users/me \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

View Authentication Docs

📡 API Endpoints

Authentication Routes

  • POST /api/auth/signup - Register new user
  • POST /api/auth/signin - Sign in with credentials
  • POST /api/auth/signout - End session
  • POST /api/auth/reset-password - Request password reset
  • POST /api/auth/update-password - Update password
  • GET /api/auth/me - Get current user

View Full Authentication API

Feedback Routes

  • POST /api/feedback - Submit feedback (public)
  • GET /api/feedback/get-feedback - Retrieve feedback (admin)
  • PUT /api/feedback/:id - Update feedback status (admin)

View Feedback API

Analytics Routes

  • GET /api/analytics - Get all analytics
  • GET /api/analytics/website/:id - Get by website
  • GET /api/analytics/date-range - Query date range
  • POST /api/analytics - Create analytics entry

View Analytics API

Admin Routes

  • GET /api/admin/health - System health check
  • GET /api/admin/metrics - Request metrics
  • GET /api/admin/logs - Application logs
  • GET /api/admin/users - User management

View Admin API

🔍 Rate Limits

Protection against abuse with rate limiting:

Endpoint TypeRate LimitWindow
Authentication10/minPer IP
Feedback5/15minPer IP
Analytics100/minPer API key
Admin100/minPer token

⚠️ Error Handling

All API errors follow a consistent JSON format:

{
  "success": false,
  "error": "Error message",
  "details": {
    "field": ["Validation error"]
  },
  "statusCode": 400
}

Common Status Codes

  • 200 - Success
  • 201 - Created
  • 400 - Bad Request (validation)
  • 401 - Unauthorized
  • 403 - Forbidden
  • 404 - Not Found
  • 429 - Rate Limited
  • 500 - Server Error

View Error Handling Docs

🛠️ Setup & Development

Prerequisites

  • Node.js 20+
  • pnpm 10.20.0+
  • Supabase account

Quick Setup

cd Backend
pnpm install
cp .env.example .env
# Configure .env with your credentials
pnpm dev

View Setup Guide

📚 Complete Documentation

On this page