This guide will help you set up the BaseCompose project locally for development.
- Node.js: 18.0.0 or higher
- pnpm: 8.0.0 or higher
- MongoDB: 7.0.0 or higher (for local development)
- Git: Latest version
brew install node pnpm mongodb-community gitcurl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
curl -fsSL https://get.pnpm.io/install.sh | sh -
sudo apt-get install -y git
# MongoDB
curl -fsSL https://www.mongodb.com/try/download/community | \
tar xvz && sudo mv mongodb-linux-*/bin/* /usr/local/bin/# Using Chocolatey
choco install nodejs pnpm git mongodb-communitygit clone https://github.com/icancodefyi/basecompose.git
cd basecomposepnpm installCreate a .env.local file in the project root:
cp .env.example .env.localEdit .env.local and add your credentials:
# AI APIs
GEMINI_API_KEY=your_gemini_api_key
GROQ_API_KEY=your_groq_api_key
# NextAuth Configuration
NEXTAUTH_SECRET=generate_a_random_secret_here
NEXTAUTH_URL=http://localhost:3000
# Google OAuth (for authentication)
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
# MongoDB
MONGODB_URI=mongodb://localhost:27017/basecomposeGemini API Key:
- Go to Google AI Studio
- Click "Get API Key"
- Copy your API key
GROQ API Key:
- Visit GROQ Console
- Sign up/login
- Create a new API key
Google OAuth:
- Go to Google Cloud Console
- Create a new project
- Enable Google+ API
- Create OAuth 2.0 credentials (Web Application)
- Add
http://localhost:3000/api/auth/callback/googleto authorized redirect URIs
# macOS
brew services start mongodb-community
# Linux
sudo systemctl start mongod
# Windows (with MongoDB Community Server installed)
mongodVerify MongoDB is running:
mongosh
# You should see the MongoDB shell prompt
# Type 'exit' to quitpnpm devThe application will be available at http://localhost:3000
- Open http://localhost:3000 in your browser
- You should see the BaseCompose landing page
- Try signing in with Google
- Create a new project and send a message
basecompose/
├── app/ # Next.js application
│ ├── api/ # API routes
│ │ ├── auth/ # NextAuth configuration
│ │ ├── chat/ # Chat endpoint
│ │ ├── generate/ # Stack generation endpoint
│ │ ├── projects/ # Project management
│ │ └── chat/history/ # Chat history management
│ ├── chat/ # Chat pages
│ │ ├── page.tsx # Main chat page
│ │ └── [projectId]/page.tsx # Project-specific chat
│ ├── components/ # React components
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utility functions
│ │ ├── mongodb.ts # MongoDB connection
│ │ ├── auth-utils.ts # Auth utilities
│ │ └── utils.ts # General utilities
│ └── layout.tsx # Root layout
│
├── packages/ # pnpm workspaces
│ ├── engine/ # Generation engine
│ │ ├── generate.ts # Main generation logic
│ │ ├── copy.ts # File operations
│ │ ├── emit/ # Output generation
│ │ └── types.ts # Type definitions
│ └── types/ # Shared types
│ ├── blueprint.ts # StackBlueprint type
│ └── stack-config.ts # Stack options
│
├── templates/ # Template files
│ ├── frameworks/nextjs/ # Next.js scaffold
│ ├── databases/mongodb/ # MongoDB addon
│ ├── auth/authjs/ # Auth.js addon
│ ├── demo/ # Demo addon
│ └── shared/ # Shared configs
│
├── lib/ # Root-level utilities
├── components/ # Root-level components
├── public/ # Static assets
├── .github/ # GitHub templates
├── scripts/ # Development scripts
└── [config files] # TypeScript, ESLint, etc.
# Development
pnpm dev # Start dev server
pnpm dev:watch # Start with watch mode
# Building
pnpm build # Build for production
pnpm start # Start production server
# Linting & Formatting
pnpm lint # Run ESLint
pnpm lint:fix # Fix ESLint issues
# Type Checking
pnpm typecheck # Run TypeScript type checking
# Testing
pnpm test # Run tests (when available)
pnpm test:watch # Run tests in watch modeError: connect ECONNREFUSED 127.0.0.1:27017
Solution: Make sure MongoDB is running
brew services start mongodb-community # macOS
sudo systemctl start mongod # Linux
mongod # Manual startError: Missing NEXTAUTH_SECRET
Solution: Create .env.local with all required variables (see Step 3)
# Clear pnpm cache and reinstall
pnpm store prune
pnpm install# Kill process on port 3000
lsof -ti:3000 | xargs kill -9 # macOS/Linux
netstat -ano | findstr :3000 # Windows (find PID and kill)DEBUG=* pnpm devpnpm tsc --noEmitmongosh
# List databases
show dbs
# Use basecompose database
use basecompose
# List collections
show collections
# Query data
db.projects.find()
db.chat_messages.find()- Read the Contributing Guide: CONTRIBUTING.md
- Check the Architecture: DEVELOPMENT.md
- View Chat History Guide: CHAT_HISTORY_IMPLEMENTATION.md
- Explore Issues: Look for good first issues
- Questions: Open a Discussion
- Bugs: Report on Issues
- Security: Email maintainers (see SECURITY.md)
Happy coding! 🚀