General#
What is Oshun?#
Oshun is a monorepo containing AI-powered creative tools organized into multiple domains. The 13 application domains include: Iris (AI assistant), Lilith (consciousness), Yemaya (creative studio), Isis (generation), Sophia (knowledge), Hathor (worldbuilding), Bellona (engines), Tara (meditation), Veritas (fact-checking), Psyche (mental health), Nyx (astronomy), Aja (motion AI), and Aphrodite (live streaming). Additional library-only domains provide cross-cutting capabilities like governance (Themis), blockchain (Aje), robotics (Galatea), and more.
Why a monorepo?#
- Shared code: Easy to share libraries and utilities
- Atomic changes: Changes across multiple packages in one PR
- Consistent tooling: Same build, test, and lint setup everywhere
- Dependency management: Single lockfile, consistent versions
What is Nx?#
Nx is a build system that provides:
- Smart caching for faster builds
- Affected commands to only build/test what changed
- Dependency graph visualization
- Code generators
Development#
How do I run a specific service?#
pnpm nx dev @domain/service-name
How do I run all services?#
pnpm dev
How do I add a new dependency?#
# Add to a specific project
cd apps/domain/my-app
pnpm add package-name
# Add to root (dev dependency for all)
pnpm add -D -w package-name
For shared dependencies, prefer using the catalog: reference in
pnpm-workspace.yaml to maintain consistent versions across the monorepo.
How do I use a shared library?#
Import directly using the TypeScript path mapping — no need to add workspace
dependencies manually for @oshun/* packages:
import { something } from '@oshun/database';
For domain libraries, use the domain prefix:
import { something } from '@iris/conversation-core';
Why is my build failing?#
Common causes:
- Missing dependencies: Run
pnpm install - Stale cache: Run
pnpm nx reset - TypeScript errors: Run
pnpm nx typecheck @project/name - Circular dependencies: Check with
pnpm graph
How do I clear the Nx cache?#
pnpm nx reset
How do I see what's affected by my changes?#
pnpm nx affected --graph
How do I update dependencies?#
# Update all dependencies
pnpm update
# Update a specific dependency
pnpm update package-name
# Update to latest (including major versions)
pnpm update --latest
Architecture#
How do domains communicate?#
- REST APIs: For external/public communication
- Events: For async communication via Redis Streams and BullMQ queues
- gRPC: For internal high-performance calls
Can I import from another domain?#
Only through the domain's public client library or shared contracts:
// WRONG - direct import from another domain's internals
import { something } from '@isis/generation-api/src/internal';
// CORRECT - through domain client
import { IsisClient } from '@isis/client';
// CORRECT - through shared contracts
import { AssetReference } from '@oshun/contracts-types';
How are module boundaries enforced?#
Nx module boundaries via project tags in project.json:
{
"tags": ["scope:iris", "type:lib", "layer:domain"]
}
Domain libraries can only depend on their own domain and shared libraries.
Where should I put shared code?#
- Domain-specific:
libs/{domain}/ - Cross-domain utilities:
libs/shared/ - Contracts/types:
libs/contracts/
Testing#
How do I run tests?#
# All tests
pnpm test
# Specific project
pnpm nx test @project/name
# With coverage
pnpm nx test @project/name --coverage
# Watch mode
pnpm nx test @project/name --watch
How do I run integration tests?#
pnpm nx e2e @project/name-e2e
How do I debug tests?#
Add --inspect flag:
node --inspect ./node_modules/.bin/vitest run
Database#
How do I create a migration?#
cd libs/{domain}/database
npx prisma migrate dev --name migration_name
How do I apply migrations?#
npx prisma migrate deploy
How do I reset the database?#
npx prisma migrate reset
How do I view the database?#
npx prisma studio
Docker#
How do I start infrastructure?#
docker compose -f docker/docker-compose.dev.yml up -d
How do I check logs?#
docker compose -f docker/docker-compose.dev.yml logs -f postgres
How do I start optional services?#
# Elasticsearch, Qdrant, Kafka, Neo4j, or all
docker compose -f docker/docker-compose.dev.yml --profile search up -d
docker compose -f docker/docker-compose.dev.yml --profile all up -d
How do I reset infrastructure?#
# Stop and remove all data
docker compose -f docker/docker-compose.dev.yml down -v
# Start fresh
docker compose -f docker/docker-compose.dev.yml up -d
Deployment#
How is deployment handled?#
Each domain has its own deployment pipeline defined in .github/workflows/.
Pushes to main trigger CI. Domain-specific deployment workflows handle staging
and production deployments. See docs/infrastructure/deployment.md for details.
How do I rollback?#
See the Rollback Procedures for detailed instructions covering ECS deployments, database migrations, and other rollback scenarios.
Troubleshooting#
"Module not found" error#
- Check the import path is correct
- Run
pnpm install - Check path mappings in
tsconfig.base.json - Restart your IDE
"Port already in use"#
# Find the process
lsof -i :3000
# Kill it
kill -9 <PID>
TypeScript errors in IDE but build passes#
- Restart TypeScript server (in VS Code: Cmd+Shift+P > "TypeScript: Restart TS Server")
- Reload window
- Check you have the right TypeScript version
Nx commands are slow#
- Use
pnpm nx affectedinstead of running everything - Check your disk space
- Run
pnpm nx resetto clear stale cache
Can't find a command#
List all available targets:
pnpm nx show project @project/name