Complete guide for setting up and developing the Seshio MVP.
- Prerequisites
- Quick Start
- Conda Environment Setup
- Docker Setup
- Supabase Configuration
- Gemini API Setup
- Development Workflow
- Testing
- Common Commands
- Troubleshooting
-
Docker Desktop (includes Docker Compose)
- Download: https://www.docker.com/products/docker-desktop
- Verify:
docker --version&&docker-compose --version
-
Node.js 20+ and npm
- Download: https://nodejs.org/
- Verify:
node --version&&npm --version
-
Conda (Anaconda or Miniconda)
- Download: https://docs.conda.io/en/latest/miniconda.html
- Verify:
conda --version
-
Git
- Download: https://git-scm.com/downloads
- Verify:
git --version
For a fast setup, follow these steps. For detailed instructions, see the sections below.
# 1. Clone repository
git clone https://github.com/sakialabs/seshio
cd seshio
# 2. Create conda environment
conda create -n seshio python=3.11 -y
conda activate seshio
# 3. Install backend dependencies
cd backend
pip install -r requirements.txt
cd ..
# 4. Install frontend dependencies
cd frontend
npm install
cd ..
# 5. Configure environment variables
cp backend/.env.example backend/.env
cp frontend/.env.local.example frontend/.env.local
# Edit both files with your credentials (see sections below)
# 6. Start Docker services (DB + Redis)
docker-compose up -d postgres redis
# 7. Run database migrations
cd backend
alembic upgrade head
cd ..
# 8. Start development servers
# Terminal 1 - Backend
cd backend
uvicorn app.main:app --reload
# Terminal 2 - Frontend
cd frontend
npm run devAccess:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Docs: http://localhost:8000/docs
# Create new conda environment with Python 3.11
conda create -n seshio python=3.11 -y
# Activate environment
conda activate seshio
# Verify Python version
python --version # Should show Python 3.11.xcd backend
pip install -r requirements.txt# Code formatting and linting
pip install black ruff mypy
# Testing
pip install pytest pytest-asyncio pytest-cov hypothesisconda deactivateconda env remove -n seshioWe use Docker Compose with profiles for flexible deployment:
- Default: Only PostgreSQL and Redis (run backend/frontend locally)
- Full Profile: All services including backend and frontend
# Start everything in Docker
docker-compose --profile full up -d
# Or use make
make upThis starts:
- PostgreSQL (port 5432)
- Redis (port 6379)
- Backend API (port 8000)
- Frontend (port 3000)
# Start only database services
docker-compose up -d postgres redis
# Or use make
make up-dbThis starts only PostgreSQL and Redis. Run backend and frontend locally:
# Terminal 1 - Backend
conda activate seshio
cd backend && uvicorn app.main:app --reload
# Terminal 2 - Frontend
cd frontend && npm run dev# View logs
docker-compose logs -f
# View specific service
docker-compose logs -f postgres
docker-compose logs -f backend
# Check running services
docker-compose ps# Stop services
docker-compose down
# Stop and remove volumes (deletes data)
docker-compose down -v# Connect to PostgreSQL
docker-compose exec postgres psql -U postgres -d seshio
# Common commands:
\dt # List tables
\d table_name # Describe table
\q # Quit# Connect to Redis
docker-compose exec redis redis-cli
# Common commands:
PING # Test connection
KEYS * # List all keys
FLUSHALL # Clear all dataSeshio uses Supabase for authentication and file storage.
- Go to https://supabase.com and sign in
- Click "New Project"
- Configure:
- Name:
seshio-mvp - Database Password: (strong password)
- Region: (closest to you)
- Name:
- Wait ~2 minutes for setup
- Go to Authentication > Providers
- Enable Email provider
- Set Site URL:
http://localhost:3000 - Add Redirect URLs:
http://localhost:3000/** - Set password requirements (min 8 characters)
- Go to Storage
- Create bucket:
materials - Make it private (not public)
- Add policy for authenticated users:
(bucket_id = 'materials' AND auth.uid() = owner)- Go to Settings > API
- Copy:
- Project URL (e.g.,
https://xxxxx.supabase.co) - anon public key (for frontend)
- service_role key (for backend - keep secret!)
- Project URL (e.g.,
- Go to Settings > API > JWT Settings
- Copy JWT Secret
Frontend (frontend/.env.local):
NEXT_PUBLIC_SUPABASE_URL=https://xxxxx.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key_here
NEXT_PUBLIC_API_URL=http://localhost:8000Backend (backend/.env):
DATABASE_URL=postgresql+asyncpg://postgres:postgres@localhost:5432/seshio
DATABASE_URL_SYNC=postgresql://postgres:postgres@localhost:5432/seshio
SUPABASE_URL=https://xxxxx.supabase.co
SUPABASE_KEY=your_service_role_key_here
SUPABASE_JWT_SECRET=your_jwt_secret_here
GEMINI_API_KEY=your_gemini_api_key_here
REDIS_URL=redis://localhost:6379/0- Go to https://makersuite.google.com/app/apikey
- Sign in with Google account
- Click "Create API Key"
- Select or create a Google Cloud project
- Copy the generated API key
Edit backend/.env:
GEMINI_API_KEY=your_gemini_api_key_herecurl -H "Content-Type: application/json" \
-d '{"contents":[{"parts":[{"text":"Hello"}]}]}' \
"https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=YOUR_API_KEY"# 1. Activate conda environment
conda activate seshio
# 2. Start Docker services
docker-compose up -d postgres redis
# 3. Start backend (Terminal 1)
cd backend
uvicorn app.main:app --reload
# 4. Start frontend (Terminal 2)
cd frontend
npm run dev
# 5. View logs
docker-compose logs -f postgres# Format code
cd backend && black . && cd ..
cd frontend && npm run format && cd ..
# Lint code
cd backend && ruff check . && cd ..
cd frontend && npm run lint && cd ..
# Type check
cd backend && mypy . && cd ..
cd frontend && npm run build # TypeScript check# Create migration
cd backend
alembic revision --autogenerate -m "description"
# Apply migrations
alembic upgrade head
# Rollback migration
alembic downgrade -1cd backend
# Run all tests
pytest
# Run with coverage
pytest --cov
# Run specific test
pytest tests/test_main.py
# Run in watch mode (install pytest-watch)
ptwcd frontend
# Run all tests
npm test
# Run in watch mode
npm run test:watch
# Run with coverage
npm run test:coveragemake help # Show all commands
make up # Start Docker services
make down # Stop Docker services
make logs # View all logs
make test # Run all tests
make lint # Run linters
make format # Format code
make migrate # Run migrations
make clean # Clean Docker volumes# Development server
uvicorn app.main:app --reload
# With specific host/port
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
# Run tests
pytest
pytest --cov
pytest -v
# Format and lint
black .
ruff check .
mypy .# Development server
npm run dev
# Build for production
npm run build
npm run start
# Run tests
npm test
npm run test:watch
# Format and lint
npm run format
npm run lintProblem: conda: command not found
Solution:
# Add conda to PATH (bash)
export PATH="$HOME/miniconda3/bin:$PATH"
# Or reinitialize conda
conda init bash
source ~/.bashrcProblem: Wrong Python version in conda env
Solution:
conda deactivate
conda env remove -n seshio
conda create -n seshio python=3.11 -y
conda activate seshioProblem: Port already in use
Solution:
# Find process using port
lsof -i :5432 # macOS/Linux
netstat -ano | findstr :5432 # Windows
# Stop conflicting service or change port in docker-compose.ymlProblem: Docker containers won't start
Solution:
# Clean Docker system
docker-compose down -v
docker system prune -a
# Rebuild
docker-compose up -d --build postgres redisProblem: Can't connect to database
Solution:
# Check if PostgreSQL is running
docker-compose ps postgres
# Check logs
docker-compose logs postgres
# Verify DATABASE_URL in backend/.env
DATABASE_URL=postgresql+asyncpg://postgres:postgres@localhost:5432/seshioProblem: Migration fails
Solution:
# Check current migration version
cd backend
alembic current
# Reset database (WARNING: deletes all data)
docker-compose down -v
docker-compose up -d postgres
alembic upgrade headProblem: Module not found
Solution:
# Ensure conda environment is activated
conda activate seshio
# Reinstall dependencies
cd backend
pip install -r requirements.txtProblem: Import errors
Solution:
# Run from backend directory
cd backend
python -m pytest # Instead of just pytestProblem: Module not found
Solution:
cd frontend
rm -rf node_modules package-lock.json
npm installProblem: Build fails
Solution:
# Clear Next.js cache
cd frontend
rm -rf .next
npm run buildProblem: Frontend can't connect to backend
Solution:
- Verify backend is running:
curl http://localhost:8000/health - Check
NEXT_PUBLIC_API_URLinfrontend/.env.local - Check CORS settings in
backend/.env
seshio/
├── backend/ # FastAPI backend
│ ├── app/
│ │ ├── api/ # API routes
│ │ ├── core/ # Configuration
│ │ ├── db/ # Database setup
│ │ ├── models/ # SQLAlchemy models
│ │ ├── schemas/ # Pydantic schemas
│ │ ├── services/ # Business logic
│ │ └── tasks/ # Celery tasks
│ ├── alembic/ # Database migrations
│ ├── tests/ # Backend tests
│ └── requirements.txt
│
├── frontend/ # Next.js frontend
│ ├── src/
│ │ ├── app/ # App router pages
│ │ ├── components/ # React components
│ │ └── lib/ # Utilities
│ └── package.json
│
├── docs/ # Documentation
├── scripts/ # Setup scripts
└── docker-compose.yml # Docker configuration
After successful setup:
- Review the Requirements
- Check the Design Document
- Start implementing Tasks
- Explore the API Documentation
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Docs: http://localhost:8000/docs
- Supabase Dashboard: https://supabase.com/dashboard
- Google AI Studio: https://makersuite.google.com
- Check error logs carefully
- Review this guide's troubleshooting section
- Search for similar issues in the repository
- Ask for help in the team chat