Prerequisites
Before setting up OneGlance locally, ensure you have the following installed:Node.js
Version 20 or higher required
pnpm
Version 10 or higher required
Docker
Docker Desktop with Docker Compose
Verify Prerequisites
Check your installed versions:Step-by-Step Setup
Install dependencies
Install all workspace dependencies using pnpm:This will install dependencies for all apps and packages in the monorepo using pnpm workspaces.
Configure environment variables
Create environment files from the examples:At minimum, update these values in
.env:BETTER_AUTH_SECRET- Generate withopenssl rand -base64 32REDIS_PASSWORD- Set a strong passwordPOSTGRES_PASSWORD- Set a strong passwordCLICKHOUSE_PASSWORD- Set a strong passwordINTERNAL_CRON_SECRET- Generate a random secretGHCR_USERNAME- Your GitHub username (for Docker images)
Start infrastructure services
Start the required infrastructure services using Docker Compose:This starts:All three services should show “healthy” status.
- PostgreSQL (db) - Main application database
- ClickHouse (clickhouse) - Analytics database
- Redis (redis) - Queue and cache
Run database migrations
Initialize the database schema:This runs Drizzle ORM migrations to set up the PostgreSQL and ClickHouse schemas.
Service URLs
Once running, access the services at:| Service | URL | Description |
|---|---|---|
| Web App | http://localhost:3000 | Main authenticated product application |
| Landing | http://localhost:3000 | Public marketing website |
| Docs | http://localhost:3002 | Technical documentation |
| Drizzle Studio | Run pnpm db:studio | Database management UI |
Verification Steps
Check infrastructure services
Verify all Docker services are running and healthy:Expected output should show
db, clickhouse, and redis with “healthy” status.Test database connection
Open Drizzle Studio to verify database connectivity:This should open a browser window showing your database schema.
Access the web app
Navigate to http://localhost:3000 in your browser. You should see the OneGlance login/signup page.
Available Scripts
Common development commands:| Command | Description |
|---|---|
pnpm dev | Run all dev tasks through Turbo |
pnpm dev:web | Start only the web app |
pnpm dev:agent | Start only the agent worker |
pnpm dev:landing | Start only the landing site |
pnpm dev:docs | Start only the docs site |
pnpm build | Build all workspaces |
pnpm typecheck | Type-check all workspaces |
pnpm lint | Run lint pipelines |
pnpm lint:fix | Auto-fix linting issues |
pnpm db:generate | Generate Drizzle schema files |
pnpm db:migrate | Run database migrations |
pnpm db:push | Push schema changes to database |
pnpm db:studio | Open Drizzle Studio |
pnpm clean | Clear Turbo outputs and node_modules |
Troubleshooting
Docker services won't start
Docker services won't start
Problem:
docker compose up fails or services show unhealthy status.Solutions:- Ensure Docker Desktop is running
- Check port conflicts:
- View service logs:
- Reset Docker volumes if corrupted:
Database migration fails
Database migration fails
Problem:
pnpm db:migrate command fails with connection errors.Solutions:- Verify database service is healthy:
- Check DATABASE_URL in
.envmatches your Docker setup: - Test connection manually:
- Ensure POSTGRES_USER, POSTGRES_PASSWORD, and POSTGRES_DB in
.envmatch DATABASE_URL credentials
Web app shows connection errors
Web app shows connection errors
Problem: Web app can’t connect to database or Redis.Solutions:
- Verify all infrastructure services are running:
- Check environment variables in
.env - For local development, use
localhostin URLs: - Restart the web app after changing environment variables
pnpm install fails
pnpm install fails
Problem: Dependency installation errors.Solutions:
- Ensure you’re using pnpm 10+:
- Clear pnpm cache:
- Delete node_modules and lockfile:
- Check Node.js version (must be 20+):
Port already in use
Port already in use
Problem: Application fails to start because port is already in use.Solutions:
- Find and kill the process using the port:
- Or change the port in your environment:
Agent worker not processing jobs
Agent worker not processing jobs
Problem: Jobs submitted but not executed by agent worker.Solutions:
- Check Redis connection in agent logs
- Verify Redis password matches in both
.envandapps/agent/.env: - Ensure Redis is healthy:
- Test Redis connection:
TypeScript errors on fresh install
TypeScript errors on fresh install
Problem: Type errors after initial setup.Solutions:
- Build all packages first:
- Generate Drizzle types:
- Restart TypeScript server in your editor
- Run type check:
Next Steps
Environment Variables
Learn about all environment variables and configuration options
Docker Compose
Understand the Docker Compose setup and service architecture
Architecture
Explore the monorepo structure and data flow
Contributing
Guidelines for contributing to OneGlance