Files
gh-jamshu-jamshi-marketplac…/commands/init-project.md
2025-11-29 18:50:06 +08:00

5.1 KiB

Initialize a newly generated Odoo PWA project with all necessary setup steps.

What this command does:

  • Runs npm install to install all dependencies
  • Creates .env file from .env.example
  • Guides through environment configuration
  • Tests the Odoo connection
  • Starts the development server
  • Opens the application in browser
  • Provides next steps and documentation

Prerequisites:

  • Newly generated Odoo PWA project
  • Node.js installed (v18 or higher)
  • npm or pnpm package manager
  • Internet connection for dependencies

Steps:

1. Verify Project Structure

Check that required files exist:

  • package.json
  • .env.example
  • README.md
  • src/lib/odoo.js (or equivalent)
  • Framework config file (svelte.config.js / vite.config.js)

2. Install Dependencies

npm install

Show progress and estimated time.

3. Environment Setup

Copy .env.example to .env:

cp .env.example .env

Ask the user to provide:

  1. Odoo URL
  2. Database name
  3. API key
  4. Username
  5. Model configuration

Update .env file with provided values.

4. Verify Setup

Read .env and verify all required variables are set.

5. Test Odoo Connection

Run a quick connection test:

  • Test authentication
  • Verify model access
  • Check permissions

If connection fails, offer to run full diagnostics (/test-connection).

6. Initialize Git (if not already)

git init
git add .
git commit -m "Initial commit: Odoo PWA generated"

7. Start Development Server

npm run dev

Framework-specific commands:

  • SvelteKit: npm run dev (default port 5173)
  • React: npm run dev (default port 5173)
  • Vue: npm run dev (default port 5173)

8. Open in Browser

Automatically open browser to http://localhost:5173

Example prompts to use this command:

  • /init-project - Complete initialization wizard
  • User: "Set up my new Odoo PWA"
  • User: "Initialize the project"
  • User: "Get my PWA running"

Post-Initialization Checklist:

After successful initialization:

Immediate Next Steps:

  1. Test the application in the browser
  2. Verify data loads from Odoo
  3. Test creating a new record
  4. Test editing and deleting records
  5. Verify offline functionality (disable network)

Configuration:

  1. Review and customize PWA manifest (colors, icons, name)
  2. Update application metadata
  3. Configure deployment targets
  4. Set up version control (Git)

Development:

  1. Read the generated CLAUDE.md for architecture details
  2. Review API.md for Odoo client documentation
  3. Explore the codebase structure
  4. Customize UI components and styling

Testing:

  1. Test all CRUD operations
  2. Verify sync functionality
  3. Test offline mode
  4. Check PWA installability
  5. Test on mobile devices

Deployment Preparation:

  1. Review deployment documentation
  2. Set up hosting platform account (Vercel/Netlify/etc)
  3. Prepare production Odoo API keys
  4. Configure environment variables for production

Helpful Resources:

Provide links to:

  • Project README.md
  • CLAUDE.md (architecture guide)
  • API.md (API documentation)
  • Odoo documentation
  • Framework documentation (SvelteKit/React/Vue)
  • PWA best practices

Development Commands:

Remind the user of available commands:

npm run dev          # Start development server
npm run build        # Build for production
npm run preview      # Preview production build
npm run lint         # Run linter
npm run format       # Format code

Troubleshooting:

npm install fails

  • Check Node.js version (must be v18+)
  • Clear npm cache: npm cache clean --force
  • Delete node_modules and package-lock.json, try again
  • Check internet connection

.env configuration issues

  • Verify all variables are set (no empty values)
  • Check for typos in variable names
  • Ensure no spaces around = signs
  • Verify Odoo credentials are correct

Development server won't start

  • Check if port 5173 is already in use
  • Try different port: npm run dev -- --port 3000
  • Check for syntax errors in config files
  • Review console error messages

Odoo connection fails

  • Run /test-connection for full diagnostics
  • Verify .env file is loaded correctly
  • Check Odoo server is accessible
  • Verify API key is valid

Build fails

  • Check for TypeScript errors (if using TypeScript)
  • Verify all dependencies are installed
  • Check for missing environment variables
  • Review build logs for specific errors

After Initialization:

Display summary:

🎉 Odoo PWA Initialized Successfully!

📁 Project: [project-name]
🚀 Framework: [SvelteKit/React/Vue]
🔗 Dev Server: http://localhost:5173
📝 Model: [model-name]

✅ Next Steps:
1. Open http://localhost:5173 in your browser
2. Test data sync from Odoo
3. Read CLAUDE.md for architecture details
4. Customize the UI to match your needs
5. Run /deploy-vercel when ready to deploy

📚 Documentation:
- README.md - Getting started guide
- CLAUDE.md - Architecture and patterns
- API.md - Odoo API client reference

💡 Helpful Commands:
- /test-connection - Verify Odoo integration
- /add-model - Add more Odoo models
- /deploy-vercel - Deploy to production
- /odoo-help - Get plugin help

Happy coding! 🚀