BaseCompose is a template-based project generator that creates complete, production-ready Next.js applications with selected technology stacks.
- User Selection - User selects stack components via the UI (Next.js + optional MongoDB, Auth.js)
- Blueprint Creation - Selections converted to
StackBlueprintobject - API Generation - POST to
/api/generatewith blueprint - Generation Pipeline - Server-side generation orchestrates:
- Copy framework base (Next.js scaffold)
- Copy addon files (MongoDB client, Auth.js config, Demo component)
- Merge Docker Compose files (dev and prod variants)
- Generate environment variables documentation
- Create setup guide
- Archive as tar.gz
- Download - User downloads ready-to-run project
/
├── app/
│ ├── page.tsx # Stack builder UI
│ ├── api/generate/ # Generation API endpoint
│ └── components/ # UI components
│
├── packages/
│ ├── engine/ # Generation orchestration
│ │ ├── generate.ts # Main pipeline
│ │ ├── copy.ts # File operations
│ │ ├── types.ts # Type definitions
│ │ └── emit/
│ │ ├── docker.ts # Docker Compose generation
│ │ └── env.ts # Environment variable collection
│ │
│ └── types/ # Shared type definitions
│ ├── blueprint.ts # StackBlueprint type
│ └── stack-config.ts # Available stack options
│
└── templates/ # Template files copied during generation
├── frameworks/nextjs/ # Next.js base scaffold
├── databases/mongodb/ # MongoDB addon files
├── auth/authjs/ # Auth.js addon files
├── demo/ # Feature showcase addon
└── shared/ # Shared configs (docker-compose, setup guide)
packages/engine/generate.ts (Main Orchestrator)
- Creates temporary directory for generation
- Coordinates 7-step pipeline
- Handles file cleanup
- Returns tar.gz buffer
packages/engine/copy.ts (File Operations)
copyFrameworkBase()- Copies Next.js scaffold + DockerfilecopyAddonFiles()- Places addon files in correct locations- Handles recursive directory copying
packages/engine/emit/docker.ts (Docker Compose)
mergeDockerComposeDev()- Creates dev compose with:command: pnpm devfor explicit dev mode- Volume mounts (
.:/app,/app/node_modules) for hot reload - No authentication (dev defaults)
depends_onfor service startup order
mergeDockerComposeProd()- Creates prod compose with:- Authentication enabled
restart: alwayspolicies- Environment variable configuration
writeDockerCompose()- Writes both dev and prod files
packages/engine/emit/env.ts (Environment Variables)
- Parses addon
env.tsfiles - Generates
.env.examplefile - Documents required and optional variables
Next.js Base (templates/frameworks/nextjs/base/)
- Complete Next.js App Router scaffold
- Includes Tailwind CSS, TypeScript, ESLint
package.jsonwith MongoDB and Next-auth dependencies- Imports demo component in
app/page.tsx
MongoDB Addon (templates/databases/mongodb/)
client.ts- MongoDB connection helperenv.ts- Environment variable definitionsdocker/docker-compose.mongo.yml- Service fragmentREADME.md- Setup documentation
Auth.js Addon (templates/auth/authjs/)
config.ts- NextAuth configuration with GitHub OAuthroutes/[...nextauth].ts- Route handlerenv.ts- GitHub OAuth and NextAuth env varsREADME.md- OAuth setup instructions
Demo Addon (templates/demo/)
api/health.ts- Health check endpointui/page.tsx- DemoHero component (integrated into homepage)- Shows feature availability (Next.js ✅, Database status, Auth status)
Shared (templates/shared/)
docker-compose.dev.yml- Development environmentdocker-compose.prod.yml- Production environmentREADME_SETUP.md- Comprehensive setup guide
- Command: pnpm dev (explicit dev command)
- Volume Mounts: .:/app, /app/node_modules (hot reload)
- MongoDB: No authentication
- Depends On: Ensures service startup order
- Best For: Quick iteration, testing locally- Environment: NODE_ENV=production
- Restart: always (auto-recovery)
- MongoDB: With authentication (username/password)
- Database Persistence: mongo_data volume
- Best For: Deployment, testing production setupEndpoint: POST /api/generate
Request:
{
"intent": "saas",
"framework": "nextjs",
"database": "mongodb",
"auth": "authjs"
}Response:
- 200: tar.gz file (application/gzip)
- 500: Error with message
Generated projects include .env.example with:
MongoDB:
MONGODB_URI- Connection stringMONGODB_ROOT_USERNAME- Database userMONGODB_ROOT_PASSWORD- Database password
Auth.js:
GITHUB_ID- GitHub OAuth application IDGITHUB_SECRET- GitHub OAuth secretNEXTAUTH_URL- Application URLNEXTAUTH_SECRET- Session encryption key
-
Start Development Server:
pnpm dev
-
Open UI:
http://localhost:3000 -
Generate Project:
- Select stack components
- Click "Generate & Download"
- Extract downloaded tar.gz
-
Run Generated Project:
cd extracted-project # Development Mode pnpm install pnpm dev # OR docker compose -f docker-compose.dev.yml up # Production Mode docker compose -f docker-compose.prod.yml up --build
- Ensure using
docker-compose.dev.yml(not prod) - Check volume mounts in compose file
- Try:
docker compose restart app
- Check
MONGODB_URImatches compose service name:mongodb://mongodb:27017 - Verify MongoDB container is running:
docker compose ps - View logs:
docker compose logs mongodb
- Change port in docker-compose.yml:
app.ports: ["3001:3000"] - Or stop other containers using the port
- Stop and remove containers:
docker compose -f docker-compose.dev.yml down -v - Restart:
docker compose -f docker-compose.dev.yml up
- PostgreSQL + Prisma support
- Redis caching addon
- Elasticsearch integration
- Multiple framework options (Astro, Remix)
- Cloud deployment presets (Vercel, Railway, Render)
- Email service integration
- Payment processing (Stripe)
- Analytics integration
- Framework: Next.js 16+ (App Router, TypeScript)
- Package Manager: pnpm
- Templating: File-based (not AI code generation)
- Docker: Development and production configurations
- Archiving: tar.gz for project distribution
- Types: TypeScript with strict mode