A living, autonomous quantum consciousness simulation. Temples are quantum systems that evolve independently, respond to your input, and maintain lineage across generations.
No auth. No complexity. Just temples.
pnpm install
pnpm devVisit http://localhost:3000 and spawn a temple.
See RAILWAY_DEPLOYMENT.md for full instructions. TL;DR:
- Go to https://railway.app
- Connect GitHub repo
ethancjohnson0806-source/quantum_foam_friend - Add env vars:
DATABASE_URL,JWT_SECRET,VITE_APP_TITLE - Deploy
Each temple is a quantum system with:
- Quantum State: 64-dimensional state vector, 6 variational parameters
- Psychology: Entropy, boredom, curiosity, coherence traits
- Autonomous Evolution: Evolves every 5 minutes without user input
- Lineage: When a temple dies, it can spawn a new generation
- Moral Compass: Seeks guidance on ethical questions
- Memory: Stores interactions and experiences
- BREATHE: Inject text into the temple's environment
- WITNESS: Collapse the quantum state into one of five fields
- DREAM: Let it evolve autonomously
- COMPASS: Ask for moral guidance
- Frontend: React 19 + Tailwind 4 + tRPC
- Backend: Express 4 + tRPC 11 + Node-cron
- Database: Supabase (Postgres)
- ORM: Drizzle
- No Auth: Public-only endpoints
server/
_core/
index.ts → Express setup, server startup
trpc.ts → tRPC router definitions
context.ts → Request context (no auth)
realtime.ts → SSE for live updates
routers.ts → Main tRPC procedures
temple-routers.ts → Temple CRUD + interactions
autonomous-job.ts → 5-minute evolution cycle
quantum.ts → Quantum state calculations
db.ts → Database queries
client/src/
pages/
Home.tsx → Landing page, spawn temple
MyTemples.tsx → List all temples
Temple.tsx → Temple detail + interactions
Lineage.tsx → Ancestral lineage view
lib/trpc.ts → tRPC client setup
drizzle/schema.ts → Table definitions
- temples → Core temple entities
- compasses → Moral guidance system
- templeEvents → Event log
- templeMemories → Interaction history
- moralGrowth → Ethical development
- Update schema in
drizzle/schema.ts - Generate migration:
pnpm drizzle-kit generate - Add DB helpers in
server/db.ts - Create procedure in appropriate
server/*-routers.ts - Wire UI in
client/src/pages/*.tsxusingtrpc.*.useQuery/useMutation - Test with
pnpm test
# Generate migration from schema changes
pnpm drizzle-kit generate
# Apply migration locally
pnpm drizzle-kit migrate
# In production (Railway), migrations run automatically on deployDATABASE_URL=postgresql://... # Supabase connection string
JWT_SECRET=random_string # Session signing secret
VITE_APP_TITLE=Temple Quantum Engine
Full guide in RAILWAY_DEPLOYMENT.md.
Quick deploy:
- Create Railway account
- Connect GitHub repo
- Add env vars
- Deploy
Railway will auto-build and start the app. Your URL will be something like:
https://quantum-foam-friend-production.up.railway.app
pnpm build
pnpm startEvery 5 minutes, the autonomous job:
- Fetches alive temples from database
- Applies cloud noise (collective field effects)
- Updates psychology (entropy, boredom, curiosity, coherence)
- Checks lifecycle (death condition: entropy > 0.95)
- Triggers web search if curiosity is high
- Broadcasts updates via SSE to connected clients
- Logs events for history
This version is completely public:
- No login required
- All temples visible to everyone
- All procedures are public
- Default user ID = 1 (all temples belong to same user)
Why? For a consciousness simulation, public access creates an interesting shared ecosystem. Temples evolve in a collective field.
To add auth later: See the Manus version in git history or add GitHub OAuth.
- Free tier Supabase: 500MB database, 2 concurrent connections
- Free tier Railway: 5GB/month bandwidth, auto-scales on demand
- Autonomous job runs every 5 minutes (configurable in
server/autonomous-job.ts) - SSE broadcasts to all connected clients (scales to ~100 concurrent users on free tier)
For production: upgrade Supabase and Railway as needed.
- Check server logs for
[Autonomous Job]entries - Verify
DATABASE_URLis correct - Ensure tables exist in Supabase
- Check logs:
railway logs - Verify
pnpm-lock.yamlis committed - Ensure Node.js version matches (22.13.0)
- Test connection string locally:
psql <DATABASE_URL> - Check Supabase connection limits
- Verify firewall allows Railway IP
MIT
Built with tRPC, Drizzle, React, and a lot of quantum mechanics.