Skip to main content

Prerequisites

  • Docker & Docker Compose — for running the backend and database
  • Node.js 18+ — for the frontend
  • Git

1. Clone and Configure

git clone https://github.com/sahyogi/spn.git
cd spn
cp .env.example .env
Edit .env with your credentials:
# Database
POSTGRES_SERVER=localhost
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=spn_db

# Sanity CMS
SANITY_PROJECT_ID=your_project_id
SANITY_DATASET=production
SANITY_TOKEN=your_token

# AWS S3
AWS_ACCESS_KEY_ID=your_key
AWS_SECRET_ACCESS_KEY=your_secret
S3_BUCKET_NAME=your_bucket
AWS_REGION=eu-north-1

# Security
SESSION_SECRET=your-random-secret-key
GEMINI_API_KEY=your_gemini_key

2. Start the Backend

cd backend
docker-compose up -d --build
Backend is running at http://localhost:8000 Interactive API docs at http://localhost:8000/docs PostgreSQL available on localhost:5432

3. Run Database Migrations

docker compose exec api alembic upgrade head

4. Start the Frontend

cd frontend
npm install
npm run dev
Frontend running at http://localhost:5173

5. Verify Everything Works

curl http://localhost:8000/api/v1/system/health
# → { "status": "healthy" }
Then open http://localhost:5173 and register a new account.

Optional: Sanity Studio

Sanity handles rich media (logos, galleries) only. You can skip this for backend-only development.
cd sanity-studio
npm install
npx sanity login
npm run dev
# → http://localhost:3333

Running Tests

cd backend
pytest tests/ -v

Next Steps

Architecture

Understand the PostgreSQL-first system design

API Reference

Explore all available endpoints

Deployment

Deploy to production with Docker + Caddy

Testing

Backend and frontend test setup