This guide explains how to properly set up and run Monynha Softwares in development mode with all features working, including the contact form API.
-
Create
.env.localfile in the project root:cp .env.example .env.local
-
Configure environment variables in
.env.local:RESEND_API_KEY=your_resend_api_key GEMINI_API_KEY=your_gemini_api_key PORT=8080 NODE_ENV=development
- Get
RESEND_API_KEYfrom Resend.com - Get
GEMINI_API_KEYfrom Google AI Studio
- Get
Terminal 1 - Start the API Server:
npm run start
# or with pnpm
pnpm startThe server will run on http://localhost:8080 and handle /api/* requests.
Terminal 2 - Start the Vite Dev Server:
npm run dev
# or with pnpm
pnpm devThe Vite dev server will run on http://localhost:3000 and proxy API requests to the backend.
If you only run:
npm run devThe frontend will work, but API calls (like the contact form) will fail with 404 errors because there's no backend server running. Use Option 1 if you need to test the contact form.
✅ Tailwind CSS Production-Ready
- Removed CDN dependency (
cdn.tailwindcss.com) - Installed
tailwindcss,postcss, andautoprefixeras dev dependencies - Created
tailwind.config.jswith brand colors - Created
postcss.config.jsfor PostCSS processing - CSS is now compiled during build for production
✅ API Proxy for Development
- Vite dev server now proxies
/api/*requests to the backend - No more 404 errors when testing contact form
- Automatic logging of proxy requests
✅ Better Error Handling
- ContactView now gracefully handles invalid JSON responses
- Improved error messages for users
- Better console logging for debugging
The project now uses:
- PostCSS to compile Tailwind CSS
- tailwind.config.js for configuration (instead of inline in HTML)
- index.css for Tailwind directives (
@tailwind base; components; utilities;)
All custom styles (text-outline, glass, scrollbar) are defined in index.css.
npm run buildThis will:
- Compile Tailwind CSS to optimized CSS
- Build React components with Vite
- Generate sitemap
Then serve with:
npm run start- Make sure the API server is running on port 8080
- Check that
RESEND_API_KEYis set in.env.local
This happens when:
- You're using
vite previewinstead ofnpm startfor production - The API server isn't running or is unreachable
- The proxy configuration in
vite.config.tsis incorrect
Solution: Always use npm start after building for production. The Express server handles both static files AND API endpoints.
The frontend now handles non-JSON responses gracefully. If you see these errors:
- Check that both servers are running (dev mode)
- Check that
npm startis running (production mode) - Verify the API endpoint is accessible at
http://localhost:8080/api/contact
Make sure:
- API server is running on port 8080 (Terminal 1:
npm start) vite.config.tshas the proxy configuration:server: { proxy: { '/api': { target: 'http://localhost:8080', changeOrigin: true, } } }
- Check browser DevTools Network tab to confirm proxy is working
- Run
pnpm installto ensure PostCSS plugins are installed - Restart the dev server after installing dependencies
- Check that
index.cssis imported inindex.tsx
- Verify Express server is running:
npm run start - Check logs in terminal running the server
- Ensure
RESEND_API_KEYis correctly set
npm run dev- Start Vite dev server (port 3000)npm run build- Build for productionnpm run preview- Preview production build locallynpm run start- Run Express production server