|
|
||
|---|---|---|
| .storybook | ||
| docs | ||
| public | ||
| scripts | ||
| src | ||
| .gitignore | ||
| components.json | ||
| eslint.config.mjs | ||
| next.config.ts | ||
| package-lock.json | ||
| package.json | ||
| postcss.config.mjs | ||
| README.md | ||
| tsconfig.json | ||
| vitest.config.ts | ||
| vitest.shims.d.ts | ||
Build & runtime modes
The project can be built in two isolated configurations. The build scripts set the FUNNEL_BUILD_VARIANT/NEXT_PUBLIC_FUNNEL_BUILD_VARIANT environment variables so that unused code is tree-shaken during compilation.
- Production (frontend-only) – renders funnels using the baked JSON bundle. The admin UI and MongoDB access are not included in the bundle.
- Development preview:
npm run dev:frontend - Production build (default):
npm run buildornpm run build:frontend - Production start (default):
npm run startornpm run start:frontend
- Development preview:
- Development (full system) – runs the public frontend together with the admin panel backed by MongoDB.
- Development (default):
npm run devornpm run dev:full - Development build:
npm run build:full - Development start:
npm run start:full
- Development (default):
Local development
- Install dependencies:
npm install - Choose the required mode:
- Production preview (frontend-only):
npm run dev:frontend - Full system development:
npm run dev
- Production preview (frontend-only):
The application will be available at http://localhost:3000.
Production build
npm run build # frontend-only production bundle
# or
npm run build:full # full system development bundle
After building, start the chosen bundle with npm run start (frontend-only) or npm run start:full.
Funnel Management
Database Synchronization
To sync published funnels from MongoDB into the codebase:
# Sync all published funnels from database (keeps JSON files)
npm run sync:funnels
# Preview what would be synced (dry-run mode)
npm run sync:funnels -- --dry-run
# Sync only specific funnels
npm run sync:funnels -- --funnel-ids funnel-test,ru-career-accelerator
# Sync and clean up JSON files after baking
npm run sync:funnels -- --clean-files
This script:
- Connects to MongoDB and fetches all latest published funnels
- Downloads images from database and saves them to
public/images/ - Updates image URLs in funnels to point to local files
- Saves them as JSON files in
public/funnels/ - Bakes them into TypeScript (
src/lib/funnel/bakedFunnels.ts) - Keeps JSON files by default (use
--clean-filesto remove them)
Other Funnel Commands
# Import JSON files from public/funnels/ to MongoDB
npm run import:funnels
# Manually bake JSON files to TypeScript
npm run bake:funnels
Recommended Workflow:
- Create/edit funnels in the admin panel
- Publish them in the admin
- Run
npm run sync:funnelsto update the codebase - Build and deploy with the latest funnels